:root {
    --bg-light: #08080a; /* Deep Gemini-like black base */
    --bg-sidebar: #0f0f12; /* Sleek dark sidebar background */
    --bg-card: #141417; /* Dark grayish shade for container cards */
    --border-color: rgba(255, 255, 255, 0.06);
    --text-main: #e3e3e3; /* Soft light text matching Gemini/Antigravity */
    --text-muted: #94a3b8; /* Muted gray text */
    --accent: #a78bfa; /* Soft purple accent */
    --accent-hover: #c084fc;
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #a78bfa 100%);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.7);
    --shadow-input: 0 8px 32px rgba(0, 0, 0, 0.8);
    --font-stack: 'Google Sans', 'Google Sans Text', 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.light-mode {
    font-family: var(--font-stack);
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100%;
    width: 100%;
}

/* ----------------------------------------------------
   AUTHENTICATION LANDING PAGE STYLING
   ---------------------------------------------------- */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 50%, rgba(139, 92, 246, 0.08) 0%, rgba(8, 8, 10, 1) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-card {
    background: rgba(20, 20, 23, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.auth-logo-text {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2rem;
}

#googleSignInWrapper {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1.5rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 1rem;
}

.demo-signin-btn {
    width: 100%;
    padding: 0.85rem;
    border: 1px solid rgba(167, 139, 250, 0.25);
    background: rgba(167, 139, 250, 0.06);
    color: var(--accent);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.demo-signin-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    border-color: rgba(167, 139, 250, 0.4);
    transform: translateY(-1px);
}

.auth-warning {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.25);
    line-height: 1.4;
}
.auth-warning.hidden { display: none; }

/* ----------------------------------------------------
   SIDEBAR & USER PROFILE
   ---------------------------------------------------- */
.sidebar {
    width: 290px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.user-email {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.sign-out-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s;
}
.sign-out-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.new-chat-btn:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(167, 139, 250, 0.4);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.08);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.history-item {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    background: transparent;
    text-align: left;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
}

.history-item .goal-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.history-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
    border-color: var(--border-color);
    color: var(--text-main);
}

.history-item.active {
    background-color: var(--bg-card);
    border-color: rgba(167, 139, 250, 0.25);
    color: var(--accent);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.history-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--accent-gradient);
    border-radius: 0 4px 4px 0;
}

.history-item .date {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ----------------------------------------------------
   TOP NAVIGATION CONFIG BAR
   ---------------------------------------------------- */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-light);
    overflow: hidden;
}

.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.75rem;
    background: rgba(8, 8, 10, 0.65); /* translucent top bar */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.usage-status-btn {
    position: relative;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 20, 23, 0.8);
    color: #9ae6b4;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.usage-status-btn:hover {
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.35);
    background: rgba(34, 197, 94, 0.06);
}

