/**
 * MAISON DALI CHATBOT STYLING
 * ============================
 * Branded chatbot widget matching site design
 * Colors: Burgundy (#5D0002), Gold (#D4AF37)
 * Fonts: Cinzel (headings), Montserrat (body)
 */

:root {
    --chatbot-primary: #5D0002;
    --chatbot-accent: #D4AF37;
    --chatbot-bg: #0a0a0a;
    --chatbot-text: #ffffff;
    --chatbot-secondary: #1a0c24;
    --chatbot-border: rgba(212, 175, 55, 0.3);
}

/* Container */
#chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'Montserrat', sans-serif;
}

/* Toggle Button (Floating Icon) */
.chatbot-toggle,
#chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: 3px solid var(--chatbot-accent);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow: hidden;
}

.chatbot-toggle:hover,
#chatbot-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.6);
}

.chatbot-toggle::before,
#chatbot-toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.2), transparent);
    animation: pulse 2s ease-in-out infinite;
}

.chatbot-toggle svg,
#chatbot-toggle svg {
    position: relative;
    z-index: 1;
    color: var(--chatbot-accent);
    stroke-width: 2;
}

/* Legacy Button Class Support */
.chatbot-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: 3px solid var(--chatbot-accent);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.chatbot-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.6);
}

.chatbot-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.2), transparent);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.chatbot-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-online-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background: #4ade80;
    border: 2px solid var(--chatbot-bg);
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: var(--chatbot-bg);
    border: 2px solid var(--chatbot-accent);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8), 
                0 0 20px rgba(212, 175, 55, 0.3);
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: none; /* Hidden by default */
    flex-direction: column;
    z-index: 9998;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary), var(--chatbot-secondary));
    color: var(--chatbot-text);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 2px solid var(--chatbot-accent);
    position: relative;
}

.chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--chatbot-accent), transparent);
}

.chatbot-avatar-small {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--chatbot-accent);
    object-fit: cover;
}

.chatbot-header-title {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--chatbot-accent);
    letter-spacing: 0.05em;
}

.chatbot-status {
    font-size: 13px;
    color: #4ade80;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: currentColor;
    border-radius: 50%;
    display: inline-block;
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-close-btn,
.chatbot-close,
#chatbot-close {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--chatbot-accent);
    color: var(--chatbot-accent);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close-btn:hover,
.chatbot-close:hover,
#chatbot-close:hover {
    background: var(--chatbot-accent);
    color: var(--chatbot-primary);
    transform: rotate(90deg);
}

/* Messages */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--chatbot-bg);
    background-image: radial-gradient(circle at 10% 20%, rgba(93, 0, 2, 0.05), transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(212, 175, 55, 0.05), transparent 40%);
}

.message-user {
    background: var(--chatbot-primary);
    color: white;
    padding: 14px 18px;
    border-radius: 16px 16px 4px 16px;
    margin-bottom: 12px;
    max-width: 85%;
    margin-left: auto;
    border: 1px solid var(--chatbot-accent);
    box-shadow: 0 2px 8px rgba(93, 0, 2, 0.3);
    font-size: 14px;
    line-height: 1.5;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-bot {
    background: var(--chatbot-secondary);
    color: white;
    padding: 14px 18px;
    border-radius: 16px 16px 16px 4px;
    margin-bottom: 12px;
    max-width: 85%;
    border: 1px solid var(--chatbot-border);
    box-shadow: 0 2px 8px rgba(26, 12, 36, 0.3);
    font-size: 14px;
    line-height: 1.5;
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 6px;
    font-weight: 400;
}

/* Typing Indicator */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 14px 18px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--chatbot-accent);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.chatbot-input-container {
    padding: 16px;
    background: var(--chatbot-secondary);
    border-top: 2px solid var(--chatbot-accent);
}

.chatbot-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--chatbot-bg);
    border: 1px solid var(--chatbot-border);
    border-radius: 10px;
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.chatbot-send-button {
    background: var(--chatbot-primary);
    color: white;
    border: 1px solid var(--chatbot-accent);
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: 10px;
    width: 100%;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chatbot-send-button:hover {
    background: var(--chatbot-accent);
    color: var(--chatbot-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.chatbot-send-button:active {
    transform: translateY(0);
}

/* Scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: var(--chatbot-bg);
    border-radius: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--chatbot-accent);
    border-radius: 4px;
    border: 2px solid var(--chatbot-bg);
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #e5c259;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-button {
        width: 60px;
        height: 60px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        right: 0;
        bottom: 0;
        border: none;
    }
    
    #chatbot-widget {
        bottom: 0;
        right: 0;
    }
    
    .chatbot-button {
        bottom: 20px;
        right: 20px;
    }
}

/* Animation for window open/close */
.chatbot-window.opening {
    animation: slideUp 0.3s ease-out;
}

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