/* Global Scrollbar Reset */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

:root {
    /* Light Mode */
    --primary: #2B5CE6;
    --secondary: #6B7280;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --background: #FAFBFC;
    --surface: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.08);

    --radius-card: 16px;
    --radius-btn: 12px;
    --radius-input: 10px;
}

.dark {
    /* Dark Mode */
    --primary: #4F80FF;
    --secondary: #9CA3AF;
    --success: #34D399;
    --warning: #FBBF24;
    --error: #F87171;
    --background: #0F172A;
    --surface: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --border: #334155;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.25), 0 2px 6px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
    --shadow-premium: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.dark input,
.dark select,
.dark textarea {
    color-scheme: dark;
}

body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Transition for Theme Switching */
*,
::before,
::after {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

/* Exceptions: specifically for elements that need faster transforms (cards/buttons) */
.card,
.btn-primary,
.nav-item {
    transition-property: background-color, border-color, color, transform, box-shadow;
}

.card {
    background-color: var(--surface);
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border-radius: var(--radius-btn);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(43, 92, 230, 0.4);
    opacity: 0.95;
}

.btn-primary:active {
    transform: translateY(0);
}

.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.125);
}

.dark .glass {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-premium {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
}

.input-premium:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(43, 92, 230, 0.1);
    outline: none;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Base Layout Transitions */
.sidebar-transition {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-transition {
    transition: padding-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Specifics */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-btn);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
}

a {
    text-decoration: none;
}

.nav-item i {
    width: 1.5rem;
    font-size: 1.15rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item:hover {
    background-color: rgba(43, 92, 230, 0.05);
    color: var(--primary);
}

.dark .nav-item:hover {
    background-color: rgba(79, 128, 255, 0.1);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
}

.nav-item.active i {
    color: white;
}

/* Collapsed Sidebar State */
.sidebar-collapsed {
    width: 80px !important;
}

.sidebar-collapsed .nav-item span {
    display: none;
}

.sidebar-collapsed .nav-item i {
    margin-right: 0;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-collapsed .sidebar-header h1 {
    display: none;
}

.sidebar-collapsed .sidebar-header button {
    margin: 0 auto;
}

/* AppBar / Header Refinement */
.app-bar {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 40;
    transition: background-color 0.3s, border-color 0.3s;
}

.dark .app-bar {
    background-color: rgba(30, 41, 59, 0.8);
}

.profile-dropdown {
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}