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

:root {
    --primary-color: #0D47A1;
    --secondary-color: #1565C0;
    --tertiary-color: #42A5F5;
    --accent-color: #FFD54F;
    --bg-color: #F5F8FC;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(13, 71, 161, 0.05);
    
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --topbar-height: 70px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Main Content (Hide on Sidebar) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color); 
}
::-webkit-scrollbar-thumb {
    background: rgba(13, 71, 161, 0.3); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 71, 161, 0.6); 
}

/* Glassmorphism Classes */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 40px 0 rgba(13, 71, 161, 0.08);
    transform: translateY(-2px);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(13, 71, 161, 0.2);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    box-shadow: 0 6px 20px rgba(13, 71, 161, 0.3);
    transform: translateY(-1px);
}

.btn-accent {
    background-color: var(--accent-color);
    color: #333;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-accent:hover {
    background-color: #FBC02D;
    color: #000;
}

/* Sidebar Layout */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--primary-color);
    color: #fff;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

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

#sidebar .sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(0,0,0,0.1);
    font-weight: 700;
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
}

#sidebar .sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    list-style: none;
    margin: 0;
    
    /* Hide scrollbar for sidebar menu */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for sidebar menu (Chrome, Safari and Opera) */
#sidebar .sidebar-menu::-webkit-scrollbar {
    display: none;
}

#sidebar .sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
}

#sidebar .sidebar-menu li a i {
    font-size: 1.2rem;
    width: 30px;
    text-align: center;
    margin-right: 15px;
}

#sidebar .sidebar-menu li a:hover, #sidebar .sidebar-menu li a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-left: 4px solid var(--accent-color);
    transform: translateX(4px);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-logout {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    text-align: left;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
}
.btn-logout i {
    margin-right: 12px;
    font-size: 1.2rem;
}
.btn-logout:hover {
    background: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 1);
    color: #fff;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

#sidebar.collapsed .sidebar-footer {
    padding: 20px 10px;
}
#sidebar.collapsed .btn-logout span {
    display: none;
}
#sidebar.collapsed .btn-logout i {
    margin-right: 0;
    margin: 0 auto;
}

#sidebar.collapsed .sidebar-menu li a span {
    display: none;
}
#sidebar.collapsed .brand-text-expanded {
    display: none !important;
}
#sidebar.collapsed .brand-text-collapsed {
    display: flex !important;
    margin-left: -5px; /* adjust for centering without sidebar-menu paddings */
}
#sidebar.collapsed .sidebar-header {
    padding-left: 10px !important;
}

/* Main Content Area */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

#main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

/* Topbar */
#topbar {
    height: var(--topbar-height);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-toggle {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--primary-color);
    background: transparent;
    border: none;
}

/* Content Padding */
.page-content {
    padding: 30px;
    flex: 1;
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-color) 0%, #E3F2FD 100%);
}

.auth-card {
    width: 100%;
    max-width: 450px;
}

/* Forms */
.form-control {
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #ddd;
}
.form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(66, 165, 245, 0.25);
    border-color: var(--tertiary-color);
}
.modal-body .form-control {
    background-color: #ffffff;
}

/* Tables */
.table-glass {
    background: var(--glass-bg);
    border-radius: 12px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}
.table-glass thead th {
    background: var(--primary-color);
    color: #ffffff;
    border-bottom: none;
    font-weight: 600;
    padding: 15px;
    text-align: center;
}
.table-glass thead th:first-child {
    border-top-left-radius: 12px;
}
.table-glass thead th:last-child {
    border-top-right-radius: 12px;
}
.table-glass tbody tr:nth-child(even) {
    background-color: rgba(66, 165, 245, 0.05); /* very soft blue stripe */
}
.table-glass tbody tr:hover {
    background-color: rgba(66, 165, 245, 0.1);
}
.table-glass tbody td {
    vertical-align: middle;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(13, 71, 161, 0.05);
}

/* Hero Header */
.hero-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--tertiary-color) 100%);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(13, 71, 161, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-green {
    background: linear-gradient(135deg, #1b5e20 0%, #4caf50 100%);
    box-shadow: 0 10px 30px rgba(27, 94, 32, 0.2);
}

.hero-purple {
    background: linear-gradient(135deg, #4a148c 0%, #ab47bc 100%);
    box-shadow: 0 10px 30px rgba(74, 20, 140, 0.2);
}

.hero-orange {
    background: linear-gradient(135deg, #e65100 0%, #ffa726 100%);
    box-shadow: 0 10px 30px rgba(230, 81, 0, 0.2);
}

.hero-header::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.hero-header::before {
    content: '';
    position: absolute;
    right: 100px;
    bottom: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.hero-header h2 {
    font-weight: 700;
    margin-bottom: 5px;
    color: #fff !important; /* Override inline styles */
    position: relative;
    z-index: 2;
}

.hero-header p {
    margin-bottom: 0;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 2;
}

.hero-header .btn {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
}

.hero-header .btn:hover {
    background: #fff;
    color: var(--primary-color);
}

/* Modals */
.modal-content.glass-card {
    overflow: hidden;
    background: #ffffff;
}
.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    border-bottom: none !important;
}
.modal-header .modal-title {
    color: #fff !important;
}
.modal-header .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.mobile-open {
        transform: translateX(0);
    }
    #main-content {
        margin-left: 0 !important;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999; /* Just below sidebar (1000) */
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* Dark Mode Overrides */
[data-bs-theme="dark"] {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
[data-bs-theme="dark"] body {
    background-color: var(--bg-color);
    color: var(--text-main);
}
[data-bs-theme="dark"] .card, [data-bs-theme="dark"] .glass-card {
    background-color: var(--glass-bg) !important;
    border-color: var(--glass-border) !important;
    color: var(--text-main);
}
[data-bs-theme="dark"] .table {
    color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.05);
}
[data-bs-theme="dark"] .table thead th {
    background-color: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-main);
}
[data-bs-theme="dark"] .sidebar-menu li a {
    color: rgba(255, 255, 255, 0.7);
}
[data-bs-theme="dark"] .sidebar-menu li a:hover, [data-bs-theme="dark"] .sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
[data-bs-theme="dark"] .bg-white {
    background-color: #1e293b !important;
}
[data-bs-theme="dark"] .text-gray-800, [data-bs-theme="dark"] .text-dark {
    color: #f8fafc !important;
}
[data-bs-theme="dark"] .border-bottom, [data-bs-theme="dark"] .border-end {
    border-color: rgba(255, 255, 255, 0.1) !important;
}
[data-bs-theme="dark"] .modal-content {
    background-color: #1e293b;
    color: #f8fafc;
}
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f8fafc;
}
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus {
    background-color: rgba(0, 0, 0, 0.3);
    color: #f8fafc;
}
