:root {
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-muted: #95a5a6;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --header-bg: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --stat-card-bg: #ffffff;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f8f9fa;
    --primary: #3498db;
    --primary-hover: #2980b9;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #1abc9c;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121f;
    --text-primary: #f8f9fa;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-bg: #161625;
    --header-bg: rgba(18, 18, 31, 0.8);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.7);
    --stat-card-bg: #1c1c30;
    --dropdown-bg: #1e1e35;
    --dropdown-hover: #2a2a45;
    --primary: #1abc9c;
    --primary-hover: #16a085;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #11111e;
    color: #ecf0f1;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
}

.sidebar.collapsed {
    width: 80px;
}

[data-theme="dark"] .sidebar {
    background: #0d0d17;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.02), transparent);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
    padding: 25px 0;
    justify-content: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: opacity 0.3s;
}

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

.sidebar-brand i {
    font-size: 24px;
    color: var(--primary);
    min-width: 30px;
}

.sidebar-user {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.sidebar.collapsed .sidebar-user {
    margin: 10px 5px;
    padding: 15px 0;
    justify-content: center;
}

.sidebar.collapsed .sidebar-user .user-info,
.sidebar.collapsed .sidebar-user .user-name,
.sidebar.collapsed .sidebar-user .user-role {
    display: none;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #1abc9c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

.sidebar-nav {
    padding: 10px 15px;
}

.sidebar.collapsed .sidebar-nav {
    padding: 10px 5px;
}

.nav-section {
    padding: 15px 10px 8px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.4;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section {
    text-align: center;
    padding: 15px 0 8px;
}

.sidebar.collapsed .nav-section-title {
    display: none;
}

.sidebar.collapsed .nav-section::after {
    content: '...';
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(236, 240, 241, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 10px;
    margin-bottom: 4px;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    padding: 12px 0;
    justify-content: center;
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-item i {
    margin: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(26, 188, 156, 0.2) 0%, transparent 100%);
    color: var(--primary);
    position: relative;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

    .sidebar-toggle {
        display: block;
    }
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    opacity: 0.4;
}

/* Visibility Utilities */
.d-none {
    display: none !important;
}

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

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

@media (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }

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

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

@media (max-width: 992px) {
    .d-md-none {
        display: none !important;
    }

    .d-mobile-block {
        display: block !important;
    }
}

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed+.main-content {
    margin-left: 80px;
}

.navbar {
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.navbar-left,
.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
    display: none;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}

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

.breadcrumb-separator {
    color: var(--text-muted);
}

.search-form {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border-radius: 20px;
    padding: 5px 15px;
}

.search-input {
    border: none;
    background: none;
    padding: 8px;
    outline: none;
    color: var(--text-primary);
    width: 200px;
}

.search-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 16px;
}

.notification-btn,
.user-btn {
    background: none;
    border: 2px solid var(--border-color);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.notification-btn:hover,
.user-btn:hover {
    border-color: var(--primary);
}

.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
}

.user-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.navbar-notifications,
.navbar-user {
    position: relative;
}

.notification-dropdown,
.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--dropdown-bg);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    overflow: hidden;
    z-index: 1000;
}

.notification-dropdown.show,
.user-dropdown.show {
    display: block;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.notification-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h6 {
    font-size: 14px;
}

.notification-header a {
    color: var(--primary);
    text-decoration: none;
    font-size: 12px;
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--dropdown-hover);
}

.notification-item.unread {
    background: rgba(52, 152, 219, 0.1);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.notification-icon.info {
    background: rgba(52, 152, 219, 0.2);
}

.notification-icon.success {
    background: rgba(39, 174, 96, 0.2);
}

.notification-icon.warning {
    background: rgba(243, 156, 18, 0.2);
}

.notification-icon.danger {
    background: rgba(231, 76, 60, 0.2);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--dropdown-hover);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-content {
    background: var(--bg-secondary);
    padding: 0;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    background: rgba(255, 255, 255, 0.02);
    transition: background-color 0.2s;
}

.modal-header:hover {
    background: rgba(26, 188, 156, 0.05);
}

.modal-header:active {
    cursor: grabbing;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    pointer-events: none;
    /* Let clicks pass to the header for dragging */
}

.modal-content.dragging {
    cursor: grabbing;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
}

.modal-close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--danger);
    color: white;
    transform: rotate(90deg);
}

.content-area {
    padding: 1.5rem;
    flex: 1;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--stat-card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

[data-theme="dark"] .stat-card {
    background: linear-gradient(145deg, #1c1c30, #161625);
    border-left-width: 6px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card h4 {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card .icon {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 40px;
    opacity: 0.15;
}

.stat-card.blue {
    border-left-color: #3498db;
}

.stat-card.green {
    border-left-color: #27ae60;
}

.stat-card.orange {
    border-left-color: #f39c12;
}

.stat-card.red {
    border-left-color: #e74c3c;
}

.stat-card.teal {
    border-left-color: #1abc9c;
}

.stat-card.purple {
    border-left-color: #9b59b6;
}

.quick-access {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.quick-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--stat-card-bg);
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
}

.quick-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.quick-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.quick-icon.blue {
    background: rgba(52, 152, 219, 0.1);
}

.quick-icon.green {
    background: rgba(39, 174, 96, 0.1);
}

.quick-icon.orange {
    background: rgba(243, 156, 18, 0.1);
}

.quick-icon.red {
    background: rgba(231, 76, 60, 0.1);
}

.quick-info h5 {
    font-size: 16px;
    margin-bottom: 3px;
}

.quick-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.table tr:hover {
    background: var(--bg-primary);
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

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

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

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

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

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

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger);
}

.badge-info {
    background: rgba(26, 188, 156, 0.2);
    color: var(--info);
}

.badge-primary {
    background: rgba(52, 152, 219, 0.2);
    color: var(--primary);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

.module-placeholder {
    text-align: center;
    padding: 60px 20px;
}

.module-placeholder h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.module-placeholder p {
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page h1 {
    font-size: 120px;
    color: var(--danger);
    margin-bottom: 20px;
}

.error-page p {
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .main-content {
        margin-left: 0 !important;
    }

    .menu-toggle {
        display: block !important;
    }

    .search-form {
        display: none !important;
    }

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