/* ═══════════════════════════════════════════════
   SKINARI AI Chat Assistant
   ═══════════════════════════════════════════════ */

/* Floating Chat Bubble */
.chat-widget-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    box-shadow: 0 8px 24px rgba(184, 163, 137, 0.4);
    cursor: pointer;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.theme-dark .chat-widget-btn {
    background: var(--color-gold);
}

.chat-widget-btn:hover {
    transform: scale(1.1);
}

.chat-widget-btn .icon {
    width: 28px;
    height: 28px;
}
.chat-widget-btn .icon-close {
    display: none;
}
.chat-widget-btn.open .icon-chat {
    display: none;
}
.chat-widget-btn.open .icon-close {
    display: block;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 360px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    z-index: 2999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    visibility: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-dark .chat-window {
    background: rgba(30, 27, 25, 0.95);
    backdrop-filter: blur(16px);
    border-color: rgba(184, 163, 137, 0.2);
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}

.chat-window.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    padding: var(--space-md);
    background: var(--color-primary);
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 12px;
}
.theme-dark .chat-header {
    background: rgba(42, 38, 35, 0.9);
    border-bottom: 1px solid rgba(184, 163, 137, 0.1);
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

.chat-header-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Chat Body (Messages) */
.chat-body {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    max-width: 85%;
    animation: msgFadeIn 0.3s forwards;
}

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

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
}

.chat-msg-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.chat-msg.bot .chat-msg-bubble {
    background: #2D2824;
    color: #F8F5F1;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(184, 163, 137, 0.2);
}

.chat-msg.user .chat-msg-bubble {
    background: #C4A882;
    color: #1A1715;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Typing Indicator */
.chat-typing {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--color-border);
    margin-bottom: 8px;
}
.theme-dark .chat-typing {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.chat-typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--color-text-light);
    border-radius: 50%;
    margin-right: 4px;
    animation: typing 1.4s infinite forwards;
}
.theme-dark .chat-typing span {
    background: var(--color-text-muted);
}

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

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Chat Input */
.chat-footer {
    padding: var(--space-md);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 8px;
}
.theme-dark .chat-footer {
    background: rgba(30, 27, 25, 0.95);
    border-top-color: rgba(184, 163, 137, 0.2);
}

.chat-input {
    flex: 1;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 12px 16px;
    background: transparent;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
}
.theme-dark .chat-input {
    border-color: rgba(184, 163, 137, 0.4);
    color: var(--color-white);
}
.chat-input::placeholder {
    color: var(--color-text-light);
}

.chat-send-btn {
    background: #C4A882;
    color: #1A1715;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, opacity 0.3s;
}
.chat-send-btn:hover {
    transform: scale(1.05);
    opacity: 0.9;
}
.chat-send-btn svg {
    margin-right: -2px; /* visual center for send arrow */
}

/* Sleek Scrollbar */
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(184, 163, 137, 0.3);
    border-radius: 10px;
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 163, 137, 0.6);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-window {
        bottom: 0; left: 0; right: 0;
        width: 100%; height: 100%;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    .chat-window.open {
        transform: translateY(0);
    }
}
