:root {
    /* Original Palette */
    --primary-color: #00e5ff;   /* Cyan */
    --secondary-color: #b478f8; /* Lavender/Purple */
    --text-main: #ffffff;
    
    /* Ultra-Translucent Glassmorphism */
    --glass-bg-bot: rgba(0, 229, 255, 0.03);
    --glass-bg-user: rgba(214, 179, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.15);
    
    --bg-color: #000;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* -------------------------------------------
   VIDEO BACKGROUND
   ------------------------------------------- */
#bg-video {
    position: fixed;
    top: 50%; left: 50%;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    z-index: -3;
    transform: translate(-50%, -50%);
    object-fit: cover;
}

.video-overlay {
    opacity: 0.1;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    background: rgba(0, 0, 0, 0.4);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

/* -------------------------------------------
   LAYOUT GRID (Desktop & Mobile handling)
   ------------------------------------------- */
.layout-grid {
    width: 100%;
    height: 100%;
    display: flex; /* Default to mobile flex */
    justify-content: center;
    align-items: center;
}

.sidebar {
    display: none; /* Hidden on mobile */
}

/* -------------------------------------------
   CHAT WIDGET
   ------------------------------------------- */
.chat-widget {
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: 100%; 
    height: 100%; 
    background: transparent;
    position: relative;
    /* transition: width 0.3s ease; Removed transition for fixed width requirement */
}

.chat-widget::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 101;
    display: none; 
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: none; 
    scroll-behavior: smooth;
}
.chat-body::-webkit-scrollbar { display: none; }

/* -------------------------------------------
   MESSAGES
   ------------------------------------------- */
.message {
    max-width: 88%;
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    animation: slideIn 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: none;
    box-shadow: var(--glass-shadow);
}

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

.bot-msg {
    align-self: flex-start;
    background: var(--glass-bg-bot);
    color: var(--text-main);
    border-radius: 20px 20px 20px 4px;
    border-left: 3px solid var(--primary-color);
}

.user-msg {
    align-self: flex-end;
    background: var(--glass-bg-user);
    color: white;
    text-align: right;
    border-radius: 20px 20px 4px 20px;
    border-right: 3px solid var(--secondary-color);
}

/* -------------------------------------------
   MOBILE CONTROLS AREA
   ------------------------------------------- */
.controls-area {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    padding-bottom: max(15px, env(safe-area-inset-bottom));
}

.options-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

/* -------------------------------------------
   BUTTON STYLES
   ------------------------------------------- */
/* Default Mobile Buttons */
.option-btn {
    flex: 1 1 45%; 
    min-width: 140px; 
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    padding: 14px 8px;
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    text-align: center;
    border-radius: 8px; 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.option-btn:active {
    background: rgba(0, 229, 255, 0.2);
    color: var(--text-main);
    border-color: var(--primary-color);
    transform: scale(0.98);
}

/* Desktop Neon Buttons */
.sidebar-btn {
    /* Dimensions for a perfect circle */
    width: 110px;        /* Fixed width */
    height: 110px;       /* Fixed height (must match width) */
    border-radius: 50%;  /* Makes it circular */
    
    /* Layout & Centering */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* Safe for multi-line text */
    
    /* Visuals */
    padding: 5px;       /* Reduced padding to maximize text space */
    margin-bottom: 25px; /* Slightly more space between bubbles */
    background: rgba(0, 0, 0, 0.6); /* Slightly darker for better legibility */
    border: 2px solid var(--primary-color);
    
    /* Text Styling */
    color: var(--primary-color);
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;    /* Slightly smaller to fit inside the circle */
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2;   /* Tighter line height for wrapping text */
    white-space: normal;
    
    /* Interactive & Effects */
    cursor: pointer;
    box-shadow: 0 0 8px var(--primary-color), inset 0 0 5px rgba(0, 229, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Optional: Hover effect to expand slightly */
.sidebar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--primary-color), inset 0 0 10px rgba(0, 229, 255, 0.4);
    background: rgba(0, 0, 0, 0.8);
    text-shadow: 0 0 5px var(--primary-color);
    z-index: 10;
}

.sidebar-btn:active {
    transform: translateY(1px);
    box-shadow: 0 0 5px var(--primary-color);
}

.nav-btn {
    color: var(--secondary-color);
    border-color: rgba(214, 179, 255, 0.15);
    font-weight: 600;
}

/* -------------------------------------------
   CAROUSEL & GALLERY
   ------------------------------------------- */
.topic-carousel-wrapper, .gallery-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-carousel, .gallery-container {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 5px 35px;
    scroll-behavior: smooth;
    scrollbar-width: none;
    width: 100%;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.topic-carousel::-webkit-scrollbar, .gallery-container::-webkit-scrollbar { display: none; }

.topic-card {
    flex: 0 0 auto;
    min-width: 140px; 
    background: var(--glass-bg-bot);
    border: 1px solid var(--glass-border);
    padding: 16px 10px;
    color: var(--primary-color);
    text-align: center;
    cursor: pointer;
    scroll-snap-align: center;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease;
}

.topic-nav-arrow, .gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    border-radius: 50%; 
    width: 32px; height: 32px;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer;
    z-index: 10;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}
.topic-nav-arrow.prev, .gallery-nav-btn.prev { left: 0; }
.topic-nav-arrow.next, .gallery-nav-btn.next { right: 0; }

.gallery-item {
    flex: 0 0 auto;
    width: 200px; height: 130px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    scroll-snap-align: center;
}
.gallery-item img {
    width: 100%; height: 100%; object-fit: cover;
}

/* -------------------------------------------
   TYPING INDICATOR
   ------------------------------------------- */
.typing {
    align-self: flex-start;
    padding: 12px 18px;
    display: none;
    margin-bottom: 10px;
    background: var(--glass-bg-bot);
    border: none;
    border-left: 3px solid var(--primary-color);
    border-radius: 20px 20px 20px 4px;
    backdrop-filter: blur(14px);
    box-shadow: var(--glass-shadow);
}
.dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--primary-color); margin: 0 2px; animation: bounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* -------------------------------------------
   LIGHTBOX
   ------------------------------------------- */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}
