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

/* Core Styles */
html {
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f9fafb;
    color: #1a202c;
    line-height: 1.5;
    min-height: 100vh;
}

/* Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    padding-top: 4rem; /* Adjusted to match navbar height */
}

/* Sidebar Core */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background-color: #1f2937;
    color: #cbd5e0;
    padding-top: 4rem;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    z-index: 40;
    transition: transform 0.3s ease-in-out;
}

/* Sidebar Sections */
.sidebar-profile {
    text-align: center;
    padding: 1.5rem 1rem;
    background-color: #374151;
    margin-bottom: 1rem;
}

.profile-image {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    object-fit: cover;
}

.profile-name {
    color: white;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.profile-email {
    color: #9CA3AF;
    font-size: 0.875rem;
}

/* Navigation Links */
.sidebar-nav {
    padding: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #a0aec0;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(4px);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-left: 4px solid #2563eb;
    padding-left: calc(1rem - 4px);
}

.nav-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    stroke: currentColor;
    stroke-width: 2;
}

/* Main Content */
.dashboard-main {
    flex: 1;
    padding: 1.5rem;
    transition: margin-left 0.3s ease-in-out;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 80%;
        max-width: 300px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 35;
    }

    #sidebar-overlay.active {
        display: block;
    }
}

@media (min-width: 1025px) {
    .sidebar {
        transform: translateX(0);
    }

    .dashboard-main {
        margin-left: 260px;
        padding: 2rem;
    }

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

/* Utility Classes */
.min-h-screen {
    min-height: 100vh;
}

.overflow-hidden {
    overflow: hidden;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #111827;
        color: #F9FAFB;
    }
}
    /* Smooth transition for theme changes */
    html.transitioning,
    html.transitioning * {
        transition: background-color 200ms, border-color 200ms, color 200ms !important;
    }

    .dark {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .dark .bg-white {
        background-color: #2d2d2d;
    }
    
    /* Smooth transitions */
    body, button, div, i {
        transition: background-color 0.3s ease, color 0.3s ease;
    }

/* =====================================================================
   DARK MODE (whole site) - applies when <body> has the "dark" class
   (toggled by the moon/sun button in the navbar).
   ===================================================================== */
body.dark {
    background: #111118 !important;   /* overrides the inline light gradient */
    color: #e5e7eb;
    color-scheme: dark;               /* native date pickers, scrollbars, selects */
}
.dark nav.fixed { background: rgba(22, 22, 32, 0.95) !important; }

/* Surfaces */
.dark .bg-white,
.dark .stats-card,
.dark .chart-container,
.dark .card { background: #1d1d28 !important; border-color: #33334a !important; }
.dark .bg-gray-50 { background-color: #232331 !important; }
.dark .bg-gray-100 { background-color: #2a2a3a !important; }
.dark .bg-gray-200 { background-color: #33334a !important; }
.dark .hover\:bg-gray-50:hover,
.dark .hover\:bg-gray-100:hover { background-color: #2c2c3d !important; }

/* Light colour tints -> translucent tints on dark */
.dark .bg-blue-50   { background-color: rgba(59,130,246,.12) !important; }
.dark .bg-blue-100  { background-color: rgba(59,130,246,.20) !important; }
.dark .bg-purple-50 { background-color: rgba(139,92,246,.12) !important; }
.dark .bg-purple-100{ background-color: rgba(139,92,246,.20) !important; }
.dark .bg-indigo-50 { background-color: rgba(99,102,241,.12) !important; }
.dark .bg-indigo-100{ background-color: rgba(99,102,241,.20) !important; }
.dark .bg-green-50  { background-color: rgba(34,197,94,.12) !important; }
.dark .bg-green-100 { background-color: rgba(34,197,94,.20) !important; }
.dark .bg-red-50    { background-color: rgba(239,68,68,.12) !important; }
.dark .bg-red-100   { background-color: rgba(239,68,68,.20) !important; }
.dark .bg-yellow-50 { background-color: rgba(234,179,8,.12) !important; }
.dark .bg-yellow-100{ background-color: rgba(234,179,8,.20) !important; }
.dark .bg-orange-50 { background-color: rgba(249,115,22,.12) !important; }
.dark .bg-orange-100{ background-color: rgba(249,115,22,.20) !important; }
.dark .bg-pink-50   { background-color: rgba(236,72,153,.12) !important; }
.dark .bg-pink-100  { background-color: rgba(236,72,153,.20) !important; }
.dark .hover\:bg-blue-100:hover   { background-color: rgba(59,130,246,.25) !important; }
.dark .hover\:bg-purple-100:hover { background-color: rgba(139,92,246,.25) !important; }
.dark .hover\:bg-green-100:hover  { background-color: rgba(34,197,94,.25) !important; }
.dark .hover\:bg-orange-100:hover { background-color: rgba(249,115,22,.25) !important; }
.dark .hover\:bg-purple-50:hover  { background-color: rgba(139,92,246,.18) !important; }
.dark .hover\:bg-red-50:hover     { background-color: rgba(239,68,68,.18) !important; }

/* Text */
.dark .text-black,
.dark .text-gray-900 { color: #f9fafb !important; }
.dark .text-gray-800 { color: #f3f4f6 !important; }
.dark .text-gray-700 { color: #e5e7eb !important; }
.dark .text-gray-600 { color: #b4b8c2 !important; }
.dark .text-gray-500 { color: #9ca3af !important; }
.dark .text-gray-400 { color: #8a8f9c !important; }
.dark .text-blue-900, .dark .text-blue-800, .dark .text-blue-700     { color: #93c5fd !important; }
.dark .text-purple-900, .dark .text-purple-800, .dark .text-purple-700 { color: #c4b5fd !important; }
.dark .text-indigo-900, .dark .text-indigo-800, .dark .text-indigo-700 { color: #a5b4fc !important; }
.dark .text-green-900, .dark .text-green-800, .dark .text-green-700   { color: #86efac !important; }
.dark .text-red-900, .dark .text-red-800, .dark .text-red-700         { color: #fca5a5 !important; }
.dark .text-yellow-900, .dark .text-yellow-800, .dark .text-yellow-700 { color: #fde047 !important; }
.dark .text-orange-900, .dark .text-orange-800, .dark .text-orange-700 { color: #fdba74 !important; }
.dark h1:not([class*="text-"]), .dark h2:not([class*="text-"]), .dark h3:not([class*="text-"]),
.dark h4:not([class*="text-"]), .dark label:not([class*="text-"]), .dark th:not([class*="text-"]),
.dark td:not([class*="text-"]) { color: #e5e7eb; }

/* Borders & dividers */
.dark .border-gray-100, .dark .border-gray-200, .dark .border-gray-300,
.dark .border-purple-100, .dark .border-purple-200 { border-color: #33334a !important; }
.dark .divide-gray-100 > * + *, .dark .divide-gray-200 > * + * { border-color: #2c2c3d !important; }

/* Form fields */
.dark input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]):not([type="range"]),
.dark select,
.dark textarea {
    background-color: #262634 !important;
    color: #f3f4f6 !important;
    border-color: #3d3d55 !important;
}
.dark input::placeholder, .dark textarea::placeholder { color: #7c8190 !important; }
.dark select option { background-color: #262634; color: #f3f4f6; }
.dark input[type="file"]::file-selector-button { background: #33334a; color: #f3f4f6; border: 0; }

/* Tables */
.dark table thead { background-color: #232331 !important; }
.dark tr.hover\:bg-gray-50:hover { background-color: #26263a !important; }

/* Added by the dark-mode clean-up script in base.html */
.dark .dk-surface { background-color: #1d1d28 !important; border-color: #33334a !important; }
.dark .dk-text { color: #e5e7eb !important; }
.dark .dk-nograd { background-image: none !important; }
.dark .dk-gradtext { background-image: linear-gradient(135deg, #c4b5fd 0%, #93c5fd 100%) !important; }
