/* ==========================================================================
   JavaMifi RAG Chatbot UI - Official Brand Theme (Vibrant Light)
   ========================================================================== */

/* ── 1. CSS VARIABLES & SYSTEM ROOT ──────────────────────────────────────── */
:root {
    /* Color Palette - Official JavaMifi Brand Identity */
    --bg-main: hsl(207, 30%, 95%); /* Cool light grey/blue travel background */
    --bg-surface: hsla(0, 0%, 100%, 0.88); /* Premium clean glassmorphic white card */
    --bg-surface-opaque: hsl(0, 0%, 100%);
    --bg-surface-hover: hsl(200, 30%, 96%);
    
    --primary: hsl(200, 85%, 52%); /* JavaMifi Sky Blue (#1DA7EC) */
    --primary-glow: hsla(200, 85%, 52%, 0.15);
    --primary-dark: hsl(200, 85%, 40%);
    
    --secondary: hsl(48, 100%, 50%); /* JavaMifi Brand Yellow (#FCD116 / #FFCC00) */
    --secondary-glow: hsla(48, 100%, 50%, 0.3);
    
    --accent-red: hsl(354, 90%, 55%);
    --accent-yellow: hsl(48, 100%, 42%);
    
    --text-main: hsl(215, 60%, 16%); /* Deep Navy Text (#0A1D37) */
    --text-muted: hsl(215, 18%, 45%);
    --text-dark: hsl(215, 60%, 16%);
    
    --border-light: rgba(29, 167, 236, 0.12); /* Subtle sky-blue tinted borders */
    --border-primary: hsla(200, 85%, 52%, 0.35);
    
    /* Layout & Glassmorphism Spec */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --shadow-premium: 0 16px 36px rgba(10, 29, 55, 0.06), 0 1px 3px rgba(255, 255, 255, 0.7) inset;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ── 2. GLOBAL RESET & BASE SETUP ────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top left, hsl(200, 60%, 92%), hsl(220, 30%, 96%));
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

h1, h2, h3, .logo-area {
    font-family: 'Outfit', sans-serif;
}

/* ── 3. DYNAMIC BACKGROUND GLOWS (ORBS) ──────────────────────────────────── */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.55;
    pointer-events: none;
}

.orb-primary {
    top: 5%;
    right: 15%;
    width: 380px;
    height: 380px;
    background-color: hsla(200, 85%, 52%, 0.2);
    animation: floatGlow 12s ease-in-out infinite alternate;
}

.orb-secondary {
    bottom: 10%;
    left: 10%;
    width: 450px;
    height: 450px;
    background-color: hsla(48, 100%, 50%, 0.15);
    animation: floatGlow 18s ease-in-out infinite alternate-reverse;
}

@keyframes floatGlow {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-40px) scale(1.15); }
}

/* ── 4. APP CONTAINER & LAYOUT ───────────────────────────────────────────── */
.app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0; /* Fullscreen, no padding border */
}

.chat-wrapper {
    width: 100%;
    max-width: 100%; /* Spacious fullscreen width */
    height: 100%;
    max-height: 100%; /* Spacious fullscreen height */
    background-color: var(--bg-surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: none; /* Borderless for clean fullscreen app look */
    border-radius: 0; /* Flat edges for seamless fullscreen */
    box-shadow: none; /* No shadow needed in fullscreen */
    display: flex;
    flex-direction: row; /* Horizontal flex layout for sidebar + chat area */
    overflow: hidden;
    position: relative;
}

/* ── 5. BRAND HEADER COMPONENT (Sky Blue Bar) ────────────────────────────── */
.app-header {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom: 2px solid var(--secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(29, 167, 236, 0.15);
}

.logo-area {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.logo-accent {
    color: hsl(0, 0%, 100%);
}

.logo-main {
    color: var(--secondary); /* Yellow accent for Mifi signal logo */
}

.logo-sub {
    font-size: 11px;
    background-color: var(--secondary);
    color: var(--text-dark);
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.engine-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--secondary);
}

.status-dot.pulsing {
    animation: statusPulse 1.8s infinite alternate;
}

@keyframes statusPulse {
    0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 2px var(--secondary); }
    100% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 10px var(--secondary); }
}

.status-text {
    font-size: 11px;
    font-weight: 600;
    color: hsl(0, 0%, 100%);
}

.icon-btn {
    background: none;
    border: none;
    color: hsl(0, 0%, 100%);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-smooth);
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.icon-btn:hover {
    color: var(--secondary);
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
}

/* ── 6. SETTINGS PANEL (API BASE URL CONFIG) ─────────────────────────────── */
.settings-panel {
    background-color: var(--bg-surface-opaque);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 24px;
    position: absolute;
    top: 71px;
    left: 0;
    right: 0;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
    box-shadow: 0 15px 30px rgba(10,29,55,0.1);
}

.settings-panel.hidden {
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
}

.settings-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.url-input-wrapper {
    display: flex;
    gap: 12px;
}

.url-input-wrapper input {
    flex: 1;
    background-color: hsl(200, 30%, 97%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition-smooth);
}

