@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&family=JetBrains+Mono&display=swap');

:root {
    /* Core Palette - Deep Anthracite & Violet */
    --h: 250;
    --bg-hsl: var(--h), 20%, 8%;
    --surface-hsl: var(--h), 15%, 12%;
    --accent-hsl: var(--h), 80%, 65%;

    --bg-color: hsl(var(--bg-hsl));
    --surface-color: hsla(var(--surface-hsl), 0.7);
    --surface-border: hsla(var(--h), 15%, 25%, 0.4);

    --primary-color: hsl(var(--accent-hsl));
    --primary-glow: hsla(var(--accent-hsl), 0.3);

    --text-primary: hsl(var(--h), 10%, 95%);
    --text-secondary: hsl(var(--h), 10%, 70%);
    --text-muted: hsl(var(--h), 10%, 50%);

    --message-user-bg: hsla(var(--h), 15%, 20%, 0.6);
    --message-ai-bg: hsla(var(--h), 25%, 15%, 0.4);

    --glass-bg: hsla(var(--h), 15%, 10%, 0.6);
    --glass-border: hsla(var(--h), 15%, 25%, 0.3);
    --glass-blur: blur(12px);

    --sidebar-width: 280px;
    --sidebar-collapsed-width: 68px;
    --side-panel-width: 400px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 0% 0%, hsla(var(--accent-hsl), 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, hsla(var(--accent-hsl), 0.05) 0%, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
}

/* App Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    border-bottom: 1px solid var(--glass-border);
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .logo-wrapper .logo-text {
    opacity: 0;
    pointer-events: none;
    width: 0;
}

.logo-text {
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), hsl(var(--h), 90%, 75%));
    border-radius: 8px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.sidebar-content {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem;
    border-radius: 10px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    pointer-events: none;
}

.nav-item:hover,
.nav-item.active {
    background: hsla(var(--h), 15%, 25%, 0.4);
    color: var(--text-primary);
}

.nav-item.active {
    background: hsla(var(--h), 15%, 30%, 0.4);
    box-shadow: inset 0 0 0 1px var(--glass-border);
}

/* Icon Button */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: hsla(var(--h), 15%, 25%, 0.4);
    color: var(--text-primary);
}

.stop-btn {
    color: #ff4b4b;
    border: 1px solid rgba(255, 75, 75, 0.2);
}

.stop-btn:hover {
    background: rgba(255, 75, 75, 0.1) !important;
    color: #ff3232;
    border-color: rgba(255, 75, 75, 0.4);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: transparent;
}

