/* =============================================
   EDITH CHAT WIDGET
   ============================================= */

/* Floating button */
.edith-chat-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9990;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(212,175,55,0.4);
    background: #0C0C0C;
    color: #D4AF37;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    font-size: 1.25rem;
}
.edith-chat-toggle:hover {
    transform: scale(1.08);
    border-color: #D4AF37;
    background: #141414;
    box-shadow: 0 4px 32px rgba(212,175,55,0.15);
}
.edith-chat-toggle .chat-icon-open,
.edith-chat-toggle .chat-icon-close { transition: opacity 0.2s ease; }
.edith-chat-toggle.is-open .chat-icon-open { display: none; }
.edith-chat-toggle:not(.is-open) .chat-icon-close { display: none; }

/* Chat panel */
.edith-chat-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    z-index: 9991;
    width: 380px;
    max-height: 520px;
    background: #0C0C0C;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.edith-chat-panel.is-open { display: flex; }

/* Header */
.edith-chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: #141414;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.edith-chat-header img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
}
.edith-chat-header-text {
    flex: 1;
}
.edith-chat-header-title {
    font-family: 'Cinzel', serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #F5F5F5;
    margin: 0;
}
.edith-chat-header-sub {
    font-size: 0.625rem;
    color: #5A5A5A;
    margin: 0;
}
.edith-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.06);
    background: none;
    color: #5A5A5A;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}
.edith-chat-close:hover { border-color: #D4AF37; color: #D4AF37; }

/* Messages area */
.edith-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 280px;
    max-height: 340px;
    scroll-behavior: smooth;
}
.edith-chat-messages::-webkit-scrollbar { width: 4px; }
.edith-chat-messages::-webkit-scrollbar-track { background: transparent; }
.edith-chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* Chat bubbles */
.edith-chat-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #F5F5F5;
    animation: edithChatFadeIn 0.25s ease;
}
.edith-chat-bubble--bot {
    background: #1C1C1C;
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px 12px 12px 4px;
    align-self: flex-start;
}
.edith-chat-bubble--user {
    background: rgba(212,175,55,0.12);
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 12px 12px 4px 12px;
    align-self: flex-end;
    color: #D4AF37;
}
.edith-chat-bubble strong {
    color: #D4AF37;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
}
@keyframes edithChatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Suggested questions */
.edith-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.25rem;
}
.edith-chat-suggestion {
    padding: 0.375rem 0.75rem;
    background: none;
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 16px;
    color: #D4AF37;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}
.edith-chat-suggestion:hover {
    background: rgba(212,175,55,0.08);
    border-color: rgba(212,175,55,0.4);
}

/* Category chips */
.edith-chat-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.25rem;
}
.edith-chat-category {
    padding: 0.375rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    color: #9A9A9A;
    font-size: 0.6875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.edith-chat-category:hover { border-color: rgba(212,175,55,0.3); color: #D4AF37; }

/* Fallback CTA */
.edith-chat-fallback-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}
.edith-chat-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(212,175,55,0.2);
    border-radius: 16px;
    color: #D4AF37;
    font-size: 0.6875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}
.edith-chat-fallback-link:hover { background: rgba(212,175,55,0.08); border-color: rgba(212,175,55,0.4); }

/* Input area */
.edith-chat-input-area {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: #141414;
    flex-shrink: 0;
}
.edith-chat-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.edith-chat-input {
    flex: 1;
    padding: 0.625rem 0.875rem;
    background: #1C1C1C;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    color: #F5F5F5;
    font-size: 0.8125rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s ease;
}
.edith-chat-input::placeholder { color: #5A5A5A; }
.edith-chat-input:focus { border-color: rgba(212,175,55,0.3); }
.edith-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(212,175,55,0.12);
    color: #D4AF37;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.edith-chat-send:hover { background: rgba(212,175,55,0.2); }

/* Typing indicator */
.edith-chat-typing {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1rem;
    align-self: flex-start;
}
.edith-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5A5A5A;
    animation: edithChatTyping 1.2s infinite;
}
.edith-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.edith-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes edithChatTyping {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

/* Mobile */
@media (max-width: 480px) {
    .edith-chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 12px 12px 0 0;
    }
    .edith-chat-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
    .edith-chat-messages {
        max-height: 55vh;
        min-height: 200px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .edith-chat-bubble { animation: none; }
    .edith-chat-toggle { transition: none; }
    .edith-chat-typing span { animation: none; }
}
