/**
 * Egerty Chat Widget Styles
 *
 * All styles scoped under .egerty-chat-* to avoid conflicts with themes.
 * Primary color controlled via --egerty-primary-color CSS custom property.
 */

/* ============================================================
   Floating Chat Button
   ============================================================ */

.egerty-chat-button {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.egerty-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.egerty-chat-button--hidden {
    display: none;
}

/* ============================================================
   Chat Panel
   ============================================================ */

.egerty-chat-panel {
    position: fixed;
    bottom: 90px;
    z-index: 999999;
    width: 380px;
    height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

.egerty-chat-panel--hidden {
    display: none !important;
}

/* Mobile: full screen */
.egerty-chat-panel--fullscreen {
    width: 100vw;
    height: 100vh;
    bottom: 0;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0;
}

/* ============================================================
   Header
   ============================================================ */

.egerty-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
    flex-shrink: 0;
}

.egerty-chat-header-title {
    font-weight: 600;
    font-size: 15px;
}

.egerty-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.egerty-chat-close:hover {
    opacity: 1;
}

/* ============================================================
   Messages Container
   ============================================================ */

.egerty-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ============================================================
   Message Bubbles
   ============================================================ */

.egerty-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.egerty-message--user {
    align-self: flex-end;
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.egerty-message--assistant {
    align-self: flex-start;
    background-color: #f1f3f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

/* Markdown inside assistant messages */
.egerty-message--assistant p {
    margin: 0 0 8px;
}

.egerty-message--assistant p:last-child {
    margin-bottom: 0;
}

.egerty-message--assistant strong {
    font-weight: 600;
}

.egerty-message--assistant ul,
.egerty-message--assistant ol {
    margin: 4px 0;
    padding-left: 20px;
}

.egerty-message--assistant li {
    margin-bottom: 2px;
}

.egerty-message--assistant a {
    color: var(--egerty-primary-color, #2563eb);
    text-decoration: underline;
}

/* ============================================================
   Input Area
   ============================================================ */

.egerty-chat-input {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    gap: 8px;
}

.egerty-chat-input-field {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.egerty-chat-input-field:focus {
    border-color: var(--egerty-primary-color, #2563eb);
}

.egerty-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s;
}

.egerty-chat-send:hover {
    filter: brightness(0.9);
}

/* ============================================================
   Typing Indicator
   ============================================================ */

.egerty-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    align-self: flex-start;
    background-color: #f1f3f5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.egerty-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #adb5bd;
    animation: egerty-bounce 1.4s ease-in-out infinite both;
}

.egerty-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.egerty-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes egerty-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================================
   Suggested Actions
   ============================================================ */

.egerty-suggested-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.egerty-action-chip {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--egerty-primary-color, #2563eb);
    border-radius: 16px;
    background: #fff;
    color: var(--egerty-primary-color, #2563eb);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-family: inherit;
}

.egerty-action-chip:hover {
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
}

/* ============================================================
   Form Cards (lead_form, contact_form, display_contact)
   ============================================================ */

.egerty-form-card {
    align-self: flex-start;
    max-width: 90%;
    background-color: #f0f0ff;
    border: 1px solid #d4d4f7;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.egerty-form-card--disabled {
    opacity: 0.7;
    pointer-events: none;
}

.egerty-form-title {
    font-weight: 600;
    font-size: 14px;
    color: #3730a3;
    margin-bottom: 2px;
}

.egerty-form-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.egerty-form-label {
    font-size: 12px;
    font-weight: 500;
    color: #4b5563;
}

.egerty-form-input {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    resize: vertical;
}

.egerty-form-input:focus {
    border-color: var(--egerty-primary-color, #2563eb);
}

.egerty-form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

.egerty-form-submit {
    align-self: flex-start;
    padding: 7px 20px;
    border: none;
    border-radius: 6px;
    background-color: var(--egerty-primary-color, #2563eb);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
}

.egerty-form-submit:hover {
    filter: brightness(0.9);
}

.egerty-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Contact display items */
.egerty-contact-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0f0;
}

.egerty-contact-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.egerty-contact-value {
    font-size: 13px;
    color: #1a1a1a;
}

a.egerty-contact-value {
    color: var(--egerty-primary-color, #2563eb);
    text-decoration: underline;
    cursor: pointer;
}
