/*
Theme Name: ReAi Chat
Theme URI: https://reai-chat.com
Author: ReAi Chat
Author URI: https://reai-chat.com
Description: A custom dark theme for ReAi Chat. Premium dark interface with neon cyan and purple accents. Features AI chatbot, essay writer, and image generator.
Version: 3.0
License: GNU General Public License v2 or later
Text Domain: reai-chat
*/

/* ==========================================
   DESIGN TOKENS - DARK FIRST
   ========================================== */
:root {
    /* Colors - Dark Mode (Default) */
    --primary: #9FFCDF;
    --primary-hover: #52AD9C;
    --primary-glow: rgba(159, 252, 223, 0.15);
    --primary-glow-strong: rgba(159, 252, 223, 0.3);
    --primary-light: rgba(159, 252, 223, 0.08);
    --primary-border: rgba(159, 252, 223, 0.2);
    --accent: #52AD9C;
    --accent-light: rgba(82, 173, 156, 0.1);
    --bg-main: #0B0A07;
    --bg-elevated: #12110E;
    --bg-sidebar: #12110E;
    --bg-card: #12110E;
    --bg-input: #12110E;
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-light: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --input-bg: #12110E;
    --card-bg: #12110E;
    --error: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing & Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(159, 252, 223, 0.15);

    /* Transitions */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Light Mode Override (toggled via button — no class = dark default) */
body.light-mode {
    --primary: #1A5B51;
    --primary-hover: #15463E;
    --primary-glow: rgba(26, 91, 81, 0.15);
    --primary-light: rgba(26, 91, 81, 0.08);
    --primary-border: rgba(26, 91, 81, 0.25);
    --bg-main: #F7EBEC;
    --bg-elevated: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-input: #F7EBEC;
    --text-primary: #12110E;
    --text-secondary: #2C2A26;
    --text-light: #4A4742;
    --text-muted: #6B6760;
    --border: rgba(18, 17, 14, 0.12);
    --border-hover: rgba(18, 17, 14, 0.2);
    --hover-bg: rgba(18, 17, 14, 0.05);
    --input-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --success: #16a34a;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes navLineFlow {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes iconPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) rotate(25deg);
    }

    100% {
        transform: translateX(100%) rotate(25deg);
    }
}

/* ==========================================
   RESET & BASE
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

*::selection {
    background: var(--primary);
    color: #000;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
.text-primary {
    color: var(--primary);
}

.text-gray {
    color: var(--text-secondary);
}

.font-bold {
    font-weight: 700;
}

.text-center {
    text-align: center;
}

/* ==========================================
   MAIN CONTAINER
   ========================================== */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
    background: var(--bg-main);
}

/* ==========================================
   SIDEBAR - Glass Dark Panel
   ========================================== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 85%;
        max-width: 300px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
}

.sidebar::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

/* Sidebar Collapsed State (Mini Rail) */
.sidebar.collapsed {
    width: 68px;
    padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .btn-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .clear-history-btn,
.sidebar.collapsed .sidebar-close-btn,
.sidebar.collapsed .history-item span:not(.material-icons-outlined),
.sidebar.collapsed .history-list>div:not(.history-item) {
    display: none !important;
}

.sidebar.collapsed .logo-area {
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0;
}

.sidebar.collapsed .logo-full {
    display: none !important;
}

.sidebar.collapsed .logo-mini {
    display: block !important;
    margin: 0 auto;
}

.sidebar.collapsed .new-project-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    margin: 0 auto 1.5rem;
    min-width: unset;
}

.sidebar.collapsed .new-project-btn .material-icons-outlined {
    margin: 0;
    font-size: 24px;
}

.sidebar.collapsed .nav-section-title {
    justify-content: center !important;
    padding: 0.5rem 0;
}

.sidebar.collapsed .nav-section-title>div {
    gap: 0 !important;
}

.sidebar.collapsed .nav-section-title i,
.sidebar.collapsed .nav-section-title .material-icons-outlined {
    margin: 0;
}

.sidebar.collapsed .history-list {
    align-items: center;
}

.sidebar.collapsed .categories-submenu {
    padding: 0 !important;
    gap: 4px !important;
}