.usage-status-btn::after {
    content: "";
    position: absolute;
    right: 7px;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.usage-status-btn[data-severity="yellow"]::after {
    background: #eab308;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.12);
}

.usage-status-btn[data-severity="red"]::after {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.usage-status-panel {
    position: absolute;
    top: 65px;
    right: 1.75rem;
    width: min(320px, calc(100vw - 2rem));
    background: rgba(15, 15, 18, 0.92);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 120;
    animation: slideIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.usage-status-panel.hidden {
    display: none;
}

.usage-status-header {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.usage-status-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.usage-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.usage-status-dot.yellow {
    background: #eab308;
    box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.1);
}

.usage-status-dot.red {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.usage-status-row {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    padding: 0.55rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.84rem;
}

.usage-status-row span {
    color: var(--text-muted);
}

.usage-status-row strong {
    color: var(--text-main);
    font-weight: 650;
    text-align: right;
    white-space: nowrap;
}

.usage-advisory {
    margin-top: 0.8rem;
    color: #facc15;
    font-size: 0.82rem;
    line-height: 1.45;
}

.logo h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.hamburger-btn {
    display: flex;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 6px;
    transition: background 0.2s;
}
.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.custom-prompt-btn {
    background: rgba(56, 189, 248, 0.06);
    border: 1px solid rgba(56, 189, 248, 0.25);
    color: #38bdf8; /* Lighter electric blue matching send button start */
    padding: 0.5rem 1.1rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.825rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.custom-prompt-btn:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.45);
    color: #a78bfa; /* Soft purple matching send button end */
    transform: translateY(-1px);
}

.system-prompt-panel {
    grid-column: 1 / -1;
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
    margin-top: 0.5rem;
}
.system-prompt-panel.hidden { display: none !important; }
.system-prompt-panel textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-main);
    background: var(--bg-light);
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}
.system-prompt-panel textarea:focus {
    border-color: var(--accent);
}

/* ----------------------------------------------------
   CHAT CONTENT AREA & TIMELINE
   ---------------------------------------------------- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 6rem 15% 150px 15%;
    display: flex;
    flex-direction: column;
}

.welcome-screen {
    text-align: center;
    margin: auto;
    max-width: 600px;
    padding-bottom: 2rem;
}

.welcome-screen h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-main) 30%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.welcome-screen p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

.progress-timeline {
    margin-bottom: 2.5rem;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.timeline-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-badge {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}
.status-badge.active {
    background: rgba(250, 204, 21, 0.1);
    color: #eab308;
    animation: pulse 2s infinite;
}
.status-badge.success {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}
.status-badge.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.log-console {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.agent-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.1);
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.agent-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bg-planner { background: #2563eb; }
.bg-researcher { background: #7c3aed; }
.bg-reporter { background: #059669; }
.bg-critic { background: #d97706; }
.bg-editor { background: #db2777; }
.bg-error { background: #dc2626; }
.bg-end { background: #15803d; }

.agent-card-body {
    font-size: 0.875rem;
    color: #cbd5e1;
    padding-left: 38px;
    line-height: 1.5;
}

.agent-card-subqueries {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.subquery-tag {
    background: rgba(56, 189, 248, 0.08); /* light silky blue tint */
    color: #bae6fd; /* light silky blue color (lighter than the send button #38bdf8) */
    font-size: 0.725rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(56, 189, 248, 0.2);
    font-weight: 500;
    transition: all 0.2s ease;
}
.subquery-tag:hover {
    background: rgba(56, 189, 248, 0.15);
    color: #e0f2fe; /* even lighter blue on hover */
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-0.5px);
}

/* ----------------------------------------------------
   REPORT OUTPUT & ACTIONS TOOLBAR
   ---------------------------------------------------- */
.report-section {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}
.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.report-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.markdown-body {
    line-height: 1.8;
    color: #cbd5e1;
    font-size: 1rem;
}
.markdown-body h1 { font-size: 2rem; font-weight: 700; margin-bottom: 1.25rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.markdown-body h2 { font-size: 1.5rem; font-weight: 600; margin-top: 2.25rem; margin-bottom: 1rem; color: var(--text-main); }
.markdown-body h3 { font-size: 1.2rem; font-weight: 600; margin-top: 1.75rem; margin-bottom: 0.75rem; color: var(--text-main); }
.markdown-body p { margin-bottom: 1.25rem; }
.markdown-body ul, .markdown-body ol { margin-left: 1.75rem; margin-bottom: 1.25rem; }
.markdown-body li { margin-bottom: 0.5rem; }
.markdown-body code { background: rgba(255, 255, 255, 0.06); padding: 0.2rem 0.4rem; border-radius: 6px; font-size: 0.85em; font-family: monospace; color: #f1f5f9; }
.markdown-body a { color: var(--accent); text-decoration: none; }
.markdown-body a:hover { text-decoration: underline; }

/* Report Action Icons Row */
.report-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-btn svg {
    transition: transform 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}
.action-btn:hover svg {
    transform: scale(1.05);
}

.action-btn.active {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.3);
    color: var(--accent);
}

.action-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

/* ----------------------------------------------------
   BOTTOM INPUT BAR
   ---------------------------------------------------- */
.bottom-input-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.75rem;
    background: rgba(8, 8, 10, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    overflow: visible; /* Let the animated glow rise above the input bar */
}

.input-wrapper {
    width: 100%;
    max-width: 750px;
    position: relative;
    background: rgba(27, 27, 31, 0.8); /* Translucent deep grey for better context while scrolling */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center; /* Center items vertically */
    padding: 0.5rem 0.65rem 0.5rem 1.25rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10; /* Keep input on top of the background glow */
}

.input-wrapper:focus-within {
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.12); /* Indigo glow on focus */
    border-color: rgba(99, 102, 241, 0.45); /* Indigo border on focus */
    background: rgba(34, 35, 39, 0.8); /* Slightly lighter translucent deep grey on focus */
}

