/* ========== CHAT BUTTON ========== */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(201, 169, 110, 0.5);
}

.chat-fab svg {
    width: 24px;
    height: 24px;
    color: var(--bg-primary);
    transition: transform 0.3s ease;
}

.chat-fab.open svg {
    transform: rotate(90deg);
}

/* ========== CHAT WINDOW ========== */
.chat-window {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 9998;
    overflow: hidden;
    animation: chatSlideIn 0.3s ease;
}

.chat-window.open {
    display: flex;
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== CHAT HEADER ========== */
.chat-header {
    padding: 16px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-avatar svg {
    width: 20px;
    height: 20px;
    color: var(--bg-primary);
}

.chat-header-info h4 {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.chat-header-info p {
    font-size: 0.72rem;
    color: var(--success);
}

/* ========== CHAT MESSAGES ========== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 340px;
    min-height: 200px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-message.bot {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: var(--text-secondary);
}

.chat-message.user {
    background: var(--gold);
    color: var(--bg-primary);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-typing {
    align-self: flex-start;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
}

.chat-typing span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}

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

@keyframes typingBounce {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* ========== QUICK ACTIONS ========== */
.chat-quick-actions {
    padding: 8px 16px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.quick-action-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
    white-space: nowrap;
}

.quick-action-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ========== CHAT INPUT ========== */
.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg-card);
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--gold);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--gold-light);
    transform: scale(1.05);
}

.chat-send-btn svg {
    width: 16px;
    height: 16px;
    color: var(--bg-primary);
}

/* ========== SCROLLBAR ========== */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

/* ========== CHAT CLOSE BUTTON ========== */
.chat-close-btn {
    display: flex;
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.chat-close-btn:hover {
    color: var(--text-primary);
}

.chat-close-btn svg {
    width: 20px;
    height: 20px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .chat-fab {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-height: none;
        height: 100%;
        border-radius: 0;
        border: none;
        z-index: 10000;
    }

    .chat-window .chat-messages {
        max-height: none;
        min-height: 0;
        flex: 1;
    }

    .chat-window .chat-input-area {
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