.url-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.save-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: hsl(0, 0%, 100%);
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.reset-link-btn {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    text-decoration: underline;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: var(--transition-smooth);
    display: inline-block;
}

.reset-link-btn:hover {
    color: var(--primary);
}

.status-indicator-panel {
    margin-top: 14px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.indicator-label {
    color: var(--text-muted);
}

.indicator-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
}

.status-unknown { background-color: hsl(200, 20%, 90%); color: var(--text-muted); }
.status-connected { background-color: hsla(175, 100%, 42%, 0.1); color: hsl(175, 100%, 30%); border: 1px solid hsla(175, 100%, 42%, 0.2); }
.status-failed { background-color: hsla(354, 90%, 55%, 0.1); color: var(--accent-red); border: 1px solid rgba(255, 0, 0, 0.1); }

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-btn:hover {
    color: var(--text-main);
}

/* ── 7. CHAT BODY CONTAINER ──────────────────────────────────────────────── */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Chat Body */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background-color: rgba(10, 29, 55, 0.06);
    border-radius: 10px;
}

.chat-body:hover::-webkit-scrollbar-thumb {
    background-color: rgba(10, 29, 55, 0.15);
}

/* ── 8. WELCOME HERO SECTION (JavaMifi Official Brand Theme) ─────────────── */
.welcome-hero {
    text-align: center;
    max-width: 650px;
    margin: 30px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.6s ease;
}

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

.hero-icon-wrapper {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-glow), var(--secondary-glow));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid var(--border-primary);
    color: var(--primary);
    box-shadow: 0 8px 24px rgba(29, 167, 236, 0.12);
}

.welcome-hero h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 12px;
}

.welcome-hero h1 span {
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 35px;
}

.suggested-prompts-container {
    width: 100%;
    text-align: left;
}

.suggested-prompts-container h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}

.suggestion-chip {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px rgba(10, 29, 55, 0.02);
}

.suggestion-chip:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(10, 29, 55, 0.06);
}

.chip-icon {
    font-size: 18px;
}

.chip-flag-img {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(10, 29, 55, 0.12);
    margin-top: 2px;
    flex-shrink: 0;
}

.chip-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
}

/* ── 9. MESSAGES LIST & BUBBLES ──────────────────────────────────────────── */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.msg-wrapper {
    display: flex;
    flex-direction: column;
    animation: bubbleSlide 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
    opacity: 0;
    max-width: 82%;
}

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

.msg-wrapper.user {
    align-self: flex-end;
    align-items: flex-end;
}

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

/* Sender Labels */
.msg-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Message Bubble Main Body */
.msg-bubble {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    line-height: 1.6;
    font-size: 14.5px;
    word-break: break-word;
    box-shadow: 0 4px 10px rgba(10, 29, 55, 0.03);
}

.msg-wrapper.user .msg-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: hsl(0, 0%, 100%);
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.msg-wrapper.ai .msg-bubble {
    background-color: var(--bg-surface-opaque);
    color: var(--text-main);
    border: 1px solid var(--border-light);
    border-top-left-radius: 4px;
    border-left: 4px solid var(--primary); /* Left accent sky blue */
}

/* Formatting styled contents */
.msg-bubble p {
    margin-bottom: 8px;
}
.msg-bubble p:last-child {
    margin-bottom: 0;
}

.msg-bubble strong {
    color: inherit;
    font-weight: 700;
}

/* Lists formatting */
.msg-bubble ul, .msg-bubble ol {
    margin-left: 18px;
    margin-top: 6px;
    margin-bottom: 10px;
    color: var(--text-main);
}

.msg-bubble li {
    margin-bottom: 6px;
}

/* Header styling inside chat bubbles */
.msg-bubble h1, .msg-bubble h2, .msg-bubble h3 {
    color: inherit;
    font-weight: 700;
    margin-top: 14px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.msg-bubble h1 { font-size: 17px; }
.msg-bubble h2 { font-size: 16px; }
.msg-bubble h3 { font-size: 15px; }

.msg-bubble *:first-child {
    margin-top: 0 !important;
}

/* Link formatting inside message bubble */
.msg-bubble a {
    color: var(--primary-dark);
    text-decoration: underline;
    font-weight: 600;
    transition: var(--transition-smooth);
}

.msg-bubble a:hover {
    color: var(--primary);
}

/* Table styling in chatbot (like pricing) */
.msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(10, 29, 55, 0.04);
    border: 1px solid var(--border-light);
}

.msg-bubble th {
    background-color: rgba(29, 167, 236, 0.06);
    color: var(--primary-dark);
    font-weight: 700;
    text-align: left;
    padding: 8px 12px;
}

.msg-bubble td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(29, 167, 236, 0.08);
    background-color: hsl(0, 0%, 100%);
    color: var(--text-main);
}

.msg-bubble tr:last-child td {
    border-bottom: none;
}

/* RAG Source Badges (Metadata) */
.msg-sources {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.source-badge {
    font-size: 11px;
    background-color: rgba(29, 167, 236, 0.04);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition-smooth);
    font-weight: 500;
}

.source-badge:hover {
    background-color: rgba(29, 167, 236, 0.08);
    color: var(--primary-dark);
    border-color: var(--primary);
}