/* Textarea Search input */
.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    padding: 0.65rem 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: #ffffff; /* Pure white text color for maximum readability and contrast */
    min-height: 38px;
    max-height: 250px;
    outline: none;
    overflow-y: hidden; /* Hide scroll bars completely */
    scrollbar-width: none;
}

.input-wrapper textarea::placeholder {
    color: #a6abb2; /* Slightly lighter gray placeholder for contrast */
}

.input-wrapper textarea::-webkit-scrollbar {
    display: none; /* Hide scrollbars Chrome/Safari */
}

.mic-btn {
    background: transparent;
    border: none;
    color: #86efac;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    margin-right: 0.5rem;
    opacity: 1;
    transform: scale(1);
    width: 38px; /* Matched to send button size */
    height: 38px;
    box-shadow: 0 0 0 1px rgba(134, 239, 172, 0.08), 0 0 18px rgba(34, 197, 94, 0.08);
}
.mic-btn:hover {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 0 1px rgba(134, 239, 172, 0.18), 0 0 22px rgba(34, 197, 94, 0.18);
}
.mic-btn.hidden {
    opacity: 0;
    transform: scale(0.7);
    pointer-events: none;
    width: 0;
    margin-right: 0;
    padding: 0;
}
.mic-btn.recording {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    animation: pulseRed 1.5s infinite;
}

@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.send-btn {
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 38px; /* Symmetrical size matching mic button */
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.15);
}
.send-btn:hover { 
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(167, 139, 250, 0.25);
}
.send-btn:disabled { 
    background: rgba(255, 255, 255, 0.08); 
    color: rgba(255, 255, 255, 0.2); 
    cursor: not-allowed; 
    box-shadow: none;
    transform: none;
}

.pulsing-loader {
    animation: pulseLoader 1.5s ease-in-out infinite;
}

/* ----------------------------------------------------
   MOBILE DRAWER & RESPONSIVE QUERY STYLES
   ---------------------------------------------------- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.65; }
    100% { opacity: 1; }
}

@keyframes pulseLoader {
    0% { opacity: 0.45; }
    50% { opacity: 0.8; }
    100% { opacity: 0.45; }
}

/* Mobile Media Queries */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    
    .top-nav {
        padding: 0.75rem 1rem;
    }
    
    .settings-dropdown-panel {
        top: 57px;
        padding: 1rem;
    }
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .chat-container {
        padding: 5rem 1rem 120px 1rem;
    }
    
    .welcome-screen h1 {
        font-size: 1.75rem;
    }
    
    .auth-card {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }
    
    .bottom-input-bar {
        position: fixed;
        bottom: env(safe-area-inset-bottom, 0px);
        padding: 0.75rem;
        background: rgba(8, 8, 10, 0.95);
    }
    .input-wrapper {
        padding: 0.4rem 0.4rem 0.4rem 0.85rem;
        border-radius: 22px;
    }
    .input-wrapper textarea {
        min-height: 32px;
        font-size: 0.9rem;
        padding: 0.35rem 0.25rem;
    }
    .send-btn {
        width: 32px;
        height: 32px;
    }
    .mic-btn {
        width: 30px;
        height: 30px;
        margin-right: 0.25rem;
    }
}

/* Settings Dropdown Panel & Grid Layout */
.settings-dropdown-panel {
    position: absolute;
    top: 65px;
    left: 0;
    right: 0;
    background: rgba(15, 15, 18, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.75rem;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 9;
}
.settings-dropdown-panel.hidden { display: none; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 1.25rem;
    max-width: 1100px;
    margin: 0 auto;
}

.settings-grid .config-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.settings-grid .config-item label {
    font-size: 0.725rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.1rem;
}

.settings-grid .config-item input, .settings-grid .config-item select {
    width: 100%;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
}
.settings-grid .config-item input:focus, .settings-grid .config-item select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ----------------------------------------------------
   GEMINI-LIKE FLUID ANIMATED GLOW (BOTTOM AREA)
   ---------------------------------------------------- */
.gemini-glow-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 380px;
    overflow: hidden;
    pointer-events: none;
    z-index: 1; /* Below input wrapper, above background */
    opacity: 0.9;
}