.sidebar.collapsed .categories-submenu .history-item {
    padding-left: 0 !important;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .history-item {
    justify-content: center;
    padding: 0.625rem 0 !important;
    /* Force override inline padding */
    width: 44px;
    height: 44px;
    border-radius: 12px;
    margin: 0 auto 6px;
}

.sidebar.collapsed .history-item .material-icons-outlined {
    margin: 0;
    font-size: 20px;
    color: var(--text-primary);
    opacity: 0.8;
}

.history-item.active .material-icons-outlined {
    color: var(--primary) !important;
    opacity: 1 !important;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}

/* Mobile: Hide sidebar completely when not open */
@media (max-width: 768px) {
    .sidebar:not(.open) {
        transform: translateX(-100%) !important;
        opacity: 0;
        pointer-events: none;
    }
}

/* Sidebar Overlay - Mobile Background */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Logo Area */
.logo-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 4px;
    margin-bottom: 2rem;
    height: 52px;
    overflow: hidden;
}

.logo-area a {
    display: flex;
    align-items: center;
    text-decoration: none;
    height: 100%;
    overflow: hidden;
}

.logo-full {
    height: 48px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    mix-blend-mode: screen;
}

.logo-mini {
    display: none;
    height: 42px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: screen;
}

body.light-mode .logo-full,
body.light-mode .logo-mini {
    filter: invert(1) brightness(0.9) contrast(1.1);
    mix-blend-mode: multiply;
}

/* Logo area collapsed state is handled above near general sidebar styles */

/* New Chat Button */
.new-project-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    color: #fff !important;
    border: none;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2rem;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 16px rgba(159, 252, 223, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.new-project-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 24px rgba(159, 252, 223, 0.4) !important;
    filter: brightness(1.1) !important;
}

.new-project-btn:active {
    transform: translateY(0) scale(0.98);
}

.new-project-btn .material-icons-outlined {
    font-size: 18px;
}

/* Nav Section Title */
.nav-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    padding: 0.5rem 0.375rem;
    margin-bottom: 0.25rem;
}

.nav-section-title .material-icons-outlined {
    font-size: 16px;
}

/* History List */
.history-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 0.625rem;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s var(--ease-smooth);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item .material-icons-outlined {
    font-size: 16px;
    opacity: 0.6;
}

.history-item:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.history-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.history-item.active .material-icons-outlined {
    opacity: 1;
}

/* ==========================================
   MAIN CONTENT AREA
   ========================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin-left: 280px;
    /* Sidebar default width */
    padding-top: 60px;
    /* Header height */
    transition: margin-left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-main);
}

/* Adjust main content when sidebar is collapsed (Mini Rail) */
.sidebar.collapsed~.main-content {
    margin-left: 68px !important;
}

.sidebar.hidden~.main-content {
    margin-left: 0 !important;
}

@media (max-width: 768px) {

    .sidebar.hidden~.main-content,
    .sidebar.collapsed~.main-content {
        margin-left: 0 !important;
    }
}

/* ==========================================
   TOP BAR - Minimal & Floating
   ========================================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Theme Toggle */
.theme-toggle-icon {
    cursor: pointer;
    padding: 7px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 20px;
}

.theme-toggle-icon:hover {
    background: var(--hover-bg);
    color: var(--primary);
}

/* Desktop sidebar toggle - visible on desktop, hidden on mobile */
.desktop-toggle {
    display: flex;
}

@media (max-width: 768px) {
    .desktop-toggle {
        display: none !important;
    }

    .top-bar-left {
        display: none !important;
    }
}

/* ==========================================
   BUTTONS - Blog, Login, Signup
   ========================================== */
a.blog-btn,
.blog-btn,
.nav-btn,
.nav-btn-primary {
    padding: 8px 18px !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover), var(--primary)) !important;
    background-size: 200% auto !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 0.85rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(159, 252, 223, 0.25);
    position: relative;
    overflow: hidden;
}

a.blog-btn::after,
.blog-btn::after,
.nav-btn::after,
.nav-btn-primary::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: rotate(25deg);
    transition: 0.5s;
    pointer-events: none;
}

a.blog-btn:hover::after,
.blog-btn:hover::after,
.nav-btn:hover::after,
.nav-btn-primary:hover::after {
    animation: shimmer 1.5s infinite;
}

a.blog-btn:hover,
.blog-btn:hover,
.nav-btn:hover,
.nav-btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(159, 252, 223, 0.45);
    filter: brightness(1.1);
    background-position: right center !important;
    color: #000 !important;
}

.theme-toggle-btn {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-toggle-btn:hover {
    transform: rotate(180deg) scale(1.2);
    color: var(--primary) !important;
}

.nav-breadcrumb a {
    position: relative;
    transition: color 0.3s;
    color: inherit !important;
    text-decoration: none !important;
}

.nav-breadcrumb a:hover {
    color: var(--primary) !important;
}

.nav-breadcrumb a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary);
    transition: width 0.3s;
}

.nav-breadcrumb a:hover::after {
    width: 100%;
}

