/* ===== ROOT VARIABLES ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --danger-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --sidebar-width: 270px;
    --header-height: 65px;
    --sidebar-bg: #1a2332;
    --sidebar-hover: rgba(255,255,255,0.08);
    --sidebar-active: rgba(102, 126, 234, 0.25);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding-top: var(--header-height);
    min-height: 100vh;
    background: #f0f2f5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background 0.3s ease;
}

/* ===== TOP HEADER ===== */
.navbar {
    height: var(--header-height);
    background: #1a2332 !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.3);
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1050;
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff !important;
}
.navbar-brand i {
    color: #667eea;
}
#sidebarToggle {
    border: none;
    font-size: 1.3rem;
    color: #fff;
    background: transparent;
    padding: 8px 12px;
    border-radius: 8px;
    transition: 0.3s;
}
#sidebarToggle:hover {
    background: rgba(255,255,255,0.1);
}
.nav-link {
    color: rgba(255,255,255,0.8) !important;
    transition: 0.3s;
}
.nav-link:hover {
    color: #fff !important;
}
.nav-link .badge {
    font-size: 10px;
    padding: 3px 8px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--sidebar-bg);
    color: #fff;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1040;
    box-shadow: 2px 0 20px rgba(0,0,0,0.2);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}
.sidebar::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

/* Sidebar Header */
.sidebar-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.sidebar-header h5 i {
    color: #667eea;
}

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}
.sidebar-menu li {
    padding: 0;
}
.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 22px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: all 0.25s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    position: relative;
}
.sidebar-menu li a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: #667eea;
}
.sidebar-menu li a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: #667eea;
}
.sidebar-menu li a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #667eea;
}
.sidebar-menu li a i {
    width: 30px;
    font-size: 1.1rem;
    text-align: center;
    flex-shrink: 0;
    color: #667eea;
}
.sidebar-menu li a span {
    margin-left: 12px;
    white-space: nowrap;
}
.sidebar-menu li a .badge {
    margin-left: auto;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 50px;
}
.sidebar-menu li a.text-danger {
    color: #f5576c !important;
}
.sidebar-menu li a.text-danger i {
    color: #f5576c;
}
.sidebar-menu li a.text-danger:hover {
    background: rgba(245, 87, 108, 0.15) !important;
}

/* Sidebar Divider */
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 20px;
}
.sidebar-menu li strong {
    display: block;
    padding: 12px 22px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.25);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 0;
    padding: 20px 25px;
    min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.main-content.with-sidebar {
    margin-left: var(--sidebar-width);
}

/* ===== SIDEBAR COLLAPSED ===== */
.sidebar-collapsed .sidebar {
    margin-left: calc(var(--sidebar-width) * -1);
}
.sidebar-collapsed .main-content.with-sidebar {
    margin-left: 0;
}

/* ===== SIDEBAR OVERLAY (Mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}
.sidebar-overlay.show {
    display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(var(--sidebar-width) * -1);
        width: 280px;
    }
    .sidebar.show {
        margin-left: 0;
    }
    .main-content.with-sidebar {
        margin-left: 0;
        padding: 15px;
    }
    .navbar {
        padding: 0 12px;
    }
}

/* ===== CARDS ===== */
.card {
    border: none;
    border-radius: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    background: #fff;
}
.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-weight: 600;
    padding: 18px 22px;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 50px;
    padding: 10px 28px;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: #fff;
}
.btn-primary:hover {
    transform: scale(1.04);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    color: #fff;
}
.btn-success {
    background: var(--success-gradient);
    border: none;
    color: #fff;
}
.btn-success:hover {
    transform: scale(1.04);
    color: #fff;
}
.btn-danger {
    background: var(--danger-gradient);
    border: none;
    color: #fff;
}
.btn-danger:hover {
    transform: scale(1.04);
    color: #fff;
}

/* ===== FORMS ===== */
.form-control {
    border-radius: 10px;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    transition: 0.3s;
}
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.2);
}

/* ===== BADGES ===== */
.badge {
    padding: 5px 14px;
    border-radius: 50px;
    font-weight: 500;
}

/* ===== DROPDOWN ===== */
.dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    border-radius: 12px;
    padding: 8px 0;
}
.dropdown-item {
    padding: 10px 22px;
    transition: 0.2s;
}
.dropdown-item:hover {
    background: rgba(102, 126, 234, 0.08);
}
.dropdown-item i {
    width: 22px;
}

/* ===== GRADIENTS ===== */
.bg-gradient-primary {
    background: var(--primary-gradient);
}
.bg-gradient-success {
    background: var(--success-gradient);
}
.bg-gradient-danger {
    background: var(--danger-gradient);
}

/* ===== STATS CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}
.stat-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
}
.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
}
.stat-label {
    color: #6c757d;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ===== DARK MODE ===== */
.dark-mode {
    background: #14161a;
    color: #e8e8e8;
}
.dark-mode .card {
    background: #1e2229;
    color: #e8e8e8;
    border-color: rgba(255,255,255,0.05);
}
.dark-mode .card-header {
    border-bottom-color: rgba(255,255,255,0.06);
}
.dark-mode .form-control {
    background: #1e2229;
    color: #e8e8e8;
    border-color: #333;
}
.dark-mode .form-control:focus {
    background: #1e2229;
    color: #e8e8e8;
}
.dark-mode .sidebar {
    background: #0f1419;
}
.dark-mode .navbar {
    background: #0f1419 !important;
}
.dark-mode .dropdown-menu {
    background: #1e2229;
    color: #e8e8e8;
}
.dark-mode .dropdown-item {
    color: #e8e8e8;
}
.dark-mode .dropdown-item:hover {
    background: rgba(255,255,255,0.05);
}
.dark-mode .stat-card {
    background: #1e2229;
}
.dark-mode .stat-label {
    color: #aaa;
}
.dark-mode .table {
    color: #e8e8e8;
}
.dark-mode .table td,
.dark-mode .table th {
    border-color: rgba(255,255,255,0.05);
}
.dark-mode .text-muted {
    color: #aaa !important;
}
.dark-mode .sidebar-overlay {
    background: rgba(0,0,0,0.7);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #5a6fd6;
}