/* Semi-circular massive base spanning from left to right */
.glow-base {
    position: absolute;
    bottom: -220px;
    left: -10vw;
    right: -10vw;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(67, 56, 202, 0.45) 0%, rgba(30, 58, 138, 0.25) 50%, rgba(99, 102, 241, 0.08) 80%, transparent 100%);
    filter: blur(65px);
    z-index: 1;
    animation: geminiPulse 8s infinite alternate ease-in-out;
}

.glow-ball {
    position: absolute;
    border-radius: 50%;
    filter: blur(75px);
    mix-blend-mode: screen;
    pointer-events: none;
}

.ball-1 {
    width: 600px;
    height: 260px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, rgba(49, 46, 129, 0.08) 60%, transparent 100%);
    bottom: -110px;
    left: -5%;
    z-index: 2;
    animation: geminiMove1 14s infinite alternate ease-in-out;
}

.ball-2 {
    width: 650px;
    height: 280px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.32) 0%, rgba(30, 27, 75, 0.08) 60%, transparent 100%);
    bottom: -130px;
    right: -5%;
    z-index: 2;
    animation: geminiMove2 16s infinite alternate ease-in-out;
}

.ball-3 {
    width: 500px;
    height: 220px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.25) 0%, rgba(99, 102, 241, 0.06) 60%, transparent 100%);
    bottom: -90px;
    left: 28%;
    z-index: 2;
    animation: geminiMove3 11s infinite alternate ease-in-out;
}

@keyframes geminiPulse {
    0% {
        opacity: 0.85;
        transform: scale(1);
    }
    100% {
        opacity: 1;
        transform: scale(1.04);
    }
}

@keyframes geminiMove1 {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    50% {
        transform: translate(120px, -20px) scale(1.08) rotate(60deg);
    }
    100% {
        transform: translate(240px, 10px) scale(0.95) rotate(120deg);
    }
}

@keyframes geminiMove2 {
    0% {
        transform: translate(0, 0) scale(1.05) rotate(0deg);
    }
    50% {
        transform: translate(-120px, -25px) scale(0.92) rotate(-60deg);
    }
    100% {
        transform: translate(-240px, 15px) scale(1.02) rotate(-120deg);
    }
}

@keyframes geminiMove3 {
    0% {
        transform: translate(0, 0) scale(0.95) rotate(0deg);
    }
    50% {
        transform: translate(80px, 15px) scale(1.05) rotate(45deg);
    }
    100% {
        transform: translate(-80px, -15px) scale(0.9) rotate(90deg);
    }
}

/* ----------------------------------------------------
   COHESIVE GLOBAL SCROLLBAR STYLING
   ---------------------------------------------------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 15, 18, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.28);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Support for Firefox scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.28) rgba(15, 15, 18, 0.4);
}

.no-history-placeholder {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    margin: 0.5rem;
    background: rgba(255, 255, 255, 0.01);
}

.app-logo-img {
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.auth-logo .app-logo-img {
    height: 40px;
    width: 40px;
    border-radius: 10px;
}

.logo h2 .app-logo-img {
    height: 28px;
    width: 28px;
    border-radius: 6px;
}

/* Sidebar Collapse Styles for Desktop */
@media (min-width: 769px) {
    .sidebar {
        transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        overflow: hidden !important;
        border-right: none !important;
    }
}

/* Close Sidebar Button Style */
.close-sidebar-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Progress Dashboard Styling */
.progress-dashboard {
    position: absolute;
    top: 80px; /* just below top-nav */
    right: 1.75rem;
    width: 260px;
    background: rgba(20, 20, 23, 0.8);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem 1.15rem;
    box-shadow: var(--shadow-lg), 0 0 20px rgba(56, 189, 248, 0.05);
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-dashboard.hidden {
    display: none !important;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
}

.dashboard-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

#dashboardTimer {
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.825rem;
    margin-bottom: 0.65rem;
}

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

.info-value {
    color: #a78bfa;
    font-weight: 600;
}

.progress-bar-container {
    display: none;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8 0%, #a78bfa 100%);
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.55rem;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Guardrail Popup CSS */
.guardrail-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 8, 10, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.guardrail-popup.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.guardrail-popup-content {
    background: rgba(20, 20, 23, 0.85);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    padding: 2.25rem 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.guardrail-popup-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.guardrail-popup-content h3 {
    font-size: 1.25rem;
    color: #ef4444;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.guardrail-popup-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.guardrail-popup-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    padding: 0.65rem 1.75rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.guardrail-popup-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.6);
    transform: translateY(-1px);
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