@keyframes slideDownReveal {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.studio-nav,
.top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 280px !important;
    /* Start AFTER the sidebar */
    right: 0 !important;
    height: 60px !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 1.5rem !important;
    background: rgba(11, 10, 7, 0.8) !important;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--border);
    z-index: 1000 !important;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.collapsed~.main-content .top-bar {
    left: 68px !important;
}

.sidebar.hidden~.main-content .top-bar {
    left: 0 !important;
}

@media (max-width: 768px) {
    .top-bar {
        left: 0 !important;
    }
}

body.light-mode .studio-nav,
body.light-mode .top-bar {
    background: rgba(255, 255, 255, 0.8) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.studio-nav>*,
.top-bar>* {
    animation: slideDownReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nav-brand,
.top-bar-left {
    animation-delay: 0.1s;
}

.nav-breadcrumb {
    animation-delay: 0.25s;
}

.nav-actions,
.top-bar-right {
    animation-delay: 0.4s;
}

.studio-nav::after,
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -100%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: navLineFlow 6s linear infinite;
    opacity: 0.8;
}

.nav-brand,
.logo-area {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    transition: transform 0.3s ease !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
}

.nav-brand:hover,
.logo-area:hover {
    transform: scale(1.02);
}

.nav-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 18px;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.nav-brand:hover .nav-brand-icon,
.logo-area:hover .logo-full {
    animation: iconPulse 1.5s ease infinite;
}

.nav-brand-text {
    font-weight: 800;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 1rem;
}

.nav-breadcrumb .sep {
    opacity: 0.4;
}

@media (max-width: 540px) {
    .nav-breadcrumb {
        display: none !important;
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-dropdown-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: var(--hover-bg);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-nav-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: flex !important;
    }

    .nav-dropdown-menu {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        min-width: 240px;
        background: var(--bg-sidebar);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 8px;
        flex-direction: column;
        gap: 4px;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        animation: dropdownIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .nav-actions.dropdown-open .nav-dropdown-menu {
        display: flex;
    }

    .nav-dropdown-menu .nav-btn {
        width: 100%;
        display: flex !important;
        justify-content: flex-start;
        border: none !important;
        background: transparent !important;
        padding: 12px 18px !important;
        margin: 0 !important;
        box-shadow: none !important;
    }

    .nav-dropdown-menu .nav-btn:hover {
        background: var(--hover-bg) !important;
    }

    .nav-dropdown-menu .nav-btn.active {
        background: var(--primary-light) !important;
        color: var(--primary) !important;
        border-left: 3px solid var(--primary) !important;
        border-radius: 0;
    }
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-actions .nav-btn.active {
    box-shadow: 0 0 15px var(--primary-glow-strong);
    border: 1px solid var(--primary) !important;
}

.nav-actions .nav-btn:not(.active) {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border) !important;
    box-shadow: none;
}

.nav-actions .nav-btn:not(.active):hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.login-btn {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.login-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--hover-bg);
}

.signup-btn {
    padding: 6px 14px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.signup-btn:hover {
    background: var(--primary-hover);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.mobile-menu-btn:hover {
    background: var(--hover-bg);
    border-color: var(--border-hover);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--hover-bg);
    color: var(--primary);
}

.sidebar-close-btn .material-icons-outlined {
    font-size: 18px;
}

/* ==========================================
   DASHBOARD VIEW & LAYOUT
   ========================================== */
.dashboard-view {
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    position: relative;
    min-height: calc(100vh - 56px);
    justify-content: space-between;
}

/* ==========================================
   HERO SECTION
   ========================================== */
#hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
    animation: heroFadeIn 0.6s ease-out;
}

.hero-text {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.hero-text .text-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #52AD9C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtext {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    line-height: 1.5;
}

.sparkle {
    color: var(--primary);
    font-size: 1.1rem;
    vertical-align: super;
    margin-left: 2px;
    animation: sparkleGlow 2s ease-in-out infinite alternate;
}

@keyframes sparkleGlow {
    0% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
        text-shadow: 0 0 8px var(--primary);
    }
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   CHAT VIEW
   ========================================== */
.chat-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0 240px;
    /* Significantly increased to clear sticky input + extra breathing room */
    flex: 1;
    overflow-y: visible;
}

/* Message Base Styles */
.message {
    display: flex;
    gap: 0.875rem;
    animation: msgSlideIn 0.25s ease-out;
}

@keyframes msgSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User Message - Align Right */
.message.user-message {
    flex-direction: row-reverse;
}