/* Action Tag Badges */
.msg-action-tag {
    margin-top: 10px;
    display: flex;
    width: 100%;
}

.action-tag-alert {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(10, 29, 55, 0.03);
}

.action-tag-alert.urgent {
    background-color: hsla(354, 90%, 55%, 0.08);
    border: 1px solid rgba(255, 0, 0, 0.15);
    color: var(--accent-red);
}

.action-tag-alert.escalated {
    background-color: hsla(48, 100%, 50%, 0.08);
    border: 1px solid rgba(255, 200, 0, 0.15);
    color: var(--accent-yellow);
}

.alert-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.urgent .alert-dot {
    background-color: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
    animation: flashAlert 1.2s infinite;
}

.escalated .alert-dot {
    background-color: var(--accent-yellow);
    box-shadow: 0 0 6px var(--accent-yellow);
    animation: flashAlert 1.5s infinite;
}

@keyframes flashAlert {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* ── 10. TYPING INDICATOR ────────────────────────────────────────────────── */
.typing-indicator-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn 0.3s ease;
    margin-top: 8px;
}

.typing-indicator-wrapper.hidden {
    display: none;
}

.typing-bubble {
    background-color: var(--bg-surface-opaque);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    border-top-left-radius: 4px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(10, 29, 55, 0.02);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    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.5; }
    40% { transform: scale(1.1); opacity: 1; }
}

.typing-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── 11. FOOTER & INPUT COMPONENT ────────────────────────────────────────── */
.chat-footer {
    padding: 16px 24px;
    background-color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid var(--border-light);
    z-index: 10;
}

.input-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    background-color: hsl(0, 0%, 100%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 6px 6px 6px 14px;
    align-items: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(10, 29, 55, 0.04);
}

.input-wrapper:focus-within {
    border-color: var(--border-primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    font-size: 14.5px;
    resize: none;
    outline: none;
    padding: 10px 0;
    max-height: 120px;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: hsl(0, 0%, 100%);
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.send-btn:active {
    transform: scale(0.98);
}

.footer-note {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
    letter-spacing: 0.2px;
    font-weight: 500;
}

.promo-code {
    color: var(--primary-dark);
    font-weight: 700;
}

/* ── 12. CHAT CONTAINER & SIDEBAR COMPONENT (Premium Glassmorphism) ───────── */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.sidebar {
    width: 280px;
    height: 100%;
    background-color: rgba(10, 29, 55, 0.03);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    z-index: 50;
}

.sidebar-header {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo .logo-accent {
    color: var(--primary-dark);
}

.sidebar-logo .logo-main {
    color: var(--accent-yellow);
}

.new-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.new-chat-btn:active {
    transform: translateY(0);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom Scrollbar for Sessions List */
.sessions-list::-webkit-scrollbar {
    width: 4px;
}

.sessions-list::-webkit-scrollbar-track {
    background: transparent;
}

.sessions-list::-webkit-scrollbar-thumb {
    background-color: rgba(10, 29, 55, 0.05);
    border-radius: 10px;
}

.sessions-list:hover::-webkit-scrollbar-thumb {
    background-color: rgba(10, 29, 55, 0.12);
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    gap: 8px;
}

.session-item:hover {
    background-color: rgba(29, 167, 236, 0.05);
    color: var(--primary-dark);
}

.session-item.active {
    background-color: rgba(29, 167, 236, 0.08);
    border-color: rgba(29, 167, 236, 0.15);
    color: var(--primary-dark);
    font-weight: 600;
}

.session-text-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.session-title {
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-session-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    opacity: 0;
}

.session-item:hover .delete-session-btn {
    opacity: 0.7;
}

.delete-session-btn:hover {
    color: var(--accent-red) !important;
    background-color: rgba(255, 0, 0, 0.05);
    opacity: 1 !important;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-light);
    background-color: rgba(10, 29, 55, 0.01);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-glow);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-primary);
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-toggle-btn {
    display: none;
}

.sidebar-overlay {
    display: none;
}

/* ── 13. RESPONSIVE MEDIA QUERIES ────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        padding: 0;
    }
    
    .chat-wrapper {
        max-height: 100vh;
        border-radius: 0;
        border: none;
        flex-direction: column; /* Stacked vertically on mobile, hiding/drawer sidebar */
    }
    
    .welcome-hero h1 {
        font-size: 26px;
    }
    
    .chat-body {
        padding: 16px;
    }
    
    .chat-footer {
        padding: 12px 16px;
    }
    
    .msg-wrapper {
        max-width: 90%;
    }
    
    .sidebar-toggle-btn {
        display: flex; /* Show hamburger menu on mobile */
        margin-right: 8px;
    }
    
    .sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        height: 100%;
        background-color: var(--bg-surface-opaque);
        box-shadow: 10px 0 30px rgba(10, 29, 55, 0.15);
        transform: translateX(-100%); /* Offscreen by default */
        z-index: 1000;
    }
    
    .sidebar.open {
        transform: translateX(0); /* Slide in */
    }
    
    .sidebar-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(10, 29, 55, 0.3);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.visible {
        display: block;
    }
}
