:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --header-height: 60px;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --sidebar-bg: #ffffff;
    --sidebar-text: #495057;
    --sidebar-active: #4f46e5;
    --sidebar-hover: #f1f3f5;
    --sidebar-submenu-bg: #f8f9fa;
    --sidebar-brand-border: rgba(0, 0, 0, 0.06);
    --header-bg: #ffffff;
    --header-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --body-bg: #f5f6fa;
    --card-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    --border-color: #e8e8ef;
    --text-primary: #1e1e2d;
    --text-secondary: #6c757d;
    --transition-speed: 0.3s;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ========== AUTH PAGES (Split Screen) ========== */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
}

.auth-sidebar {
    width: 45%;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-sidebar::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 80%;
    height: 80%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.auth-sidebar::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
}

.auth-sidebar-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-testimonial {
    border-left: 3px solid rgba(255, 255, 255, 0.3);
    padding-left: 1.5rem;
}

.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.auth-form {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #f8f9fc;
}

.auth-form-inner {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.auth-form-inner form .form-control {
    border-radius: 10px;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    border: 1.5px solid #e5e7eb;
    transition: all 0.2s;
}

.auth-form-inner form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.auth-form-inner form .btn-primary {
    border-radius: 10px;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.auth-form-inner form .input-group-text {
    border-radius: 10px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
}

.auth-form-inner form .input-group .form-control {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.auth-form-inner form .input-group .input-group-text + .form-control {
    border-left: none;
}

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

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: all var(--transition-speed) ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-brand-border);
}

.sidebar-brand a {
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.sidebar .nav {
    padding: 0.75rem 0;
    list-style: none;
}

.sidebar .nav-item {
    margin: 2px 0;
    list-style: none;
}

.sidebar ul {
    list-style: none;
    padding-left: 0;
}

.sidebar .nav-link {
    padding: 0.65rem 1.5rem;
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-active);
    background: var(--sidebar-hover);
}

.sidebar .nav-link.active {
    color: var(--sidebar-active);
    background: rgba(79, 70, 229, 0.1);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar .nav-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}

.sidebar .nav-link .bi-chevron-down {
    margin-left: auto;
    transition: transform 0.3s;
    font-size: 0.75rem;
}

.sidebar .nav-link[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}

.sidebar .nav .sub-menu {
    padding-left: 3.25rem;
    background: var(--sidebar-submenu-bg);
}

.sidebar .nav .sub-menu .nav-link {
    font-size: 0.825rem;
    padding: 0.5rem 1rem 0.5rem 1.75rem;
    border-left: none;
}

.sidebar .nav .sub-menu .nav-link:hover {
    background: transparent;
    color: var(--text-primary);
}

.sidebar .nav .sub-menu .nav-link.active {
    background: transparent;
    color: var(--sidebar-active);
    border-left: none;
}

/* ========== SIDEBAR COLLAPSED ========== */
.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand {
    padding: 1.25rem 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-brand .brand-text,
.sidebar.collapsed .sidebar-brand a span {
    display: none;
}

.sidebar.collapsed .sidebar-brand a {
    justify-content: center;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-link .bi-chevron-down {
    display: none;
}

.sidebar.collapsed .nav-link {
    padding: 0.65rem 0;
    justify-content: center;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
    font-size: 1.3rem;
}

.sidebar.collapsed .nav .sub-menu {
    display: none;
}

.sidebar.collapsed .sidebar-nav {
    overflow-x: hidden;
}

/* ========== CONTENT WRAPPER ========== */
.content-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin var(--transition-speed) ease;
}

/* ========== HEADER ========== */
.main-header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: var(--header-shadow);
}

.main-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-header .header-left .toggle-sidebar {
    background: none;
    border: none;
    font-size: 1.35rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    display: none;
}

.main-header .header-left h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.main-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.main-header .header-right .btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.main-header .header-right .btn-icon:hover {
    background: var(--body-bg);
    color: var(--text-primary);
}

.main-header .header-right .btn-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    padding: 2px 5px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.header-user:hover {
    background: var(--body-bg);
}

.header-user .avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
}

.header-user .user-info {
    line-height: 1.2;
}

.header-user .user-info .name {
    font-size: 0.85rem;
    font-weight: 600;
}

.header-user .user-info .role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    padding: 1.5rem 0;
}