header {
    padding: 1rem 2rem;
    background: hsla(var(--h), 15%, 8%, 0.4);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

header h1 {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: hsla(150, 80%, 40%, 0.1);
    color: #4ade80;
    border: 1px solid hsla(150, 80%, 40%, 0.2);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
}

/* Scrollbar Customization */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

/* Messages */
.message {
    display: flex;
    gap: 1.25rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
}

.message.assistant .avatar {
    background: linear-gradient(135deg, var(--primary-color), hsl(var(--h), 90%, 75%));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.message.user .avatar {
    background: var(--surface-color);
    color: var(--text-secondary);
}

.content {
    background: var(--message-ai-bg);
    padding: 1.25rem;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 0.95rem;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
    flex: 1;
}

.message.user .content {
    background: var(--message-user-bg);
    border-bottom-right-radius: 4px;
}

.message.assistant .content {
    border-top-left-radius: 4px;
}

/* Markdown Contextual Styles */
.content h1,
.content h2,
.content h3 {
    margin: 1.5rem 0 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.content p {
    margin-bottom: 1rem;
}

.content p:last-child {
    margin-bottom: 0;
}

.content pre {
    background: hsla(var(--h), 15%, 5%, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: hsla(var(--h), 15%, 25%, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

.content pre code {
    background: transparent;
    padding: 0;
}

/* Markdown List Styles */
.content ul,
.content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.content ul {
    list-style-type: disc;
}

.content ol {
    list-style-type: decimal;
}

.content li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
}

.content li:last-child {
    margin-bottom: 0;
}

/* Links in messages */
.content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 0.1rem 0;
    border-bottom: 1px solid transparent;
}

.content a:hover {
    border-bottom-color: var(--primary-color);
    filter: brightness(1.15);
}

/* Google Calendar Tile Component */
.gcal-tile {
    background: linear-gradient(135deg, hsla(220, 15%, 18%, 0.9), hsla(220, 15%, 14%, 0.95));
    border: 1px solid hsla(220, 15%, 30%, 0.5);
    border-radius: 12px;
    overflow: hidden;
    margin: 1rem 0;
    max-width: 360px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gcal-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.gcal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: hsla(220, 15%, 22%, 0.6);
    border-bottom: 1px solid hsla(220, 15%, 30%, 0.3);
}

.gcal-icon {
    flex-shrink: 0;
}

.gcal-brand {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.gcal-content {
    padding: 1rem;
}

.gcal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.gcal-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.gcal-link {
    display: block;
    padding: 0.75rem 1rem;
    background: hsla(217, 90%, 61%, 0.15);
    color: #4285f4 !important;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    border-top: 1px solid hsla(220, 15%, 30%, 0.3);
    transition: background 0.2s ease;
    border-bottom: none !important;
}

.gcal-link:hover {
    background: hsla(217, 90%, 61%, 0.25);
    filter: none !important;
}

.content ul ul,
.content ol ol,
.content ul ol,
.content ol ul {
    margin-top: 0.4rem;
    margin-bottom: 0.4rem;
}

/* Input Area */
.input-area {
    padding: 1.5rem 2rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

#chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chat-form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 8px 32px var(--primary-glow);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    resize: none;
    max-height: 200px;
    line-height: 1.5;
}

#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

#send-btn:disabled {
    opacity: 0.3;
    transform: none;
    cursor: not-allowed;
}

/* Right Side Panel (Tools & Artifacts) */
.side-panel {
    width: 0;
    height: 100vh;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-left: 1px solid var(--glass-border);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.side-panel.open {
    width: var(--side-panel-width);
}

.side-panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-panel {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-panel:hover {
    color: var(--text-primary);
}

.side-panel-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Tool execution card */
.tool-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.tool-icon {
    width: 24px;
    height: 24px;
    background: hsla(var(--h), 15%, 25%, 0.5);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.tool-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.tool-status {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.tool-output {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: hsla(0, 0%, 0%, 0.3);
    padding: 0.75rem;
    border-radius: 6px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Cursor & Animations */
.cursor-blink {
    display: inline-block;
    width: 6px;
    height: 15px;
    background-color: var(--primary-color);
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: middle;
    border-radius: 1px;
    box-shadow: 0 0 8px var(--primary-glow);
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Backdrop */
.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-only {
    display: none;
}

/* Responsiveness */
@media (max-width: 1024px) {
    :root {
        --side-panel-width: 350px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
        --side-panel-width: 100%;
    }

    .mobile-only {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        height: 100dvh;
        z-index: 100;
        width: var(--sidebar-width);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: hsla(var(--h), 20%, 10%, 0.98);
        backdrop-filter: blur(20px);
    }

    .sidebar.open {
        left: 0;
    }

    /* Ensure text is visible in sidebar drawer even if collapsed class is present */
    .sidebar.open .nav-text,
    .sidebar.open .logo-text,
    .sidebar.open .user-info,
    .sidebar.open .section-label,
    .sidebar.open .sidebar-selector {
        opacity: 1 !important;
        width: auto !important;
        pointer-events: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    .sidebar.collapsed {
        left: -100%;
        width: var(--sidebar-width);
    }

    .sidebar.collapsed.open {
        left: 0;
    }

    .main-wrapper {
        width: 100%;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    header {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
        height: 50px;
        border-bottom: 1px solid var(--glass-border);
    }

    header h1 {
        font-size: 0.9rem;
        flex: 1;
    }

    .status-badge {
        display: none;
    }

    .chat-container {
        padding: 0.75rem;
        gap: 0.75rem;
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }

    .message {
        gap: 0.5rem;
        margin: 0.25rem 0;
    }

    .content {
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
        border-radius: 12px;
    }

    .avatar {
        display: none;
        /* Maximum density on mobile */
    }

    .input-area {
        padding: 0.5rem 0.75rem 0.75rem;
        background: hsla(var(--h), 15%, 8%, 0.6);
        backdrop-filter: blur(10px);
    }

    #chat-form {
        padding: 0.35rem 0.5rem;
        border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    }

    #user-input {
        font-size: 0.95rem;
        padding: 0.4rem;
    }

    .side-panel {
        position: fixed;
        right: -100%;
        top: 0;
        width: 100%;
        height: 100dvh;
        z-index: 101;
        background: hsla(var(--h), 20%, 10%, 0.98);
    }

    .side-panel.open {
        width: 100%;
        right: 0;
    }

    .side-panel-header {
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 0.5rem 0.75rem;
    }

    .logo-icon {
        display: none;
        /* Hide logo icon in sidebar on very small screens if screen is tight */
    }

    .sidebar-header .logo-wrapper {
        gap: 0.5rem;
    }

    .avatar {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
        border-radius: 8px;
    }

    .message.user {
        flex-direction: row;
    }

    .message.user .avatar {
        order: -1;
    }

    .content {
        padding: 0.75rem;
        line-height: 1.5;
    }

    #user-input {
        font-size: 0.95rem;
    }

    #send-btn {
        width: 34px;
        height: 34px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 400px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Custom Searchable Dropdown Styles */
.custom-select-wrapper {
    position: relative;
    width: 100%;
}

.model-search-input {
    background-color: transparent;
    border: none;
    border-bottom: 2px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 2rem 0.75rem 0.5rem;
    border-radius: 0;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
    width: 100%;
}

.model-search-input:hover {
    border-bottom-color: var(--text-secondary);
}

.model-search-input:focus,
.model-search-input.active {
    border-bottom-color: var(--primary-color);
    box-shadow: 0 1px 0 0 var(--primary-color);
    cursor: text;
}

.sidebar-selector {
    padding: 0.25rem;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-selector {
    opacity: 0;
    pointer-events: none;
}

.sidebar-selector label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sidebar-select .model-search-input {
    font-size: 0.85rem;
    padding: 0.5rem 1.5rem 0.5rem 0.25rem;
    border-bottom-width: 1px;
}

.custom-select-arrow {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.2s ease;
}

.custom-select-wrapper.open .custom-select-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--surface-color);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.2s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.custom-select-wrapper.open .custom-select-dropdown {
    max-height: 400px;
    opacity: 1;
}

.custom-select-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--glass-border);
}

.custom-select-search input {
    width: 100%;
    background: hsla(var(--h), 15%, 8%, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.custom-select-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.custom-select-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.custom-select-options::-webkit-scrollbar {
    width: 6px;
}

.custom-select-options::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-options::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.custom-select-option {
    padding: 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.15s ease;
    margin-bottom: 0.25rem;
}

.custom-select-option:hover {
    background: hsla(var(--h), 15%, 25%, 0.4);
    color: var(--text-primary);
}

.custom-select-option.selected {
    background: hsla(var(--accent-hsl), 0.2);
    color: var(--primary-color);
    font-weight: 500;
}

.custom-select-option.focused {
    background: hsla(var(--h), 15%, 25%, 0.3);
    outline: 1px solid var(--primary-color);
    outline-offset: -1px;
}

.custom-select-option[data-loading] {
    color: var(--text-muted);
    text-align: center;
    cursor: default;
}

.custom-select-option[data-loading]:hover {
    background: transparent;
}

.custom-select-option.hidden {
    display: none;
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    filter: brightness(1.1);
}

/* Auth Section Styles */
.auth-section {
    padding: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    background: hsla(var(--h), 15%, 20%, 0.4);
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.auth-btn:hover {
    background: hsla(var(--h), 15%, 25%, 0.5);
    border-color: var(--primary-color);
}

.auth-btn svg {
    flex-shrink: 0;
}

.sidebar.collapsed .auth-btn .nav-text {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

/* User Profile */
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar.collapsed .user-info {
    opacity: 0;
    width: 0;
}

.user-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed #logout-btn {
    margin-left: auto;
}

/* New Chat Button */
.new-chat-btn {
    background: linear-gradient(135deg, var(--primary-color), hsl(var(--h), 90%, 75%));
    color: white !important;
    border: none;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.new-chat-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Conversation List Section */
.conversation-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.section-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0 0.5rem 0.5rem;
}

.sidebar.collapsed .section-label {
    opacity: 0;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.conversation-list::-webkit-scrollbar {
    width: 4px;
}

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

.conversation-list::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item:hover {
    background: hsla(var(--h), 15%, 22%, 0.5);
    color: var(--text-primary);
}

.conversation-item.active {
    background: hsla(var(--h), 15%, 28%, 0.6);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px var(--glass-border);
}

.conversation-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar.collapsed .conversation-item span {
    opacity: 0;
    width: 0;
}

.conversation-item .delete-conv {
    margin-left: auto;
    opacity: 0;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.conversation-item:hover .delete-conv {
    opacity: 1;
}

.conversation-item .delete-conv:hover {
    background: rgba(255, 75, 75, 0.2);
    color: #ff4b4b;
}

.empty-conversations {
    text-align: center;
    padding: 1.5rem 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}