:root {
    /* Colors - Clean Modern Theme */
    --primary: #4361ee;
    --primary-light: rgba(67, 97, 238, 0.08);
    --primary-glow: rgba(67, 97, 238, 0.25);
    --primary-dark: #3a0ca3;

    --sidebar-bg: #1e2235;
    --sidebar-text: #8892b0;
    --sidebar-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.07);
    --sidebar-active-bg: rgba(67, 97, 238, 0.18);
    --sidebar-section-text: #4a5580;

    --secondary: #64748b;
    --accent: #60a5fa;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Backgrounds */
    --bg-body: #eef2f9;
    --bg-card: #ffffff;
    --bg-input: #f8fafc;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Borders */
    --border-color: #e8edf5;
    --border-strong: #d5dce9;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.08);
    --shadow-card: 0 2px 12px rgba(67, 97, 238, 0.05), 0 1px 4px rgba(0, 0, 0, 0.05);

    /* Dimensions */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --sidebar-width: 248px;
    --header-height: 60px;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.2s;
}

ul {
    list-style: none;
}

/* ===== Layout ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    padding: 1.5rem;
    max-width: 1500px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--sidebar-text);
    border-right: none;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.35);
    flex-shrink: 0;
}

.sidebar-brand h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.2px;
    margin: 0;
    line-height: 1.2;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.625rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.nav-section {
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--sidebar-section-text);
    font-weight: 700;
    margin-bottom: 0.35rem;
    padding-left: 0.5rem;
    letter-spacing: 1.2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.845rem;
    transition: all 0.18s ease;
    margin-bottom: 1px;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    transition: height 0.2s ease;
}

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: #cbd5e1;
}

.nav-item:hover::before {
    height: 60%;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: #ffffff;
    font-weight: 600;
}

.nav-item.active::before {
    height: 65%;
    background: var(--primary);
}

.nav-item i {
    width: 1.1rem;
    font-size: 0.9rem;
    text-align: center;
    color: var(--sidebar-section-text);
    flex-shrink: 0;
}

.nav-item:hover i {
    color: #cbd5e1;
}

.nav-item.active i {
    color: var(--accent);
}

.sidebar-footer {
    padding: 0.875rem 1rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.2s;
}

.user-menu:hover {
    background: rgba(255, 255, 255, 0.08);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--sidebar-text);
    text-transform: capitalize;
}

.logout-btn {
    color: var(--text-muted);
    padding: 0.25rem;
}

.logout-btn:hover {
    color: var(--danger);
}

/* ===== Mobile Header ===== */
.mobile-header {
    height: 60px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
}

.mobile-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
}

/* ===== Components ===== */

/* Typography */
h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.15rem;
    letter-spacing: -0.3px;
}

.page-title {
    margin-bottom: 1.5rem;
}

.breadcrumb {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.25rem;
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.card-title {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(67, 97, 238, 0.25);
}

.btn-primary:hover {
    background: #3451d1;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.35);
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-body);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    /* border: 1px solid var(--border-color); */
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table th {
    background: #f8fafc;
    text-align: left;
    padding: 1rem 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--primary-light) !important;
}

.table tr:last-child td {
    border-bottom: none;
}

/* Pagination */
.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.25rem;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
    background: white;
}

.page-item:not(.active) .page-link:hover {
    background: var(--bg-body);
    border-color: var(--border-hover);
    color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.page-item.disabled .page-link {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
    cursor: not-allowed;
}

.page-item.disabled .page-link:hover {
    background: transparent !important;
    color: var(--text-muted) !important;
}

/* Badges */
.badge {
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--bg-body);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--primary);
}

.stat-card.success .stat-icon {
    background: #dcfce7;
    color: var(--success);
}

.stat-card.warning .stat-icon {
    background: #fef3c7;
    color: var(--warning);
}

.stat-card.danger .stat-icon {
    background: #fee2e2;
    color: var(--danger);
}

.stat-card.info .stat-icon {
    background: #e0f2fe;
    color: var(--info);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Avatars */
.avatar {
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
}

.avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.avatar-xl {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

/* Top Header Actions (Desktop) */
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 0.1rem;
}


/* ===== Alerts ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.alert-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #15803d;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

/* ===== Modal (Bootstrap Overrides) ===== */
.modal-content {
    border: none !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    color: white !important;
    border: none !important;
    padding: 1.25rem 1.5rem !important;
}

.modal-header .modal-title {
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    letter-spacing: -0.02em;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: all 0.2s;
}

.modal-header .btn-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem !important;
}

.modal-footer {
    background: #f8fafc !important;
    border-top: 1px solid var(--border-color) !important;
    padding: 1rem 1.5rem !important;
}

/* Premium Form Controls inside Modal */
.modal .form-control,
.modal .form-select {
    border-radius: var(--radius-md) !important;
    padding: 0.65rem 1rem !important;
    background-color: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 0.875rem !important;
    transition: all 0.2s ease !important;
}

.modal .form-control:focus,
.modal .form-select:focus {
    background-color: #ffffff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1) !important;
    outline: none !important;
}

.modal .form-label {
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    color: var(--text-secondary) !important;
    margin-bottom: 0.4rem !important;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Modal Helper classes */
.modal-lg {
    max-width: 800px !important;
}

.modal-xl {
    max-width: 1140px !important;
}

/* Custom Modal Animations */
.modal.fade .modal-dialog {
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.show .modal-dialog {
    transform: scale(1);
}

/* ===== Helper Classes ===== */
.text-danger {
    color: var(--danger) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.d-lg-none {
    display: none !important;
}

/* ===== Grid System ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.75rem;
    margin-left: -0.75rem;
}

.col,
[class*="col-"] {
    position: relative;
    width: 100%;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    .col-md-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .col-lg-2 {
        flex: 0 0 16.666667%;
        max-width: 16.666667%;
    }

    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
}

/* Utilities */
.h-100 {
    height: 100% !important;
}

.w-100 {
    width: 100% !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

/* Dashboard Layouts */
.dashboard-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* ===== Responsive Mobile ===== */
@media (max-width: 991px) {
    .d-lg-none {
        display: block !important;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 250px;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
    }

    .sidebar-close {
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.25rem;
        margin-left: auto;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .top-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .dashboard-main-grid {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-header .btn {
        width: 100%;
    }

    /* Make forms stacked on mobile */
    .row {
        display: block !important;
    }

    .col {
        width: 100% !important;
        margin-bottom: 1rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.quick-action-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    transition: all 0.2s;
    height: 100%;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: var(--primary);
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.quick-action-card:hover .quick-action-icon {
    background: var(--primary);
    color: white;
}

/* Empty State Polish */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Print */
@media print {

    .sidebar,
    .mobile-header,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0;
    }

    .card {
        border: none;
        box-shadow: none;
    }
}