:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #f97316;
    --danger: #dc2626;
    --info: #0891b2;
    --dark: #1f2937;
    --light: #f9fafb;
    --sidebar-width: 280px;
    --header-height: 70px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif !important;
    background-color: #f3f4f6;
    color: var(--dark);
    margin: 0;
    padding: 0;
    direction: rtl;
}

/* === Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    position: fixed;
    right: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h4 {
    color: #fff;
    margin: 0;
    font-weight: 700;
}

.sidebar-header p {
    color: #94a3b8;
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0.25rem 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
    border-right: 3px solid transparent;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-right-color: var(--primary);
}

.sidebar-menu a.active {
    background-color: rgba(37, 99, 235, 0.15);
    color: #fff;
    border-right-color: var(--primary);
}

.sidebar-menu a i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-menu .menu-title {
    padding: 1rem 1.5rem 0.5rem;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* === Main Content === */
.main-content {
    margin-right: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* === Header === */
.app-header {
    background: #fff;
    height: var(--header-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-toggle {
    background: none;
    border: none;
    color: var(--dark);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* === Content Area === */
.content-area {
    padding: 2rem;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    margin: 0;
    color: var(--dark);
    font-weight: 700;
    font-size: 1.75rem;
}

.page-title i {
    color: var(--primary);
    margin-left: 0.5rem;
}

/* === Cards === */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.stat-card .stat-label {
    color: #64748b;
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

.stat-icon.bg-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.bg-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon.bg-warning { background: linear-gradient(135deg, #f97316, #ea580c); }
.stat-icon.bg-info    { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-icon.bg-purple  { background: linear-gradient(135deg, #a855f7, #9333ea); }
.stat-icon.bg-pink    { background: linear-gradient(135deg, #ec4899, #db2777); }

/* === Level Badges === */
.level-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
}

.level-PE { background: #dc2626; }
.level-E  { background: #ef4444; }
.level-D  { background: #f97316; }
.level-M  { background: #eab308; color: #1f2937; }
.level-EX { background: #16a34a; }

/* === Tables === */
.data-table {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.data-table table {
    margin: 0;
}

.data-table thead {
    background: #f8fafc;
}

.data-table thead th {
    color: #475569;
    font-weight: 600;
    border: none;
    padding: 1rem;
}

.data-table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* === Login Page === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 2rem 1rem;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 450px;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.login-title {
    text-align: center;
    color: var(--dark);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 2rem;
}

/* === Form === */
.form-control, .form-select {
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-label {
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
}

/* === Buttons === */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* === Responsive === */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .header-toggle {
        display: block;
    }
}

/* === Utilities === */
.cursor-pointer { cursor: pointer; }
.transition { transition: all 0.2s ease; }

/* === Pagination === */
.pagination {
    margin: 0;
    gap: 4px;
    flex-wrap: wrap;
}

.pagination .page-item .page-link {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
    transition: all 0.2s ease;
}

.pagination .page-item .page-link:hover {
    background-color: #f1f5f9;
    border-color: var(--primary);
    color: var(--primary);
    z-index: 1;
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.pagination .page-item.disabled .page-link {
    color: #cbd5e1;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

/* Pagination wrapper */
nav[role="navigation"] {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

nav[role="navigation"] p,
nav[role="navigation"] .text-sm {
    margin: 0;
    color: #64748b;
    font-size: 0.875rem;
}

/* Hide info text on small screens */
@media (max-width: 575.98px) {
    nav[role="navigation"] p {
        display: none;
    }
}