/* ========================================
   CHAT WIDGET — AI Assistant
   ======================================== */

.chat-toggle {
    position: fixed;
    bottom: 100px;
    left: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-bg);
    border: none;
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(196, 93, 38, 0.4);
    transition: all 0.3s ease;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.chat-toggle:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 30px rgba(196, 93, 38, 0.5);
}

.chat-toggle.active {
    background: var(--color-accent);
    box-shadow: 0 0 30px rgba(255, 107, 26, 0.4);
}

.chat-toggle .chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--color-bg);
    animation: pulseRing 2s ease-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 170px;
    left: 32px;
    width: 380px;
    max-width: calc(100vw - 64px);
    max-height: 520px;
    background: var(--color-surface);
    border: 1px solid rgba(196, 93, 38, 0.25);
    border-radius: 16px;
    z-index: 1002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0,0,0,0.5), 0 0 40px rgba(196, 93, 38, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-bg);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
}

.chat-header-text h4 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.chat-header-text span {
    font-size: 0.75rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-header-text .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.chat-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: none;
    color: var(--color-bg);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

/* Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(196,93,38,0.2) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(196,93,38,0.2); border-radius: 4px; }

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
}

.chat-msg.bot {
    align-self: flex-start;
    align-items: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.55;
}

.chat-msg.bot .chat-bubble {
    background: rgba(6, 6, 6, 0.6);
    border: 1px solid rgba(196, 93, 38, 0.12);
    color: var(--color-text);
    border-top-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
    background: var(--color-primary);
    color: var(--color-bg);
    border-top-right-radius: 4px;
}

.chat-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* Typing */
.typing-indicator .chat-bubble {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Suggestions */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 8px;
}

.chat-chip {
    background: rgba(196, 93, 38, 0.1);
    border: 1px solid rgba(196, 93, 38, 0.2);
    color: var(--color-primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-body);
}

.chat-chip:hover {
    background: var(--color-primary);
    color: var(--color-bg);
    border-color: var(--color-primary);
}

/* Input area */
.chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(240, 235, 227, 0.06);
}

.chat-input-area input {
    flex: 1;
    background: rgba(6, 6, 6, 0.5);
    border: 1px solid rgba(240, 235, 227, 0.1);
    border-radius: 24px;
    padding: 10px 16px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input-area input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(196, 93, 38, 0.12);
}

.chat-input-area input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.5;
}

.chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    border: none;
    color: var(--color-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-input-area button:hover {
    background: var(--color-accent);
    transform: scale(1.08);
}

.chat-input-area button svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-toggle {
        bottom: 80px;
        left: 20px;
        width: 50px;
        height: 50px;
    }
    .chat-window {
        left: 16px;
        right: 16px;
        bottom: 145px;
        width: auto;
        max-width: none;
        max-height: 460px;
    }
}
