/**
 * AIT Website AI Support & Lead Agent - Luxury Glassmorphic & Dark Stylesheet
 * Features:
 * - Transparent Glassmorphism & Solid Dark Theme options
 * - Fullscreen Popup Modal (Maximize / Minimize) with Backdrop Overlay
 * - Responsive Drawer & Rich Typography
 */

:root {
    --ai-gold: #c9944c;
    --ai-gold-hover: #b3823d;
    --ai-gold-light: rgba(201, 148, 76, 0.12);
    --ai-dark: #121820;
    --ai-dark-card: #1a222c;
    --ai-text-primary: #ffffff;
    --ai-text-secondary: #a0aec0;
    --ai-border: rgba(201, 148, 76, 0.3);
    --ai-radius: 20px;
    --ai-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* Backdrop Overlay for Maximized Modal */
.ai-chat-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 12, 16, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ai-chat-backdrop.open {
    display: block;
    opacity: 1;
}

/* Floating Launcher Button */
.ai-agent-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(24, 32, 42, 0.9) 0%, rgba(16, 20, 26, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--ai-gold);
    color: #ffffff;
    padding: 10px 18px 10px 12px;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(201, 148, 76, 0.35);
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
    font-family: inherit;
}

.ai-agent-launcher:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(201, 148, 76, 0.45);
    background: linear-gradient(135deg, rgba(32, 43, 56, 0.95) 0%, rgba(21, 27, 34, 0.98) 100%);
}

.ai-launcher-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-gold) 0%, #a67431 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    position: relative;
}

.ai-launcher-avatar .ai-pulse-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid #10141a;
}

.ai-launcher-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.ai-launcher-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.ai-launcher-sub {
    font-size: 11px;
    color: var(--ai-gold);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* Main Chat Container Window */
.ai-chat-window {
    position: fixed;
    bottom: 86px;
    left: 24px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 620px;
    max-height: calc(100vh - 110px);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    display: none;
    flex-direction: column;
    z-index: 100000;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

/* Glassmorphism Semi-Transparent Theme (Default) */
.ai-chat-window.theme-glass {
    background: rgba(18, 24, 32, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(201, 148, 76, 0.4);
}

/* Solid Dark Obsidian Theme */
.ai-chat-window.theme-dark {
    background: #121820;
    border: 1px solid var(--ai-gold);
}

.ai-chat-window.open {
    display: flex;
    animation: aiSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* MAXIMIZED POPUP MODAL STATE */
.ai-chat-window.maximized {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    width: 920px !important;
    max-width: calc(100vw - 40px) !important;
    height: 85vh !important;
    max-height: 820px !important;
    border-radius: 24px !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7) !important;
    animation: aiModalZoom 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

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

@keyframes aiModalZoom {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, rgba(26, 35, 45, 0.95) 0%, rgba(18, 24, 32, 0.95) 100%);
    border-bottom: 1px solid var(--ai-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.ai-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--ai-gold-light);
    border: 1px solid var(--ai-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-gold);
    font-size: 16px;
}

.ai-header-titles h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.ai-header-titles span {
    font-size: 11px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-header-titles span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

/* Header Action Controls */
.ai-header-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-control-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.ai-control-btn:hover {
    color: #ffffff;
    background: var(--ai-gold-light);
    border-color: var(--ai-gold);
    transform: scale(1.05);
}

.ai-control-btn.active {
    color: var(--ai-gold);
    background: rgba(201, 148, 76, 0.2);
    border-color: var(--ai-gold);
}

/* Messages Body */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(15, 20, 26, 0.7);
}

.ai-chat-window.maximized .ai-chat-body {
    padding: 28px 36px;
}

.ai-chat-body::-webkit-scrollbar {
    width: 6px;
}
.ai-chat-body::-webkit-scrollbar-thumb {
    background: rgba(201, 148, 76, 0.35);
    border-radius: 10px;
}

/* Message Rows */
.ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
    font-size: 13.5px;
    line-height: 1.6;
}

.ai-chat-window.maximized .ai-msg {
    max-width: 82%;
    font-size: 14.5px;
}

.ai-msg.incoming {
    align-self: flex-start;
}

.ai-msg.outgoing {
    align-self: flex-end;
}

.ai-msg-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    word-break: break-word;
}

.ai-msg.incoming .ai-msg-bubble {
    background: rgba(30, 39, 50, 0.85);
    backdrop-filter: blur(8px);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
}

.ai-msg.outgoing .ai-msg-bubble {
    background: linear-gradient(135deg, var(--ai-gold) 0%, #b3823d 100%);
    color: #10141a;
    font-weight: 600;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(201, 148, 76, 0.3);
}

.ai-msg-time {
    font-size: 10px;
    color: #718096;
    margin-top: 4px;
    padding: 0 4px;
}

/* Formatted Content inside Bubbles */
.ai-chat-link {
    color: var(--ai-gold);
    font-weight: 700;
    text-decoration: underline;
}

.ai-chat-link:hover {
    color: #ffffff;
}

/* Quick Action Chips */
.ai-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ai-chip {
    background: rgba(201, 148, 76, 0.15);
    border: 1px solid var(--ai-gold);
    color: #f1ebd8;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.25s;
}

.ai-chip:hover {
    background: var(--ai-gold);
    color: #10141a;
    font-weight: 700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 148, 76, 0.4);
}

/* Lead Form Card */
.ai-lead-form {
    background: rgba(28, 38, 51, 0.9);
    border: 1px solid var(--ai-gold);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.ai-lead-form h6 {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.ai-form-input {
    width: 100%;
    background: rgba(16, 20, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 13px;
    color: #ffffff;
    outline: none;
    transition: border 0.2s;
    box-sizing: border-box;
}

.ai-form-input:focus {
    border-color: var(--ai-gold);
}

.ai-form-submit {
    background: linear-gradient(135deg, var(--ai-gold) 0%, #a67431 100%);
    border: none;
    color: #10141a;
    font-weight: 700;
    font-size: 13px;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
}

.ai-form-submit:hover {
    background: #dfaa5b;
    box-shadow: 0 4px 14px rgba(201, 148, 76, 0.4);
}

/* Footer Input Area */
.ai-chat-footer {
    padding: 14px 18px;
    background: rgba(20, 27, 35, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-input-field {
    flex: 1;
    background: rgba(15, 20, 26, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 11px 18px;
    color: #ffffff;
    font-size: 13.5px;
    outline: none;
    transition: border 0.2s;
}

.ai-input-field:focus {
    border-color: var(--ai-gold);
}

.ai-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ai-gold);
    color: #10141a;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all 0.2s;
}

.ai-send-btn:hover {
    background: #e0ac5f;
    transform: scale(1.06);
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(30, 39, 50, 0.85);
    border-radius: 14px;
    width: fit-content;
}

.ai-typing-dot {
    width: 7px;
    height: 7px;
    background: var(--ai-gold);
    border-radius: 50%;
    animation: aiTypingBounce 1.2s infinite ease-in-out;
}

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

@keyframes aiTypingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .ai-agent-launcher {
        left: 16px;
        bottom: 16px;
        padding: 8px 14px 8px 10px;
    }
    .ai-chat-window {
        left: 12px;
        right: 12px;
        bottom: 75px;
        width: auto;
        max-width: calc(100vw - 24px);
        height: calc(100vh - 100px);
    }
    .ai-chat-window.maximized {
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 40px) !important;
        max-height: none !important;
        border-radius: 18px !important;
    }
}