.lightbox.active { opacity: 1; pointer-events: all; }

.lightbox img {
    max-width: 95vw; max-height: 70vh;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 229, 255, 0.1);
    transition: opacity 0.2s ease;
}

.lightbox-close {
    position: absolute; top: 20px; right: 20px;
    color: white; font-family: 'Roboto', sans-serif; font-size: 28px;
    padding: 10px; 
    background: none; border: none; cursor: pointer;
    z-index: 2001;
}

/* -------------------------------------------
   DESKTOP GRID OVERRIDE (Width > 768px)
   ------------------------------------------- */
@media (min-width: 1024px) {
    .layout-grid {
        display: grid;
        grid-template-columns: 1fr 420px 1fr; /* 3 Columns */
        align-items: center;
        padding: 0 20px;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
        justify-content: center;
        /* Remove 'align-items: center' so we can control left/right specifically */
        align-items: unset; 
        padding: 0; /* Remove padding to let buttons float closer to edges */
    }

    /* 2. Left Sidebar: Anchor to the right (near chat), then scatter left */
    #left-sidebar {
        align-items: center; /* Default position: close to chat */
        padding-right: 20px;   /* Small buffer from chat widget */
    }

    /* Push every ODD button far to the left */
    #left-sidebar .sidebar-btn:nth-child(odd) {
        margin-right: 80px; 
    }
    
    /* Keep every EVEN button closer to the chat */
    #left-sidebar .sidebar-btn:nth-child(even) {
        margin-right: 10px;
    }

    /* 3. Right Sidebar: Anchor to the left (near chat), then scatter right */
    #right-sidebar {
        align-items: center; /* Default position: close to chat */
        padding-left: 20px;      /* Small buffer from chat widget */
    }

    /* Push every ODD button far to the right */
    #right-sidebar .sidebar-btn:nth-child(odd) {
        margin-left: 80px;
    }

    /* Keep every EVEN button closer to the chat */
    #right-sidebar .sidebar-btn:nth-child(even) {
        margin-left: 10px;
    }

    /* 4. Add Vertical Randomness (Varying gaps) */
    .sidebar-btn:nth-child(3n) {
        margin-bottom: 40px; /* Occasional large gap */
    }
    .sidebar-btn:nth-child(3n+1) {
        margin-bottom: 15px; /* Occasional small gap */
    }

    .chat-widget {
        width: 420px;
        max-height: 70vh;
        border-top-left-radius: 20px;
        border-bottom-left-radius: 20px;
        /* Add shadow back for widget depth */
        margin: auto;
        border-radius: 20px; /* Full rounded corners */
        
    }
    
    .chat-widget::before { display: block; }
    
    /* Hide internal controls on desktop */
    .controls-area {
        display: none;
    }
    
    .topic-carousel {
        /* Reset carousel styles if ever shown in desktop (not used now but safe to keep) */
        flex-wrap: wrap; 
        justify-content: center; 
        overflow-x: visible; 
        padding: 10px 0;
        gap: 12px;
    }
}

