/* =================================================================
   SULTIFY CORE AI - BRAND NEW SOVEREIGN COCKPIT WIDGET v3.0
   Design: Deep Tech Glassmorphic Cockpit 3.0 (Cyan Neon & Deep Navy)
   Zero 3rd-Party Dependencies • Ultra-Fast Sub-20ms Engine
   ================================================================= */

:root {
    --ai-bg-glass: rgba(10, 25, 47, 0.94);
    --ai-border: rgba(100, 255, 218, 0.22);
    --ai-border-hover: rgba(100, 255, 218, 0.45);
    --ai-cyan: #64ffda;
    --ai-cyan-glow: rgba(100, 255, 218, 0.35);
    --ai-blue: #00b4d8;
    --ai-navy-deep: #050d1a;
    --ai-text-main: #e6f1ff;
    --ai-text-muted: #8892b0;
    --ai-font-heading: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    --ai-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =================================================================
   1. FLOATING ACTION BUTTON (FAB)
   ================================================================= */
.chat-fab {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(10, 25, 47, 0.95), rgba(15, 35, 65, 0.95));
    border: 1.5px solid var(--ai-cyan);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.7),
        0 0 25px var(--ai-cyan-glow),
        inset 0 1px 2px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99990;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0;
}

.chat-fab:hover {
    transform: scale(1.08) translateY(-3px);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.8),
        0 0 35px rgba(100, 255, 218, 0.55),
        inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

.chat-fab:active {
    transform: scale(0.96);
}

.chat-fab-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1.5px solid var(--ai-cyan);
    opacity: 0.6;
    animation: fabRadarPulse 2.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
    pointer-events: none;
}

@keyframes fabRadarPulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.4); opacity: 0; }
}

.chat-fab-icon {
    font-size: 1.45rem;
    color: var(--ai-cyan);
    text-shadow: 0 0 12px var(--ai-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.chat-fab:hover .chat-fab-icon {
    transform: rotate(12deg) scale(1.05);
}

.chat-fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    font-family: var(--ai-font-heading);
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
    letter-spacing: 0.05em;
}

.chat-fab-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    background: rgba(10, 25, 47, 0.95);
    color: var(--ai-text-main);
    border: 1px solid var(--ai-border);
    padding: 6px 14px;
    border-radius: 10px;
    font-family: var(--ai-font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
}

.chat-fab:hover .chat-fab-tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* =================================================================
   2. CHAT WINDOW (COCKPIT 3.0 CONTAINER)
   ================================================================= */
.chat-window {
    position: fixed;
    bottom: 98px;
    right: 28px;
    width: 410px;
    height: 630px;
    max-height: calc(100vh - 120px);
    background: var(--ai-bg-glass);
    border: 1px solid var(--ai-border);
    border-radius: 24px;
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    box-shadow: 
        0 25px 70px -10px rgba(0, 0, 0, 0.92),
        0 0 45px rgba(100, 255, 218, 0.12),
        inset 0 1px 1px rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99995;
    opacity: 0;
    transform: translateY(24px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Subtle cockpit grid texture */
.chat-window::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(100, 255, 218, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100, 255, 218, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 1;
}

/* =================================================================
   3. CHAT HEADER (MAC-STYLE COCKPIT)
   ================================================================= */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(5, 13, 27, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.chat-window-mac-dots {
    display: flex;
    align-items: center;
    gap: 7px;
}

.chat-dot {
    width: 10.5px;
    height: 10.5px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.chat-dot:hover {
    transform: scale(1.15);
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.chat-title-cluster {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar-frame {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.15), rgba(0, 180, 216, 0.2));
    border: 1px solid rgba(100, 255, 218, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: var(--ai-cyan);
    font-size: 0.95rem;
}

.chat-avatar-radar {
    position: absolute;
    inset: -3px;
    border-radius: 12px;
    border: 1px solid var(--ai-cyan);
    opacity: 0.5;
    animation: radarMini 2.5s infinite;
}

@keyframes radarMini {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(0.9); opacity: 0; }
}

.chat-title-text {
    display: flex;
    flex-direction: column;
}

.chat-brand-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--ai-font-heading);
    font-size: 0.88rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.chat-ver-tag {
    font-size: 0.62rem;
    font-family: var(--ai-font-heading);
    background: rgba(100, 255, 218, 0.15);
    color: var(--ai-cyan);
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.chat-status-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--ai-font-heading);
    font-size: 0.68rem;
    color: var(--ai-text-muted);
}

.status-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-btn-action {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--ai-text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.chat-btn-action:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.chat-close-btn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.4);
}

/* =================================================================
   4. TELEMETRY STRIP
   ================================================================= */
.chat-telemetry-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: rgba(5, 13, 27, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-family: var(--ai-font-heading);
    font-size: 0.68rem;
    color: var(--ai-text-muted);
    position: relative;
    z-index: 10;
}

.chat-telemetry-strip i {
    color: var(--ai-cyan);
    margin-right: 4px;
}

.telemetry-speed {
    color: var(--ai-cyan);
    font-weight: 700;
}

/* =================================================================
   5. MESSAGES CONTAINER & WELCOME CARD
   ================================================================= */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 5;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 255, 218, 0.3) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(100, 255, 218, 0.3);
    border-radius: 999px;
}