/* ========== CARDS ========== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0 !important;
}

.card-header .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
}

/* ========== STATS CARDS ========== */
.stats-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    position: relative;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.stats-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* ========== TABLES ========== */
.table {
    margin-bottom: 0;
    font-size: 0.85rem;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

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

.table-hover tbody tr:hover {
    background: rgba(79, 70, 229, 0.03);
}

.table .action-btns {
    display: flex;
    gap: 0.35rem;
}

.table .action-btns .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
}

/* ========== BUTTONS ========== */
.btn {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-xs {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* ========== FORMS ========== */
.form-label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-control.is-invalid, .form-select.is-invalid {
    border-color: #dc3545;
}

.invalid-feedback {
    font-size: 0.775rem;
    margin-top: 0.25rem;
}

.required::after {
    content: ' *';
    color: #dc3545;
}

/* ========== BADGES ========== */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    font-size: 0.75rem;
}

.badge.bg-soft-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge.bg-soft-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge.bg-soft-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge.bg-soft-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* ========== MODAL ========== */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    border-radius: 16px 16px 0 0;
}

.modal-header .modal-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 0 0 16px 16px;
}

.modal-header .btn-close {
    background-size: 0.8em;
}

/* ========== DROPDOWN ========== */
.dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
}

.dropdown-menu .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu .dropdown-item:hover {
    background: rgba(79, 70, 229, 0.05);
}

.dropdown-menu .dropdown-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

/* ========== DATA TABLE ========== */
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 8px;
    border: 1.5px solid var(--border-color);
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    background: var(--body-bg);
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1.5px solid var(--border-color);
    padding: 0.3rem 1.5rem 0.3rem 0.5rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dt-buttons {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dt-buttons .btn {
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    margin-right: 0.25rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-top: 1rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.dataTables_wrapper .dataTables_paginate .pagination {
    gap: 4px;
    flex-wrap: wrap;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item {
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.65rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 8px !important;
    border: 1.5px solid var(--bs-border-color, #dee2e6);
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #6c757d);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    margin: 0;
}

.dataTables_wrapper .dataTables_paginate .page-link:hover {
    background: var(--bs-tertiary-bg, #f1f3f5);
    border-color: var(--primary-color);
    color: var(--primary-color);
    z-index: 0;
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: #fff !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.dataTables_wrapper .dataTables_paginate .page-item.active .page-link:hover {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}

.dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--bs-body-bg, #fff);
    border-color: var(--bs-border-color, #dee2e6);
    color: var(--bs-secondary-color, #6c757d);
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link {
    background: var(--bs-body-bg, #212529);
    border-color: var(--bs-border-color, #495057);
    color: var(--bs-body-color, #adb5bd);
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-link:hover {
    background: var(--bs-tertiary-bg, #2b3035);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

html[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .page-item.disabled .page-link {
    background: var(--bs-body-bg, #212529);
    border-color: var(--bs-border-color, #495057);
    color: var(--bs-secondary-color, #6c757d);
}

/* ========== TABS ========== */
.nav-tabs .nav-link {
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 0;
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* ========== SWEETALERT ========== */
.swal2-popup {
    border-radius: 16px !important;
    font-family: 'Inter', sans-serif !important;
}

.swal2-title {
    font-weight: 600 !important;
}

.swal2-confirm {
    border-radius: 8px !important;
    font-weight: 500 !important;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state h6 {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

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

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

    .sidebar.collapsed .sidebar-brand {
        padding: 1.25rem 1.5rem;
        justify-content: flex-start;
    }

    .sidebar.collapsed .sidebar-brand .brand-text,
    .sidebar.collapsed .sidebar-brand a span {
        display: inline;
    }

    .sidebar.collapsed .nav-link {
        padding: 0.65rem 1.5rem;
        justify-content: flex-start;
    }

    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .nav-link .bi-chevron-down {
        display: inline;
    }

    .sidebar.collapsed .nav-link i {
        font-size: 1.15rem;
    }

    .sidebar.collapsed .nav .sub-menu {
        display: block;
    }

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

@media (min-width: 992px) {
    .content-wrapper {
        margin-left: var(--sidebar-width);
        transition: margin var(--transition-speed) ease;
    }

    .sidebar.collapsed + .content-wrapper,
    .sidebar.collapsed ~ .content-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }
}

@media (max-width: 767.98px) {
    .auth-card {
        padding: 1.5rem;
    }

    .main-header {
        padding: 0 1rem;
    }

    .header-user .user-info {
        display: none;
    }

    .card-body {
        padding: 1rem;
    }
}
