:root {
    --bg-color: #0d1117;
    --header-bg: #161b22;
    --user-bubble: #1f6feb;
    --ai-bubble: #21262d;
    --text-main: #ffffff;
    --text-muted: #8b949e;
    --input-bg: #0d1117;
    --border-color: #30363d;
    --accent: #58a6ff;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: background-color 0.3s;
}

/* Sidebar Toggle Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    padding: 0.5rem;
}

/* Sidebar Base */
.sidebar,
.admin-sidebar {
    width: 260px;
    background: var(--header-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    transition: width 0.3s ease, left 0.3s ease;
    overflow: hidden;
    flex-shrink: 0;
}

/* PC Collapsed State */
.sidebar.collapsed,
.admin-sidebar.collapsed {
    width: 72px;
}

.collapsed .sidebar-header,
.collapsed .sidebar-btn {
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
}

/* Hide labels when collapsed */
.collapsed .label-text {
    display: none !important;
}

.collapsed h2,
.collapsed h3 {
    display: none !important;
}

/* Sidebar Toggle Header */
.sidebar-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    min-height: 60px;
}

@media (max-width: 768px) {
    .sidebar-header {
        display: flex;
        min-height: auto;
        padding: 1.5rem 1rem;
    }

    .sidebar-header span:first-child {
        display: none;
        /* Hide the icon inside sidebar header on mobile */
    }
}

/* Buttons and Links */
.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    margin: 0.25rem 0;
    /* Remove horizontal margin for alignment */
    white-space: nowrap;
}

.sidebar-btn:hover {
    background: var(--ai-bubble);
}

.sidebar-footer {
    margin-top: auto;
    padding-bottom: 1rem;
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .menu-toggle {
        display: block !important;
    }

    /* On mobile, sidebar behaves like an overlay drawer */
    .sidebar,
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -260px;
        width: 260px;
        height: 100vh;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
        z-index: 1000;
    }

    .sidebar.active,
    .admin-sidebar.active {
        left: 0;
    }

    /* Main content stays full width on mobile */
    .main-chat,
    .admin-main {
        width: 100%;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Admin layout should not keep side-by-side flex on mobile */
    .admin-layout {
        display: block !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    /* Hide header toggle when sidebar is active to prevent overlap */
    .sidebar.active~.main-chat .menu-toggle,
    .admin-sidebar.active~.admin-main .menu-toggle {
        visibility: hidden;
    }
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
}

/* Quota Warning Banner */
.quota-warning {
    background-color: rgba(248, 81, 73, 0.9);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    display: none;
    width: 100%;
}
.quota-warning a {
    color: white;
    text-decoration: underline;
    margin-left: 0.5rem;
}