/* Welcome Card */
.chat-welcome-card {
    background: rgba(5, 13, 27, 0.7);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    margin-bottom: 6px;
}

.welcome-icon-wrap {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    border-radius: 12px;
    background: rgba(100, 255, 218, 0.12);
    border: 1px solid var(--ai-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-cyan);
    font-size: 1.25rem;
    box-shadow: 0 0 18px rgba(100, 255, 218, 0.25);
}

.chat-welcome-card h3 {
    margin: 0 0 6px;
    font-family: var(--ai-font-heading);
    font-size: 1.02rem;
    font-weight: 800;
    color: #ffffff;
}

.chat-welcome-card p {
    margin: 0 0 14px;
    font-family: var(--ai-font-body);
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--ai-text-muted);
}

.welcome-quick-grid {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.quick-chip-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--ai-text-main);
    font-family: var(--ai-font-heading);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.quick-chip-btn i {
    color: var(--ai-cyan);
    font-size: 0.85rem;
    width: 16px;
    text-align: center;
}

.quick-chip-btn:hover {
    background: rgba(100, 255, 218, 0.12);
    border-color: var(--ai-cyan);
    transform: translateX(3px);
    color: #ffffff;
}

/* =================================================================
   6. MESSAGE BUBBLES
   ================================================================= */
.message {
    font-family: var(--ai-font-body);
    max-width: 88%;
    padding: 12px 15px;
    border-radius: 16px;
    font-size: 0.84rem;
    line-height: 1.55;
    word-wrap: break-word;
    position: relative;
    animation: msgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.message.bot {
    align-self: flex-start;
    background: rgba(10, 25, 47, 0.92);
    border: 1px solid rgba(100, 255, 218, 0.25);
    border-left: 3px solid var(--ai-cyan);
    border-bottom-left-radius: 4px;
    color: var(--ai-text-main);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.35) 0%, rgba(100, 255, 218, 0.25) 100%);
    border: 1px solid rgba(100, 255, 218, 0.4);
    border-bottom-right-radius: 4px;
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.message strong {
    color: #ffffff;
    font-weight: 700;
}

.message code {
    background: rgba(100, 255, 218, 0.12);
    color: var(--ai-cyan);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--ai-font-heading);
    font-size: 0.78rem;
}

.message a {
    color: var(--ai-cyan);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.message a:hover {
    opacity: 0.8;
}

/* In-Message Interactive Action Chips */
.bot-action-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.bot-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.25);
    border-radius: 999px;
    color: var(--ai-cyan);
    font-family: var(--ai-font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.bot-chip:hover {
    background: rgba(100, 255, 218, 0.22);
    border-color: var(--ai-cyan);
    box-shadow: 0 0 10px rgba(100, 255, 218, 0.3);
    transform: translateY(-1px);
    color: #ffffff;
}

/* Typing Indicator */
.chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 14px;
    background: rgba(10, 25, 47, 0.92);
    border: 1px solid rgba(100, 255, 218, 0.25);
    border-left: 3px solid var(--ai-cyan);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ai-cyan);
    box-shadow: 0 0 6px var(--ai-cyan);
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* =================================================================
   7. CONTEXTUAL QUICK ACTION STRIP (ABOVE INPUT)
   ================================================================= */
.chat-chips-bar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(5, 13, 27, 0.7);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    z-index: 10;
}

.chat-chips-bar::-webkit-scrollbar {
    display: none;
}

.chat-chips-bar.active {
    display: flex;
}

/* =================================================================
   8. INPUT AREA
   ================================================================= */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(5, 13, 27, 0.9);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 10;
}

.chat-input {
    flex: 1;
    background: rgba(10, 25, 47, 0.85);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 11px 14px;
    color: #ffffff;
    font-family: var(--ai-font-body);
    font-size: 0.84rem;
    outline: none;
    transition: all 0.25s ease;
}

.chat-input::placeholder {
    color: var(--ai-text-muted);
    font-size: 0.8rem;
}

.chat-input:focus {
    border-color: var(--ai-cyan);
    box-shadow: 0 0 14px rgba(100, 255, 218, 0.22);
    background: rgba(10, 25, 47, 0.98);
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--ai-cyan) 0%, #00b4d8 100%);
    border: none;
    color: #050d1a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 800;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.06);
    box-shadow: 0 0 16px rgba(100, 255, 218, 0.5);
}

.chat-send:active {
    transform: scale(0.95);
}

/* =================================================================
   9. MOBILE RESPONSIVENESS
   ================================================================= */
@media screen and (max-width: 480px) {
    .chat-fab {
        bottom: 20px;
        right: 20px;
        width: 54px;
        height: 54px;
    }
    
    .chat-fab-tooltip {
        display: none;
    }

    .chat-window {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
    }

    .chat-header {
        padding: 16px 14px 12px;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        max-width: 92%;
        font-size: 0.82rem;
    }
}
