/* 
 * Wait4Tech Chatbot - Site Aligned Theme
 * Theme: Clean, Professional, Brand-Integrated
 */

:root {
    /* Color Palette - Directly matching main.css variables */
    --chat-primary: #2c6ba1;
    --chat-accent: #2c6ba1;
    --chat-accent-hover: #1f318a;
    --chat-header-bg: #2c6ba1;
    --chat-bg-light: #f3f9ff;
    --chat-white: #ffffff;
    /* Text Colors */
    --chat-text-main: #212529;
    --chat-text-heading: #2d465e;
    --chat-text-muted: #667e99;
    --chat-user-text: #ffffff;
    /* Transitions & Shadows */
    --chat-shadow-soft: 0 5px 15px rgba(0,0,0,0.08);
    --chat-shadow-window: 0 15px 50px rgba(0, 0, 0, 0.12);
    --chat-transition: all 0.3s ease;
    /* Font - Reverting to site defaults */
    --chat-font: "Roboto", system-ui, -apple-system, sans-serif;
    /* Border Radius */
    --chat-radius-lg: 16px;
    --chat-radius-md: 12px;
    --chat-radius-sm: 50px;
}

#chat-widget-container {
    position: fixed;
    bottom: 65px;
    right: 15px;
    z-index: 10000;
    font-family: var(--chat-font);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#chat-notification {
    display:none;
    position: absolute;
    right: 65px; 
    bottom: 20px; 
    background: #ffffff;
    color: #2d465e;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid #2c6ba1;
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    white-space: nowrap; 
}
    #chat-notification::after {
        content: '';
        position: absolute;
        right: -6px;
        top: 60%;
        transform: translateY(-70%);
        width: 0;
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-left: 6px solid #2c6ba1;
    }
    #chat-notification::before {
        content: '';
        position: absolute;
        right: -5px;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        height: 0;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-left: 5px solid #ffffff;
    }
@keyframes chatFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* FAB - Floating Action Button */
#chat-widget-button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--chat-accent);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(44, 107, 161, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    position: relative;
    z-index: 10001;
}

#chat-widget-button:hover {
    transform: scale(1.05);
    background: var(--chat-accent-hover);
}

#chat-widget-button::after {
    content: '';
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: var(--chat-primary);
    opacity: 0.2;
    z-index: -1;
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Window */
#chat-window {
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 370px;
    height: 70vh;
    min-height: 480px;
    max-height: 700px;
    background: var(--chat-white);
    border-radius: var(--chat-radius-lg);
    box-shadow: var(--chat-shadow-window);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    transform-origin: bottom right;
    animation: chatSlideUp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

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

/* Header */
.chat-header {
    background: var(--chat-header-bg);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header .bot-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
}

.bot-details h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    color: white;
}

.bot-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
}

.close-chat {
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    transition: opacity 0.2s;
}

.close-chat:hover { opacity: 0.7; }

/* Message Area */
#chat-body {
    flex: 1;
    padding: 20px;
    background: var(--chat-white);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

#chat-body::-webkit-scrollbar { width: 4px; }
#chat-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }

/* Bubbles */
.message {
    max-width: 85%;
    padding: 10px 15px;
    font-size: 14px;
    line-height: 1.5;
    animation: chatMsgIn 0.3s ease-out both;
}

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

.bot-msg {
    align-self: flex-start;
    background: var(--chat-bg-light);
    color: var(--chat-text-main);
    border-radius: var(--chat-radius-md);
    border: 1px solid rgba(13, 131, 253, 0.05);
}

.user-msg {
    align-self: flex-end;
    background: var(--chat-primary);
    color: var(--chat-user-text);
    border-radius: var(--chat-radius-md);
    box-shadow: 0 4px 12px rgba(13, 131, 253, 0.1);
}

/* Typing */
.typing {
    align-self: flex-start;
    background: var(--chat-bg-light);
    padding: 10px 15px;
    border-radius: var(--chat-radius-md);
    display: none;
    gap: 4px;
}

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

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

@keyframes chatTyping {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Buttons/Options */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-btn {
    background: var(--chat-white);
    border: 1px solid #e2e8f0;
    color: var(--chat-primary);
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--chat-transition);
}

.chat-btn:hover {
    background: var(--chat-primary);
    color: white;
    border-color: var(--chat-primary);
    box-shadow: 0 4px 12px rgba(13, 131, 253, 0.15);
}

/* Input */
.chat-input-area {
    background: var(--chat-white);
    padding: 15px 20px;
    border-top: 1px solid #f1f5f9;
    display: none;
    align-items: center;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--chat-radius-sm);
    border: 1px solid #e2e8f0;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-input-area input:focus { border-color: var(--chat-primary); }

.chat-input-area button {
    background: var(--chat-primary);
    color: white;
    border: none;
    width: 40px; height: 40px;
    border-radius: var(--chat-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
}

.chat-input-area button:hover { background: var(--chat-accent-hover); }

/* Form Component */
.chat-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    background: var(--chat-white);
    padding: 15px;
    border-radius: var(--chat-radius-md);
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.chat-form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--chat-radius-sm);
    border: 1px solid #e2e8f0;
    outline: none;
    font-size: 14px;
    background: #fdfdfd;
}

.chat-form-input:focus { border-color: var(--chat-primary); }

.chat-form-submit {
    background: var(--chat-accent);
    color: white;
    border: none;
    padding: 12px;
    border-radius: var(--chat-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--chat-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-form-submit:hover { background: var(--chat-accent-hover); }

.error-text {
    color: #ef4444;
    font-size: 11.5px;
    font-weight: 500;
    margin-top: 2px;
    display: none;
}

.input-error { border-color: #ef4444 !important; }

/* Mobile */
@media (max-width: 480px) {
    #chat-window {
        bottom: 0px; right: 0px;
        width: 100vw; height: 100vh;
        border-radius: 0;
    }
}