/* -------------------------------------------
   MINDMAP SVG LAYER
   ------------------------------------------- */
#mindmap-svg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1; /* Behind Chat Widget (z-100) but above Video */
    pointer-events: none; /* Let clicks pass through */
}

.mindmap-line {
    stroke: var(--primary-color);
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    opacity: 0;
    animation: drawLine 0.6s ease forwards;
    filter: drop-shadow(0 0 4px var(--primary-color));
}

@keyframes drawLine {
    to { opacity: 0.6; }
}

/* -------------------------------------------
   MINDMAP INTERACTIONS
   ------------------------------------------- */
.sidebar-btn {
    z-index: 10; /* Ensure buttons are clickable above lines */
    position: relative;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* State: When Mindmap is Active, inactive topics fade/move */
.sidebar.mindmap-active .sidebar-btn {
    opacity: 0.1;
    transform: scale(0.8);
    pointer-events: none;
}

/* The Active Topic stays visible */
.sidebar.mindmap-active .sidebar-btn.active-topic {
    opacity: 1;
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--primary-color), inset 0 0 10px rgba(0, 229, 255, 0.6);
    pointer-events: all;
    background: rgba(0,0,0,0.9);
    z-index: 20;
}

/* Satellite Buttons (The Questions) */
.satellite-btn {
    position: fixed; /* Absolute positioning relative to screen */
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    display: flex; justify-content: center; align-items: center;
    text-align: center;
    font-size: 10px;
    padding: 5px;
    z-index: 15;
    cursor: pointer;
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 0 5px var(--secondary-color);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: all 0.2s;
}

.satellite-btn:hover {
    background: var(--secondary-color);
    color: #000;
    box-shadow: 0 0 20px var(--secondary-color);
    transform: scale(1.1) !important;
    z-index: 30;
}

@keyframes popIn {
    to { opacity: 1; transform: scale(1); }
}

/* Back Button */
#mindmap-back-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 30px;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    cursor: pointer;
    z-index: 200;
    transition: all 0.3s;
    opacity: 0;
}

#mindmap-back-btn.visible {
    opacity: 1;
}

#mindmap-back-btn:hover {
    background: var(--primary-color);
    color: #000;
}

/* -------------------------------------------
   CUSTOM INPUT AREA
   ------------------------------------------- */
.chat-input-area {
    width: 100%;
    padding: 15px 20px 20px 20px; /* Padding for spacing */
    background: transparent;      /* No background */
    border: none;                 /* No border */
    backdrop-filter: none;        /* No backdrop */
    margin-top: auto;             /* Push to bottom of flex container */
    box-sizing: border-box;

}

.input-wrapper {
    position: relative;
    width: 100%;
    align-items: center;
       display: none;

    animation: slideIn 0.4s cubic-bezier(0.25, 1, 0.5, 1) forwards;

}

.input-wrapper textarea {
    width: 100%;
    height: 50px; /* Fixed height for single row look */
    
    /* Glassmorphism on the Input itself */
    background:  transparent;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.1);
    
    border-radius: 25px; /* Fully rounded pill shape */
    padding: 14px 50px 12px 20px; /* Right padding creates space for the button */
    
    color: var(--text-main);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    line-height: 22px;
     
}

.input-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
}

.input-wrapper textarea:focus {
        background:  transparent;

    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.15);
}

.input-wrapper button {
    position: absolute;
    right: 8px; /* Positioned inside the right padding of textarea */
    top: 50%;
    transform: translateY(-50%);
    
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    opacity: 0.8;
}

.input-wrapper button:hover {
    color: #fff;
    background: rgba(0, 229, 255, 0.2);
    box-shadow: 0 0 10px var(--primary-color);
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.input-wrapper button:active {
    transform: translateY(-50%) scale(0.9);
}

.widget-controls{
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 15px;
}