/* Avatar Styles */
.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.user-message .avatar {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.bot-message .avatar {
    background: linear-gradient(135deg, var(--primary), #52AD9C);
    color: #000;
}

/* Message Container */
.message .message-container {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-width: 75%;
}

.user-message .message-container {
    align-items: flex-end;
}

/* Message Sender Name */
.message .message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Message Content Bubble */
.message .message-content {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-lg);
    line-height: 1.6;
    font-size: 0.9rem;
    word-wrap: break-word;
}

.user-message .message-content {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: rgba(159, 252, 223, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(159, 252, 223, 0.1);
    border-bottom-left-radius: 4px;
}

/* Light mode message overrides */
body.dark-mode .user-message .message-content {
    background: #12110E;
    color: #e8eaf0;
    border-color: rgba(0, 0, 0, 0.08);
}

body.dark-mode .bot-message .message-content {
    background: rgba(159, 252, 223, 0.06);
    color: #e8eaf0;
    border-color: rgba(159, 252, 223, 0.15);
}

/* Message Content Typography */
.message-content p {
    margin-bottom: 0.75rem;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content pre,
.message-content code {
    font-family: 'JetBrains Mono', 'Monaco', 'Consolas', monospace;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}

.message-content code {
    padding: 0.2rem 0.4rem;
    font-size: 0.82em;
    color: var(--primary);
}

.message-content pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.message-content pre code {
    padding: 0;
    background: transparent;
    color: var(--text-primary);
}

body.dark-mode .message-content pre,
body.dark-mode .message-content code {
    background: rgba(255, 255, 255, 0.04);
}

/* Loading Dots Animation */
.loading-dots {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 0.5rem 0;
}

.loading-dots .dot {
    width: 7px;
    height: 7px;
    background: var(--primary);
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.loading-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.5);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Messages */
@media (max-width: 768px) {
    .message .message-container {
        max-width: 85%;
    }

    .message .avatar {
        width: 30px;
        height: 30px;
        font-size: 14px;
        border-radius: 8px;
    }

    .message .message-content {
        padding: 0.75rem 0.875rem;
        font-size: 0.875rem;
    }
}

/* ==========================================
   CHAT INPUT CONTAINER
   ========================================== */
.input-container {
    width: 100%;
    margin: 0 auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 0.875rem 1.125rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    bottom: 1.5rem;
    z-index: 50;
    margin-top: auto;
    transition: all 0.3s var(--ease-smooth);
}

.input-container:focus-within {
    border-color: rgba(159, 252, 223, 0.3);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.input-box {
    width: 100%;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: none;
    outline: none;
    color: var(--text-primary);
    min-height: 24px;
    max-height: 200px;
    margin-bottom: 0.375rem;
    line-height: 1.5;
}

.input-box::placeholder {
    color: var(--text-light);
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.375rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.char-count {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.attach-icon {
    color: var(--text-light);
    cursor: pointer;
    font-size: 20px;
    transition: color 0.2s;
}

.attach-icon:hover {
    color: var(--primary);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary), #52AD9C);
    color: #000;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
}

.send-btn .material-icons-outlined {
    font-size: 18px;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(159, 252, 223, 0.3);
}

/* ==========================================
   FOOTER CONTROLS (Left)
   ========================================== */
.left-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
}

.divider-vertical {
    width: 1px;
    height: 14px;
    background: var(--border);
}

/* Tool Pills */
.quick-tool-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: all 0.2s var(--ease-smooth);
    margin-right: 4px;
}

.quick-tool-pill:hover {
    background: var(--hover-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.quick-tool-pill .material-icons-outlined {
    font-size: 16px;
    color: var(--primary);
}

.quick-tool-pill:visited {
    color: var(--text-secondary);
}

/* Ensure controls wrap on small mobile */
@media (max-width: 480px) {
    .input-footer {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .left-controls {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .input-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==========================================
   MOBILE RESPONSIVE - Sidebar & Layout
   ========================================== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(-110%);
        width: 85%;
        max-width: 320px;
        left: 0;
        z-index: 10000;
        transition: transform 0.3s ease, visibility 0s linear 0.3s, opacity 0.3s ease;
        visibility: hidden;
        opacity: 0;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        transition: transform 0.3s ease, visibility 0s linear 0s, opacity 0.3s ease;
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle-btn {
        margin-left: auto;
    }

    .top-bar {
        padding: 0.625rem 1rem;
    }

    .hero-text {
        font-size: 1.75rem;
    }

    .input-container {
        border-radius: var(--radius-lg);
        bottom: 0.75rem;
        margin: 0 0.75rem 0.75rem 0.75rem;
        width: calc(100% - 1.5rem);
    }

    /* Mobile Sidebar Overlay */
    .sidebar-overlay {
        z-index: 9999;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: flex !important;
    }

    .top-bar-left,
    .desktop-toggle {
        display: none !important;
    }
}

/* ==========================================
   AUTH & DROPDOWN
   ========================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input {
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
    color: var(--text-light);
}

.auth-submit {
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), #52AD9C);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.25rem;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(159, 252, 223, 0.3);
}

.auth-submit:active {
    transform: translateY(0);
}

.form-error {
    color: var(--error);
    font-size: 0.8125rem;
    min-height: 1.125rem;
    display: none;
}

.form-error.show {
    display: block;
}

/* User Dropdown */
.user-dropdown {
    position: fixed;
    top: 54px;
    right: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    display: none;
    z-index: 10001;
    min-width: 200px;
    backdrop-filter: blur(12px);
}

.user-dropdown.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.dropdown-item:hover {
    background: var(--hover-bg);
}

.dropdown-item .material-icons-outlined {
    font-size: 18px;
    opacity: 0.7;
}

/* ==========================================
   MODALS
   ========================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-overlay.active,
.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2.25rem;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: modalIn 0.3s var(--ease-smooth);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.375rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.modal-heading {
    font-size: 1.375rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.modal-footer-text {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.modal-link:hover {
    text-decoration: underline;
}

/* ==========================================
   CONTACT BUBBLE
   ========================================== */
.contact-bubble-wrapper {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.contact-bubble-wrapper.hidden {
    display: none !important;
}

.dismiss-bubble {
    width: 26px;
    height: 26px;
    background: #71717a;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8) translateY(8px);
    transition: all 0.25s var(--ease-smooth);
    pointer-events: none;
}

.dismiss-bubble .material-icons-outlined {
    font-size: 14px !important;
}

.contact-bubble-wrapper:hover .dismiss-bubble {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.dismiss-bubble:hover {
    background: var(--error);
    transform: scale(1.1) translateY(0);
}

.contact-bubble {
    width: 56px !important;
    height: 56px !important;
    background: linear-gradient(135deg, var(--primary), #52AD9C);
    color: #000;
    border-radius: 50%;
    border: none;
    box-shadow: 0 6px 20px rgba(159, 252, 223, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-smooth);
}

.contact-bubble .material-icons-outlined {
    font-size: 28px !important;
}

.contact-bubble:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 10px 30px rgba(159, 252, 223, 0.45);
}

@media (max-width: 768px) {
    .contact-bubble-wrapper {
        bottom: 72px !important;
        right: 16px !important;
    }

    .contact-bubble {
        width: 50px !important;
        height: 50px !important;
    }

    .contact-bubble .material-icons-outlined {
        font-size: 24px !important;
    }

    .dismiss-bubble {
        opacity: 1;
        transform: scale(1) translateY(0);
        pointer-events: auto;
    }
}

/* Contact Info Box */
.contact-info-box {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

/* ==========================================
   SELECTION POPUP
   ========================================== */
.selection-popup {
    position: fixed;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: var(--radius-md);
    display: none;
    gap: 6px;
    z-index: 100000;
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    align-items: center;
    border: 1px solid var(--border);
    animation: fadeIn 0.15s ease;
    white-space: nowrap;
    backdrop-filter: blur(12px);
}

.selection-popup button {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: inherit;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.selection-popup button:hover,
.selection-popup button:active {
    background: var(--hover-bg);
    color: var(--primary);
}

.selection-popup .divider {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 2px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ==========================================
   BREADCRUMBS
   ========================================== */
.breadcrumbs {
    padding: 0.875rem 0;
    width: 100%;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.breadcrumbs ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.breadcrumbs li {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs li:not(:last-child)::after {
    content: "chevron_right";
    font-family: 'Material Icons Outlined';
    font-size: 1.15em;
    vertical-align: middle;
    margin-left: 0.375rem;
    opacity: 0.3;
    user-select: none;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

.breadcrumbs a:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.breadcrumbs span[aria-current="page"] {
    color: var(--text-primary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .breadcrumbs {
        font-size: 0.75rem;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .breadcrumbs::-webkit-scrollbar {
        display: none;
    }
}

/* ==========================================
   DESKTOP FIXES
   ========================================== */
.sidebar-toggle-btn,
.desktop-toggle,
.mobile-menu-btn {
    cursor: pointer;
    z-index: 1001;
}

.sidebar .logo-area .sidebar-toggle-btn {
    display: flex;
    visibility: visible;
    pointer-events: auto;
}

@media (min-width: 769px) {
    .sidebar.hidden {
        transform: translateX(-110%) !important;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
}

/* ==========================================
   NOTIFICATION TOAST
   ========================================== */
.notification-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s var(--ease-smooth);
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}