/* ============================================================
   CHATBOT WIDGET STYLES — Golden theme
   ============================================================ */

/* Golden palette */
:root {
    --chat-gold:        #f5a623;
    --chat-gold-dark:   #d4860a;
    --chat-gold-deep:   #b56c00;
    --chat-gold-light:  #fcd16a;
    --chat-gold-glow:   rgba(245, 166, 35, 0.45);
    --chat-gold-subtle: rgba(245, 166, 35, 0.12);
}

/* ── Trigger button ──────────────────────────────────────── */
.chatbot-trigger {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    z-index: 1000;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-gold) 0%, var(--chat-gold-dark) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px var(--chat-gold-glow), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px var(--chat-gold-glow), 0 4px 12px rgba(0,0,0,0.35);
}

.chatbot-trigger:focus-visible {
    outline: 3px solid var(--chat-gold-light);
    outline-offset: 3px;
}

/* Unread badge */
.chatbot-badge {
    position: absolute;
    top: -0.2rem;
    right: -0.2rem;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ── Panel ───────────────────────────────────────────────── */
.chatbot-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.75rem;
    z-index: 999;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    max-height: 70vh;
    background: var(--color-surface, #1e293b);
    border-radius: 1rem;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(245,166,35,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(1rem) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.chatbot-panel--open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Header ──────────────────────────────────────────────── */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, var(--chat-gold) 0%, var(--chat-gold-dark) 100%);
    color: #fff;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.chatbot-avatar {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.chatbot-header-name {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

.chatbot-header-status {
    margin: 0;
    font-size: 0.72rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.chatbot-status-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

.chatbot-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.chatbot-close-btn:hover { opacity: 1; }

/* ── Messages ────────────────────────────────────────────── */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(245,166,35,0.2); border-radius: 2px; }

/* Chat bubbles */
.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: bubbleIn 0.18s ease;
}

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-bubble--bot  { align-self: flex-start; }
.chat-bubble--user { align-self: flex-end;   }

.chat-text {
    display: inline-block;
    padding: 0.55rem 0.85rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}

.chat-bubble--bot  .chat-text {
    background: var(--color-surface-alt, #334155);
    color: var(--color-text, #e2e8f0);
    border-bottom-left-radius: 0.25rem;
}

.chat-bubble--user .chat-text {
    background: linear-gradient(135deg, var(--chat-gold) 0%, var(--chat-gold-dark) 100%);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.chat-bubble--bot  .chat-text a { color: var(--chat-gold-light, #fcd16a); }
.chat-bubble--user .chat-text a { color: rgba(255,255,255,0.85); }

.chat-time {
    font-size: 0.65rem;
    color: var(--color-muted, #64748b);
    margin-top: 0.2rem;
    padding: 0 0.25rem;
}

.chat-bubble--user .chat-time { text-align: right; }

/* Typing indicator */
.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface-alt, #334155);
    border-radius: 1rem;
    border-bottom-left-radius: 0.25rem;
}

.chat-typing span {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--chat-gold, #f5a623);
    animation: typingDot 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDot {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
    40%            { transform: scale(1);   opacity: 1;    }
}

/* ── Quick replies ───────────────────────────────────────── */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(245,166,35,0.1);
    flex-shrink: 0;
}

.quick-reply-btn {
    background: transparent;
    border: 1px solid var(--chat-gold, #f5a623);
    color: var(--chat-gold, #f5a623);
    border-radius: 1rem;
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.quick-reply-btn:hover {
    background: var(--chat-gold, #f5a623);
    color: #fff;
}

/* ── Input bar ───────────────────────────────────────────── */
.chatbot-input-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid rgba(245,166,35,0.1);
    flex-shrink: 0;
    background: var(--color-surface, #1e293b);
}

.chatbot-input {
    flex: 1;
    background: var(--color-surface-alt, #334155);
    border: 1px solid rgba(245,166,35,0.2);
    border-radius: 1.5rem;
    padding: 0.5rem 0.9rem;
    color: var(--color-text, #e2e8f0);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.chatbot-input::placeholder { color: var(--color-muted, #64748b); }
.chatbot-input:focus {
    border-color: var(--chat-gold, #f5a623);
    box-shadow: 0 0 0 2px rgba(245,166,35,0.15);
}

.chatbot-send-btn {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-gold) 0%, var(--chat-gold-dark) 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: box-shadow 0.15s, transform 0.15s;
}

.chatbot-send-btn:hover {
    box-shadow: 0 0 14px var(--chat-gold-glow);
    transform: scale(1.08);
}
.chatbot-send-btn:active { transform: scale(0.95); }

/* ── Mobile adjustments ──────────────────────────────────── */
@media (max-width: 480px) {
    .chatbot-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .chatbot-trigger {
        bottom: 1.2rem;
        right: 1.2rem;
    }
}
