/* =============================================
   نظام إدارة المركز التعليمي - الأنماط الرئيسية
   Educational Center CRM - Main Styles
   ============================================= */

/* --- Design Tokens --- */
:root {
    --primary: #00416A;
    --primary-light: #006BAE;
    --primary-lighter: #BCE5FF;
    --primary-rgb: 0, 65, 106;
    --secondary: #36454F;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;

    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --bg-sidebar-hover: #16213e;
    --bg-sidebar-active: #00416A;

    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-light: #ffffff;
    --text-muted: #9ca3af;

    --border-color: #e2e8f0;
    --border-radius: 0.625rem;
    --border-radius-lg: 1rem;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 65px;

    --transition: all 0.3s ease;
  font-family: "IBM Plex Sans", sans-serif;
   --font-body: var(--font-family);
  font-optical-sizing: auto;
    font-weight: 400;
  font-style: normal;
  font-variation-settings:
    "wdth" 100;

}

/* --- Global Reset & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    direction: rtl;
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* =============================================
   PROFESSIONAL SIDEBAR - Premium Design 2025
   ============================================= */

/* Sidebar custom scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0d1117 0%, #10172a 50%, #0d1117 100%);
    color: var(--text-light);
    z-index: 1040;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255,255,255,0.05);
    box-shadow: -4px 0 30px rgba(0,0,0,0.4);
}

/* ── Brand Section ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-height: var(--header-height);
    position: relative;
    flex-shrink: 0;
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 18px;
    left: 18px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb),0.6), transparent);
}


.sidebar-brand-logo {
    height: 30px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    display: block;
}

@media (max-width: 991px) {
    .sidebar-brand-logo {
        height: 32px;
        max-width: 170px;
    }
}

@media (max-width: 575px) {
    .sidebar-brand-logo {
        height: 28px;
        max-width: 140px;
    }
}


/* ── Navigation ── */
.sidebar-nav {
    padding: 10px 0 6px;
    flex: 1;
}

.sidebar-nav-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 18px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.55);
    font-weight: 700;
    /* ── Sticky Headers ── */
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, #0d1117 60%, transparent 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 2px;
}

.sidebar-nav-label::before {
    content: '';
    width: 14px;
    height: 1px;
    background: rgba(255,255,255,0.18);
    flex-shrink: 0;
}

.sidebar-nav-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.06);
}

/* ── Accordion Groups ── */
.sidebar-grp-hdr {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}
.sidebar-grp-hdr::after { display: none; }
.sidebar-grp-hdr:hover { color: rgba(255,255,255,0.85); }
.sidebar-grp-hdr.open  { color: rgba(255,255,255,0.75); }

.sidebar-chevron {
    font-size: 10px;
    transition: transform 0.25s ease;
    flex-shrink: 0;
    margin-right: auto;
    opacity: 0.5;
}
.sidebar-grp-hdr.open .sidebar-chevron {
    transform: rotate(-90deg);
    opacity: 0.7;
}

.sidebar-grp-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
}
.sidebar-grp-body.open { max-height: 2000px; }

.sidebar-nav-item {
    list-style: none;
    padding: 0 10px;
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.55);
    transition: all 0.22s ease;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.sidebar-nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.sidebar-nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.92);
    transform: translateX(-2px);
}

.sidebar-nav-link:hover::before {
    opacity: 1;
}

.sidebar-nav-link.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb),0.35) 0%, rgba(var(--primary-rgb),0.15) 100%);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(var(--primary-rgb),0.25),
        0 4px 20px rgba(var(--primary-rgb),0.35),
        0 0 40px rgba(var(--primary-rgb),0.12),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.sidebar-nav-link.active::before {
    opacity: 1;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent);
}

.sidebar-nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, var(--primary-light), var(--primary));
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px rgba(var(--primary-rgb),0.7);
}

/* ── Icon Bubbles ── */
.sidebar-nav-link .nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.22s ease;
    position: relative;
}

.sidebar-nav-link:hover .nav-icon,
.sidebar-nav-link.active .nav-icon {
    transform: scale(1.08);
}

/* Icon color themes — Outline white by default, Fill white on hover/active */
.nav-icon.ic-blue,
.nav-icon.ic-emerald,
.nav-icon.ic-violet,
.nav-icon.ic-orange,
.nav-icon.ic-amber,
.nav-icon.ic-teal,
.nav-icon.ic-rose,
.nav-icon.ic-pink,
.nav-icon.ic-red,
.nav-icon.ic-indigo,
.nav-icon.ic-cyan,
.nav-icon.ic-lime,
.nav-icon.ic-sky,
.nav-icon.ic-slate,
.nav-icon.ic-primary {
    background: transparent;
    color: rgba(255,255,255,0.75);
    border: 1.5px solid rgba(255,255,255,0.3);
}

.sidebar-nav-link:hover .nav-icon,
.sidebar-nav-link.active .nav-icon {
    background: #ffffff;
    color: #0d2d73 !important;
    border-color: #ffffff;
    box-shadow: 0 3px 12px rgba(255,255,255,0.2);
}

/* ══════════════════════════════════════
   FEATURE 2 — Sidebar Search Bar
   ══════════════════════════════════════ */
.sidebar-search {
    padding: 10px 12px 6px;
    flex-shrink: 0;
}

.sidebar-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-search-icon {
    position: absolute;
    right: 11px;
    color: rgba(255,255,255,0.3);
    font-size: 13px;
    pointer-events: none;
    transition: color 0.2s;
}

.sidebar-search-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 8px 34px 8px 34px;
    color: rgba(255,255,255,0.85);
    font-size: 12.5px;
    font-family: inherit;
    direction: rtl;
    transition: all 0.22s ease;
    outline: none;
}

.sidebar-search-input::placeholder {
    color: rgba(255,255,255,0.25);
}

.sidebar-search-input:focus {
    background: rgba(255,255,255,0.1);
    border-color: rgba(var(--primary-rgb),0.5);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),0.12);
}

.sidebar-search-input:focus + .sidebar-search-icon,
.sidebar-search-wrap:focus-within .sidebar-search-icon {
    color: rgba(var(--primary-rgb),0.8);
}

.sidebar-search-clear {
    position: absolute;
    left: 8px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
    transition: color 0.2s;
}

.sidebar-search-clear:hover { color: rgba(255,255,255,0.7); }
.sidebar-search-clear.visible { display: flex; align-items: center; }

.sidebar-nav-item.search-hidden { display: none; }

.sidebar-no-results {
    text-align: center;
    padding: 20px 10px;
    color: rgba(255,255,255,0.25);
    font-size: 12px;
    display: none;
}
.sidebar-no-results.visible { display: block; }

/* ══════════════════════════════════════
   FEATURE 3 — Sidebar Collapse
   ══════════════════════════════════════ */
.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: absolute;
    left: 12px;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}

/* Collapsed state */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 10px;
}

.sidebar.collapsed .sidebar-brand-logo { display: none; }
.sidebar.collapsed .sidebar-collapse-btn { margin-right: 0; }
.sidebar.collapsed .sidebar-search { display: none; }
.sidebar.collapsed .sidebar-nav-label { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
.sidebar.collapsed .nav-text { display: none; }
.sidebar.collapsed .sidebar-user-info { display: none; }
.sidebar.collapsed .sidebar-logout-btn { margin-right: 0; margin-left: 0; }
.sidebar.collapsed .sidebar-user-card {
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding: 10px 6px;
}
.sidebar.collapsed .sidebar-nav-item { padding: 0 6px; }
.sidebar.collapsed .sidebar-nav-link {
    justify-content: center;
    padding: 9px 0;
    position: relative;
    overflow: visible;
}
.sidebar.collapsed .nav-icon { width: 38px; height: 38px; }
.sidebar.collapsed .badge { display: none; }

/* ── Tooltip on collapsed (RTL: tooltip appears to the LEFT = into content) ── */
.sidebar.collapsed .sidebar-nav-link::after {
    content: attr(data-label);
    position: fixed;
    right: var(--sidebar-collapsed);
    top: auto;
    transform: none;
    background: #1e293b;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    z-index: 9999;
    margin-right: 8px;
}

.sidebar.collapsed .sidebar-nav-link:hover::after {
    opacity: 1;
}

/* cancel active border-indicator when collapsed (conflicts with tooltip ::after) */
.sidebar.collapsed .sidebar-nav-link.active::after {
    content: attr(data-label);
    width: auto;
    height: auto;
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    top: auto;
    transform: none;
}

/* Main content shift when collapsed */
.main-header.sidebar-collapsed-header { right: var(--sidebar-collapsed); }
.main-content.sidebar-collapsed-content { margin-right: var(--sidebar-collapsed); }

/* ══════════════════════════════════════
   FEATURE 5 — Skeleton Loading
   ══════════════════════════════════════ */
@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.sidebar-skeleton {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #0d1117;
    z-index: 1041;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.sidebar-skeleton.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar-skeleton .sk-brand {
    height: 44px;
    border-radius: 12px;
    margin-bottom: 6px;
}

.sidebar-skeleton .sk-search {
    height: 36px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.sidebar-skeleton .sk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.sidebar-skeleton .sk-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
}

.sidebar-skeleton .sk-text {
    height: 14px;
    border-radius: 6px;
    flex: 1;
}

.sk-brand, .sk-search, .sk-icon, .sk-text {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 25%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.05) 75%
    );
    background-size: 400px 100%;
    animation: shimmer 1.4s infinite linear;
}

/* ── User Footer ── */
.sidebar-user-footer {
    flex-shrink: 0;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.2);
    position: relative;
}

.sidebar-user-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 12px;
    left: 12px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--primary-rgb),0.4), transparent);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 11px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    transition: all 0.22s ease;
    cursor: default;
}

.sidebar-user-card:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(var(--primary-rgb),0.35);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.38);
    white-space: nowrap;
    line-height: 1.3;
}

.sidebar-logout-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(239,68,68,0.12);
    border: none;
    color: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-logout-btn:hover {
    background: rgba(239,68,68,0.25);
    color: #fca5a5;
    transform: scale(1.08);
}

/* --- Header --- */
.main-header {
    position: fixed;
    top: 0;
    right: var(--sidebar-width);
    left: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.header-user:hover {
    background: var(--bg-body);
}

.header-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.header-user-info {
    text-align: right;
}

.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-user-role {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
}

/* --- Main Content --- */
.main-content {
    margin-right: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
    transition: var(--transition);
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.breadcrumb-custom {
    font-size: 13px;
    color: var(--text-secondary);
}

.breadcrumb-custom a {
    color: var(--primary);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* --- Stat Cards --- */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card-icon.primary {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

.stat-card-icon.success {
    background: rgba(25,135,84,0.1);
    color: var(--success);
}

.stat-card-icon.warning {
    background: rgba(255,193,7,0.15);
    color: #b8860b;
}

.stat-card-icon.danger {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

.stat-card-icon.info {
    background: rgba(13,202,240,0.1);
    color: #0aa2c0;
}

.stat-card-info h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.stat-card-info p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* --- Tables --- */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-toolbar {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
}

.table {
    margin-bottom: 0;
    font-size: 13px;
}

.table thead th {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: rgba(var(--primary-rgb), 0.03);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- Forms --- */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 10px 14px;
    font-size: 14px;
    transition: var(--transition);
    font-family: var(--font-family);
    background-color: var(--card-bg, #ffffff);
    color: var(--text-primary, #1e293b);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    font-family: var(--font-family);
    font-weight: 600;
    border-radius: var(--border-radius);
    padding: 8px 18px;
    font-size: 14px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

/* --- Badges --- */
.badge-stage {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary { background: rgba(var(--primary-rgb), 0.1); color: var(--primary); }
.badge-success-soft { background: rgba(25,135,84,0.1); color: var(--success); }
.badge-warning-soft { background: rgba(255,193,7,0.15); color: #b8860b; }
.badge-danger-soft { background: rgba(220,53,69,0.1); color: var(--danger); }
.badge-info-soft { background: rgba(13,202,240,0.1); color: #0aa2c0; }

/* --- Attendance Page --- */
.attendance-scanner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    color: white;
    box-shadow: var(--shadow-lg);
}

.scanner-icon {
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 48px;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.3); }
    70% { box-shadow: 0 0 0 20px rgba(255,255,255,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}

.scanner-input {
    max-width: 400px;
    margin: 0 auto;
}

.scanner-input .form-control {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 14px;
    border-radius: var(--border-radius);
}

.scanner-input .form-control::placeholder {
    color: rgba(255,255,255,0.6);
}

.scanner-input .form-control:focus {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.15);
}

.attendance-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 350px;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.attendance-record {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.attendance-record:hover {
    box-shadow: var(--shadow-sm);
}

.attendance-record .record-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.attendance-record .record-icon.check-in {
    background: rgba(25,135,84,0.1);
    color: var(--success);
}

.attendance-record .record-icon.check-out {
    background: rgba(220,53,69,0.1);
    color: var(--danger);
}

/* --- Login Page --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 32px;
    color: white;
}

.login-logo h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- Search Page --- */
.search-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    text-align: center;
    color: white;
    margin-bottom: 24px;
}

.search-hero h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.search-input-wrapper {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper .form-control {
    padding: 14px 20px 14px 50px;
    border-radius: 50px;
    border: none;
    font-size: 16px;
}

.search-input-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

@media (max-width: 640px) {
    .search-hero { padding: 24px 16px; }
    .search-hero h3 { font-size: 18px; }
    .search-input-wrapper .form-control { font-size: 14px; padding: 11px 16px 11px 44px; }
}

/* --- Settings --- */
.settings-nav .nav-link {
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
}

.settings-nav .nav-link.active {
    background: var(--primary);
    color: white;
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(110%);
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0,0,0,0.5);
    }
    .main-header {
        right: 0;
    }
    .main-content {
        margin-right: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        z-index: 1035;
    }
    .sidebar-overlay.show {
        display: block;
    }
    /* Compact nav items on mobile */
    .sidebar-nav-item { padding: 0 8px; }
    .sidebar-brand { padding: 16px 14px; }
    .sidebar-user-footer { padding: 10px 10px 14px; }

    /* ── Disable collapse on mobile — sidebar is off-canvas ── */
    .sidebar-collapse-btn { display: none !important; }
    .sidebar.collapsed {
        width: var(--sidebar-width) !important;
        transform: translateX(110%);
    }
    .sidebar.collapsed.show {
        transform: translateX(0) !important;
    }
    .sidebar.collapsed .sidebar-brand-logo { display: block !important; }
    .sidebar.collapsed .sidebar-search { display: block !important; }
    .sidebar.collapsed .sidebar-nav-label {
        opacity: 1 !important; height: auto !important;
        padding: 16px 18px 6px !important; margin: 0 !important;
        overflow: visible !important;
    }
    .sidebar.collapsed .nav-text { display: inline !important; }
    .sidebar.collapsed .sidebar-user-info { display: block !important; }
    .sidebar.collapsed .sidebar-user-card { justify-content: flex-start !important; padding: 10px 11px !important; }
    .sidebar.collapsed .sidebar-nav-item { padding: 0 8px !important; }
    .sidebar.collapsed .sidebar-nav-link { justify-content: flex-start !important; padding: 9px 12px !important; }
    .sidebar.collapsed .nav-icon { width: 34px !important; height: 34px !important; }
    .sidebar.collapsed .badge { display: inline-flex !important; }
    .main-header.sidebar-collapsed-header { right: 0 !important; }
    .main-content.sidebar-collapsed-content { margin-right: 0 !important; }
}

@media (max-width: 575px) {
    .main-content {
        padding: 16px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .stat-card {
        padding: 16px;
    }
    .stat-card-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    .stat-card-info h3 {
        font-size: 20px;
    }
    .table-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* =============================================
   SMART DASHBOARD — Customizable Widgets
   ============================================= */

/* ── Toolbar ── */
.dash-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.dash-toolbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.dash-customize-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.dash-customize-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),0.35);
    transform: translateY(-1px);
}

/* ── Widget Grids ── */
.dash-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dash-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

.dash-wide-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    margin-bottom: 20px;
    align-items: start;
}

.dash-wide  { grid-column: 1; }
.dash-narrow{ grid-column: 2; }

/* ── Widget base ── */
.dash-widget {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.dash-widget.widget-hidden {
    display: none !important;
}

/* ── Drag states ── */
.widget-ghost {
    opacity: 0.35;
    background: rgba(var(--primary-rgb), 0.08);
    border-radius: var(--border-radius-lg);
}

.widget-chosen {
    box-shadow: 0 8px 30px rgba(var(--primary-rgb), 0.2) !important;
}

.widget-dragging {
    opacity: 0.9;
    transform: rotate(1deg) scale(1.02);
    box-shadow: 0 16px 40px rgba(0,0,0,0.15) !important;
}

/* ── Hide button on cards ── */
.widget-hide-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.18s ease;
    line-height: 1;
    flex-shrink: 0;
}

.widget-hide-btn:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}

/* ── Stat card drag handle ── */
.stat-card {
    position: relative;
    cursor: grab;
}

.stat-card:active { cursor: grabbing; }

.stat-card .widget-hide-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.stat-card:hover .widget-hide-btn { opacity: 1; }

/* ── Restore Bar ── */
.dash-restore-bar {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* ── Customize Panel ── */
.dash-customize-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1060;
    transition: opacity 0.25s ease;
}

.dash-customize-overlay.open { display: block; }

.dash-customize-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-card);
    z-index: 1061;
    box-shadow: 4px 0 40px rgba(0,0,0,0.18);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dash-customize-panel.open {
    transform: translateX(0);
}

.dash-customize-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.dash-customize-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.dash-customize-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-customize-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
    font-size: 14px;
}

.dash-customize-close:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.dash-customize-hint {
    padding: 12px 20px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--bg-body);
    margin: 0;
    flex-shrink: 0;
}

.dash-widget-toggles {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dash-widget-toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.18s ease;
    gap: 10px;
}

.dash-widget-toggle-item:hover {
    border-color: rgba(var(--primary-rgb),0.3);
    background: rgba(var(--primary-rgb),0.04);
}

.dash-widget-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 0;
}

.dash-widget-toggle-info i {
    font-size: 16px;
    color: var(--primary);
    flex-shrink: 0;
}

/* ── Toggle Switch ── */
.dash-toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.dash-toggle-switch input { display: none; }

.dash-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 24px;
    transition: all 0.22s ease;
}

.dash-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    right: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.22s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.dash-toggle-switch input:checked + .dash-toggle-slider {
    background: var(--primary);
}

.dash-toggle-switch input:checked + .dash-toggle-slider::before {
    right: calc(100% - 21px);
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-wide-grid { grid-template-columns: 1fr; }
    .dash-narrow { grid-column: 1; }
}

@media (max-width: 768px) {
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .dash-cards-grid { grid-template-columns: 1fr; gap: 10px; }
    .dash-wide-grid { grid-template-columns: 1fr; gap: 10px; }
    .dash-toolbar-title { font-size: 15px; }
    .dash-customize-panel { width: 100%; max-width: 100%; }
}

@media (max-width: 480px) {
    .dash-stat-grid { grid-template-columns: 1fr; }
}

/* --- Utility --- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gap-grid { gap: 20px; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h5 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* --- Activity Timeline --- */
.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Toast Notification --- */
.toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
}

/* --- Print --- */
@media print {
    .sidebar, .main-header, .btn, .table-toolbar { display: none !important; }
    .main-content { margin: 0; padding: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   PAYMENTS PAGE — Professional Design
   ═══════════════════════════════════════════════════════════════ */

/* ── Hero ──────────────────────────────────────────────────────── */
.pay-hero {
    background: linear-gradient(135deg, #0d1b3e 0%, #0a2a6e 50%, #0d3b7a 100%);
    border-radius: 16px;
    padding: 28px 32px 22px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}
.pay-hero::before {
    content: '';
    position: absolute;
    top: -60px; left: -60px;
    width: 250px; height: 250px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.pay-hero::after {
    content: '';
    position: absolute;
    bottom: -80px; right: -40px;
    width: 300px; height: 300px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}
.pay-hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}
.pay-hero-title {
    display: flex;
    align-items: center;
    gap: 16px;
}
.pay-hero-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    backdrop-filter: blur(10px);
}
.pay-hero h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}
.pay-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}
.pay-breadcrumb a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: color .2s;
}
.pay-breadcrumb a:hover { color: #fff; }
.pay-breadcrumb i { font-size: 10px; }

.pay-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #0a2a6e;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.pay-add-btn:hover {
    background: #f0f4ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* ── Filter Bar ───────────────────────────────────────────────── */
.pay-filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}
.pay-filter-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 160px;
}
.pay-filter-item label {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    font-weight: 600;
}
.pay-filter-input {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 9px;
    padding: 8px 12px;
    color: #fff;
    font-size: 13px;
    font-family: 'Cairo', sans-serif;
    outline: none;
    transition: all .2s;
    width: 100%;
}
.pay-filter-input option { background: #0d1b3e; color: #fff; }
.pay-filter-input:focus {
    border-color: rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.18);
}
.pay-filter-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 9px;
    padding: 8px 20px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    white-space: nowrap;
}
.pay-filter-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.pay-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
@media (max-width: 991px) { .pay-stats-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575px) { .pay-stats-row { grid-template-columns: 1fr; } }

.pay-stat-card {
    border-radius: 16px;
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform .2s, box-shadow .2s;
}
.pay-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.pay-stat-green  { background: linear-gradient(135deg, #1a7a4a, #22a05a); color: #fff; }
.pay-stat-blue   { background: linear-gradient(135deg, #0a2a6e, #1a4bc4); color: #fff; }
.pay-stat-red    { background: linear-gradient(135deg, #8b1a2a, #c62535); color: #fff; }
.pay-stat-purple { background: linear-gradient(135deg, #4a1270, #7b2fbe); color: #fff; }

.pay-stat-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.pay-stat-body { flex: 1; }
.pay-stat-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
    color: #fff;
}
.pay-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,0.8);
    margin-top: 3px;
}
.pay-stat-wave {
    position: absolute;
    bottom: -18px; left: -10px;
    width: 120px; height: 80px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

/* ── Progress Ring ────────────────────────────────────────────── */
.pay-stat-ring-wrap {
    position: relative;
    display: flex; align-items: center; justify-content: center;
}
.pay-ring {
    width: 52px; height: 52px;
    transform: rotate(-90deg);
}
.pay-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 3;
}
.pay-ring-fill {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray .6s ease;
}
.pay-ring-pct {
    position: absolute;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
}

/* ── Tabs ─────────────────────────────────────────────────────── */
.pay-tabs-wrap {
    margin-bottom: 20px;
}
.pay-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    width: fit-content;
}
.pay-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.pay-tab:hover { background: var(--bg-body); color: var(--text-primary); }
.pay-tab.active {
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.12), rgba(var(--primary-rgb),.06));
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb),.15);
}
.pay-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 20px;
    background: rgba(var(--primary-rgb),.12);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}
.pay-tab-badge-red {
    background: rgba(220,53,69,.12);
    color: #dc3545;
}
.pay-tab-content { display: none; }
.pay-tab-content.active { display: block; }

/* ── Table Card ───────────────────────────────────────────────── */
.pay-table-card {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}
.pay-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
}
.pay-table-title {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.pay-table-search-wrap {
    position: relative;
}
.pay-table-search-icon {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    right: 12px;
    color: var(--text-muted);
    font-size: 14px;
}
.pay-table-search {
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    padding: 8px 36px 8px 14px;
    font-size: 13px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    outline: none;
    width: 220px;
    transition: border-color .2s;
}
.pay-table-search:focus { border-color: var(--primary); }

/* ── Table ────────────────────────────────────────────────────── */
.pay-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.pay-table thead tr {
    background: var(--bg-body);
    border-bottom: 2px solid var(--border-color);
}
.pay-table thead th {
    padding: 13px 16px;
    font-weight: 700;
    font-size: 12.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.pay-table tbody tr {
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background .15s;
}
.pay-table tbody tr:hover { background: rgba(var(--primary-rgb),.03); }
.pay-table tbody td { padding: 12px 16px; vertical-align: middle; }
.pay-table tfoot td { padding: 13px 16px; }
.pay-row-num { color: var(--text-muted); font-size: 12px; }
.pay-date { color: var(--text-secondary); font-size: 13px; }

.pay-student-cell { display: flex; align-items: center; gap: 10px; }
.pay-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.15), rgba(var(--primary-rgb),.25));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}
.pay-student-name { font-weight: 600; color: var(--text-primary); }
.pay-student-grade { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.pay-amount {
    font-weight: 800;
    color: #1a7a4a;
    font-size: 14px;
}
.pay-month-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(var(--primary-rgb),.1);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}
.pay-method {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
}
.pay-method-cash     { background: rgba(25,135,84,.12);  color: #198754; }
.pay-method-card     { background: rgba(10,42,110,.12);  color: #0a2a6e; }
.pay-method-transfer { background: rgba(13,202,240,.12); color: #0dcaf0; }
.pay-method-other    { background: rgba(108,117,125,.12);color: #6c757d; }

.pay-actions { display: flex; gap: 6px; align-items: center; }
.pay-action-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
}
.pay-action-print  { background: rgba(13,202,240,.12); color: #0dcaf0; }
.pay-action-edit   { background: rgba(var(--primary-rgb),.1); color: var(--primary); }
.pay-action-delete { background: rgba(220,53,69,.1); color: #dc3545; }
.pay-action-btn:hover { filter: brightness(0.85); transform: scale(1.1); }

.pay-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.pay-empty i { font-size: 40px; }

/* ── Summary Table total row ──────────────────────────────────── */
.pay-summary-total td {
    background: rgba(var(--primary-rgb),.05);
    border-top: 2px solid rgba(var(--primary-rgb),.15);
}

/* ── Progress bars (summary tab) ──────────────────────────────── */
.pay-progress-wrap {
    display: flex; align-items: center; gap: 10px;
}
.pay-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-body);
    border-radius: 10px;
    overflow: hidden;
}
.pay-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 10px;
    transition: width .5s ease;
}
.pay-progress-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 34px;
}

/* ── Unpaid grid ──────────────────────────────────────────────── */
.pay-unpaid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    padding: 20px;
}
.pay-unpaid-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-body);
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    transition: all .2s;
}
.pay-unpaid-card:hover {
    border-color: rgba(220,53,69,.3);
    box-shadow: 0 4px 14px rgba(220,53,69,.08);
}
.pay-unpaid-avatar {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: rgba(220,53,69,.12);
    color: #dc3545;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
}
.pay-unpaid-info { flex: 1; min-width: 0; }
.pay-unpaid-name {
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pay-unpaid-meta {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    flex-wrap: wrap;
}
.pay-quick-btn {
    background: linear-gradient(135deg, #1a7a4a, #22a05a);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    transition: all .2s;
    flex-shrink: 0;
}
.pay-quick-btn:hover { filter: brightness(1.1); transform: scale(1.04); }

.pay-all-paid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}
.pay-all-paid-icon {
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(25,135,84,.12);
    color: #198754;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
}
.pay-all-paid h4 { margin: 0; font-weight: 700; color: #198754; }
.pay-all-paid p { margin: 0; font-size: 14px; }

/* ── Modal ────────────────────────────────────────────────────── */
.pay-modal { border: none; border-radius: 18px; overflow: hidden; }
.pay-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    background: linear-gradient(135deg, #0d1b3e 0%, #0a2a6e 100%);
    position: relative;
}
.pay-modal-header-edit {
    background: linear-gradient(135deg, #2d1b00 0%, #7a4400 100%);
}
.pay-modal-icon {
    width: 46px; height: 46px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    flex-shrink: 0;
}
.pay-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}
.pay-modal-sub { font-size: 12.5px; color: rgba(255,255,255,0.7); margin-top: 2px; }
.pay-modal-close {
    margin-right: auto;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.pay-modal-close:hover { background: rgba(255,255,255,0.25); }

.pay-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.pay-input, .pay-select {
    width: 100%;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 13.5px;
    font-family: 'Cairo', sans-serif;
    color: var(--text-primary);
    background: var(--bg-body);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.pay-input:focus, .pay-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.1);
    background: #fff;
}
.pay-input-group {
    display: flex;
    align-items: center;
}
.pay-input-group .pay-input { border-radius: 10px 0 0 10px; border-left: none; }
.pay-input-suffix {
    background: var(--bg-body);
    border: 1.5px solid var(--border-color);
    border-right: none;
    border-radius: 0 10px 10px 0;
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pay-method-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.pay-method-opt { cursor: pointer; }
.pay-method-opt input[type="radio"] { display: none; }
.pay-method-opt span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-body);
    transition: all .2s;
}
.pay-method-opt input:checked + span {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb),.08);
    color: var(--primary);
}
.pay-method-opt:hover span { border-color: var(--primary); }

/* ── Smart Student Search ─────────────────────────────────────── */
.pay-student-search-wrap {
    position: relative;
}
.pay-student-search-icon {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    right: 13px;
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}
.pay-student-search-input {
    padding-right: 38px !important;
    padding-left: 36px !important;
}
.pay-student-clear {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    left: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color .2s;
}
.pay-student-clear:hover { color: #dc3545; }

.pay-student-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0; left: 0;
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 260px;
    overflow-y: auto;
}
.pay-student-dropdown.open { display: block; }
.pay-student-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background .15s;
}
.pay-student-dd-item:hover { background: rgba(var(--primary-rgb),.06); }
.pay-student-dd-item:first-child { border-radius: 10px 10px 0 0; }
.pay-student-dd-item:last-child  { border-radius: 0 0 10px 10px; }
.pay-student-dd-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.15), rgba(var(--primary-rgb),.25));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 800;
    flex-shrink: 0;
}
.pay-student-dd-name { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.pay-student-dd-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.pay-student-dd-empty {
    padding: 16px 14px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.pay-student-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(var(--primary-rgb),.06);
    border: 1.5px solid rgba(var(--primary-rgb),.2);
    border-radius: 12px;
    padding: 10px 14px;
}
.pay-student-selected-avatar {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb),.2), rgba(var(--primary-rgb),.35));
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800;
    flex-shrink: 0;
}
.pay-student-selected-info { flex: 1; }
.pay-student-selected-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.pay-student-selected-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pay-student-selected-clear {
    background: rgba(220,53,69,.1);
    border: none;
    border-radius: 8px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    color: #dc3545;
    font-size: 14px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.pay-student-selected-clear:hover { background: rgba(220,53,69,.2); }

.pay-edit-alert {
    background: rgba(255,152,0,.1);
    border: 1px solid rgba(255,152,0,.25);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #e65100;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
}
.pay-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-body);
}
.pay-modal-cancel {
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 9px 22px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.pay-modal-cancel:hover { border-color: #aaa; color: var(--text-primary); }
.pay-modal-submit {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 9px 24px;
    font-size: 13.5px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb),.3);
}
.pay-modal-submit:hover { filter: brightness(1.08); transform: translateY(-1px); }
.pay-modal-submit:disabled { opacity: .7; cursor: not-allowed; transform: none; }
.pay-modal-submit-edit {
    background: linear-gradient(135deg, #7a4400, #d97706);
    box-shadow: 0 4px 14px rgba(217,119,6,.3);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 767px) {
    .pay-hero { padding: 20px 18px 18px; }
    .pay-hero h1 { font-size: 18px; }
    .pay-tabs { flex-wrap: wrap; }
    .pay-table-search { width: 160px; }
    .pay-unpaid-grid { grid-template-columns: 1fr; }
    .pay-filter-bar { gap: 8px; }
    .pay-filter-item { min-width: 130px; }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Professional Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables Override ── */
[data-theme="dark"] {
    --bg-body:          #0f1117;
    --bg-card:          #1a1d27;
    --bg-sidebar:       #0d1117;
    --bg-sidebar-hover: #161b2e;
    --border-color:     #2a2d3e;
    --text-primary:     #e2e8f0;
    --text-secondary:   #94a3b8;
    --text-muted:       #64748b;
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:        0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg:        0 10px 30px rgba(0,0,0,0.6);
    color-scheme: dark;
}

/* ── Base ── */
[data-theme="dark"] body { background-color: var(--bg-body); color: var(--text-primary); }
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,
[data-theme="dark"] h4,[data-theme="dark"] h5,[data-theme="dark"] h6 { color: var(--text-primary); }

/* ── Header ── */
[data-theme="dark"] .main-header { background: #1a1d27; border-bottom-color: #2a2d3e; }
[data-theme="dark"] .header-title { color: var(--text-primary); }
[data-theme="dark"] .header-user:hover { background: #232637; }
[data-theme="dark"] .header-user-name { color: var(--text-primary); }
[data-theme="dark"] .header-user-role { color: var(--text-secondary); }

/* ── Cards ── */
[data-theme="dark"] .card { background: #1a1d27 !important; border-color: #2a2d3e !important; color: var(--text-primary); }
[data-theme="dark"] .card-header { background: #1e2130 !important; border-bottom-color: #2a2d3e !important; color: var(--text-primary); }
[data-theme="dark"] .card-footer { background: #1e2130 !important; border-top-color: #2a2d3e !important; }
[data-theme="dark"] .card-body { color: var(--text-primary); }
[data-theme="dark"] .stat-card { background: #1a1d27 !important; border-color: #2a2d3e !important; }
[data-theme="dark"] .stat-card-info h3 { color: var(--text-primary); }
[data-theme="dark"] .stat-card-info p { color: var(--text-secondary); }
[data-theme="dark"] .table-container { background: #1a1d27 !important; border-color: #2a2d3e !important; }
[data-theme="dark"] .content-card { background: #1a1d27 !important; border-color: #2a2d3e !important; }

/* ── Dashboard Widgets ── */
[data-theme="dark"] .dash-widget .card { background: #1a1d27 !important; border-color: #2a2d3e !important; }
[data-theme="dark"] .dash-customize-panel { background: #1a1d27; }
[data-theme="dark"] .dash-customize-hint { background: #13151f; color: var(--text-secondary); }
[data-theme="dark"] .dash-customize-close:hover { background: rgba(220,53,69,0.2); border-color: rgba(220,53,69,0.3); }
[data-theme="dark"] .dash-toggle-slider { background: #3a3f55; }
[data-theme="dark"] .dash-widget-toggle-item { background: #1e2130; border-color: #2a2d3e; }
[data-theme="dark"] .dash-restore-bar { background: linear-gradient(135deg, #1a1d27, #13151f); }

/* ── Tables ── */
[data-theme="dark"] .table { color: var(--text-primary); border-color: #2a2d3e; --bs-table-bg: transparent; --bs-table-color: var(--text-primary); }
[data-theme="dark"] .table > :not(caption) > * > * { color: var(--text-primary); background-color: transparent; border-bottom-color: #2a2d3e; }
[data-theme="dark"] .table thead th, [data-theme="dark"] .table > thead > tr > th { background: #232637 !important; color: var(--text-secondary) !important; border-color: #2a2d3e !important; }
[data-theme="dark"] .table tbody tr:hover > td { background: rgba(255,255,255,0.03) !important; }
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255,255,255,0.02) !important; color: var(--text-primary) !important; }
[data-theme="dark"] .table-toolbar { background: #1a1d27; border-bottom-color: #2a2d3e; }
[data-theme="dark"] td, [data-theme="dark"] th { color: var(--text-primary); }

/* ── Bootstrap bg-* overrides ── */
[data-theme="dark"] .bg-white   { background-color: #1a1d27 !important; }
[data-theme="dark"] .bg-light   { background-color: #232637 !important; color: var(--text-primary) !important; }
[data-theme="dark"] .bg-body    { background-color: var(--bg-body) !important; }
[data-theme="dark"] .text-dark  { color: var(--text-primary) !important; }
[data-theme="dark"] .text-black { color: var(--text-primary) !important; }
[data-theme="dark"] .text-muted { color: var(--text-secondary) !important; }
[data-theme="dark"] .text-body  { color: var(--text-primary) !important; }
[data-theme="dark"] .stat-label { color: var(--text-secondary) !important; }

/* ── Borders ── */
[data-theme="dark"] .border         { border-color: #2a2d3e !important; }
[data-theme="dark"] .border-bottom  { border-bottom-color: #2a2d3e !important; }
[data-theme="dark"] .border-top     { border-top-color: #2a2d3e !important; }
[data-theme="dark"] .border-start   { border-inline-start-color: #2a2d3e !important; }
[data-theme="dark"] .border-end     { border-inline-end-color: #2a2d3e !important; }
[data-theme="dark"] hr              { border-color: #2a2d3e; opacity: 1; }

/* ── Form Controls ── */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select   { background-color: #232637; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus { background-color: #2a2d3e; border-color: var(--primary-light); color: var(--text-primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.2); }
[data-theme="dark"] .form-control::placeholder { color: #4a5568; }
[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled { background-color: #13151f; color: var(--text-muted); }
[data-theme="dark"] .form-label { color: var(--text-primary); }
[data-theme="dark"] .form-text  { color: var(--text-secondary); }
[data-theme="dark"] .form-check-input { background-color: #232637; border-color: #3a3f55; }
[data-theme="dark"] .form-check-label { color: var(--text-primary); }
[data-theme="dark"] .input-group-text { background: #232637; border-color: #2a2d3e; color: var(--text-secondary); }

/* ── Buttons ── */
[data-theme="dark"] .btn-light        { background: #232637; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .btn-light:hover  { background: #2a2d3e; border-color: #3a3f55; color: var(--text-primary); }
[data-theme="dark"] .btn-outline-secondary { border-color: #3a3f55; color: var(--text-secondary); }
[data-theme="dark"] .btn-outline-secondary:hover { background: #232637; color: var(--text-primary); }
[data-theme="dark"] .btn-outline-primary { border-color: var(--primary-light); color: var(--primary-light); }
[data-theme="dark"] .btn-outline-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Dropdowns ── */
[data-theme="dark"] .dropdown-menu     { background: #1e2130; border-color: #2a2d3e; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
[data-theme="dark"] .dropdown-item     { color: var(--text-primary); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .dropdown-divider  { border-color: #2a2d3e; opacity: 1; }
[data-theme="dark"] .dropdown-header   { color: var(--text-muted); }

/* ── Modals ── */
[data-theme="dark"] .modal-content  { background: #1a1d27; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .modal-header   { background: #1e2130; border-bottom-color: #2a2d3e; }
[data-theme="dark"] .modal-footer   { background: #1e2130; border-top-color: #2a2d3e; }
[data-theme="dark"] .modal-title    { color: var(--text-primary); }
[data-theme="dark"] .btn-close      { filter: invert(1) brightness(0.7); }

/* ── List Groups ── */
[data-theme="dark"] .list-group-item { background: #1a1d27; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .list-group-item:hover { background: #232637; }
[data-theme="dark"] .list-group-item.active { background: var(--primary); border-color: var(--primary); }

/* ── Nav Tabs ── */
[data-theme="dark"] .nav-tabs          { border-bottom-color: #2a2d3e; }
[data-theme="dark"] .nav-tabs .nav-link { color: var(--text-secondary); }
[data-theme="dark"] .nav-tabs .nav-link:hover { color: var(--text-primary); border-color: #2a2d3e; }
[data-theme="dark"] .nav-tabs .nav-link.active { background: #1a1d27; border-color: #2a2d3e #2a2d3e #1a1d27; color: var(--text-primary); }

/* ── Badges (soft variants) ── */
[data-theme="dark"] .badge-warning-soft { background: rgba(255,193,7,0.15);  color: #fde047; }
[data-theme="dark"] .badge-info-soft    { background: rgba(13,202,240,0.15); color: #67e8f9; }
[data-theme="dark"] .badge-success-soft { background: rgba(25,135,84,0.15);  color: #86efac; }
[data-theme="dark"] .badge-danger-soft  { background: rgba(220,53,69,0.15);  color: #fca5a5; }

/* ── Alerts ── */
[data-theme="dark"] .alert-info    { background: rgba(13,202,240,.1);  border-color: rgba(13,202,240,.2);  color: #67e8f9; }
[data-theme="dark"] .alert-warning { background: rgba(255,193,7,.1);   border-color: rgba(255,193,7,.2);   color: #fde047; }
[data-theme="dark"] .alert-danger  { background: rgba(220,53,69,.1);   border-color: rgba(220,53,69,.2);   color: #fca5a5; }
[data-theme="dark"] .alert-success { background: rgba(25,135,84,.1);   border-color: rgba(25,135,84,.2);   color: #86efac; }
[data-theme="dark"] .alert-secondary { background: #232637; border-color: #2a2d3e; color: var(--text-secondary); }

/* ── Pagination ── */
[data-theme="dark"] .page-link { background: #1a1d27; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .page-link:hover { background: #232637; color: var(--text-primary); }
[data-theme="dark"] .page-item.disabled .page-link { background: #13151f; color: var(--text-muted); }

/* ── Accordion ── */
[data-theme="dark"] .accordion-item   { background: #1a1d27; border-color: #2a2d3e; }
[data-theme="dark"] .accordion-button { background: #1e2130; color: var(--text-primary); }
[data-theme="dark"] .accordion-button:not(.collapsed) { background: #232637; color: var(--primary-light); }
[data-theme="dark"] .accordion-button::after { filter: invert(0.7); }
[data-theme="dark"] .accordion-body   { background: #1a1d27; color: var(--text-primary); }

/* ── Tooltips & Popovers ── */
[data-theme="dark"] .tooltip-inner       { background: #2a2d3e; }
[data-theme="dark"] .popover             { background: #1e2130; border-color: #2a2d3e; }
[data-theme="dark"] .popover-header      { background: #232637; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .popover-body        { color: var(--text-primary); }

/* ── Payments page ── */
[data-theme="dark"] .pay-table-wrap     { background: #1a1d27 !important; }
[data-theme="dark"] .pay-tabs           { background: #13151f; border-color: #2a2d3e; }
[data-theme="dark"] .pay-tab            { color: var(--text-secondary); }
[data-theme="dark"] .pay-tab.active     { background: #1a1d27; color: var(--text-primary); }
[data-theme="dark"] .pay-filter-bar     { background: #13151f; border-color: #2a2d3e; }
[data-theme="dark"] .pay-table-search   { background: #232637; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .pay-breadcrumb     { color: rgba(255,255,255,.6); }
[data-theme="dark"] .pay-action-print   { background: rgba(13,202,240,.12); color: #67e8f9; }
[data-theme="dark"] .pay-action-delete  { background: rgba(220,53,69,.12);  color: #fca5a5; }
[data-theme="dark"] .pay-method-cash     { background: rgba(25,135,84,.15);  color: #86efac; }
[data-theme="dark"] .pay-method-card     { background: rgba(59,130,246,.15); color: #93c5fd; }
[data-theme="dark"] .pay-method-transfer { background: rgba(13,202,240,.15); color: #67e8f9; }
[data-theme="dark"] .pay-method-other    { background: rgba(148,163,184,.15);color: #94a3b8; }

/* ── Stat card warning icon in dark ── */
[data-theme="dark"] .stat-card-icon.warning { background: rgba(255,193,7,.15); color: #fbbf24; }
[data-theme="dark"] .stat-card-icon.info    { background: rgba(13,202,240,.15); color: #67e8f9; }

/* ── Activity / timeline dots ── */
[data-theme="dark"] .activity-dot { opacity: 0.9; }

/* ── Scrollbar in dark ── */
[data-theme="dark"] ::-webkit-scrollbar-track { background: #13151f; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a2d3e; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a3f55; }

/* ── Misc ── */
[data-theme="dark"] .spinner-border    { color: var(--primary-light); }
[data-theme="dark"] code               { background: #232637; color: #f472b6; }
[data-theme="dark"] pre                { background: #13151f; border-color: #2a2d3e; color: var(--text-primary); }
[data-theme="dark"] .breadcrumb-item   { color: var(--text-secondary); }
[data-theme="dark"] .breadcrumb-item.active { color: var(--text-primary); }
[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   Theme Toggle Button
   ═══════════════════════════════════════════════════════════════ */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.theme-toggle-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.08);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}
.theme-toggle-btn .icon-sun,
.theme-toggle-btn .icon-moon {
    position: absolute;
    transition: opacity 0.22s ease, transform 0.3s ease;
}
/* Light mode: show moon, hide sun */
.theme-toggle-btn .icon-sun  { opacity: 0; transform: rotate(90deg) scale(0.6); }
.theme-toggle-btn .icon-moon { opacity: 1; transform: rotate(0deg)  scale(1);   }
/* Dark mode: show sun, hide moon */
[data-theme="dark"] .theme-toggle-btn .icon-sun  { opacity: 1; transform: rotate(0deg)   scale(1);   }
[data-theme="dark"] .theme-toggle-btn .icon-moon { opacity: 0; transform: rotate(-90deg) scale(0.6); }

/* ═══════════════════════════════════════════════════════════════
   UNIFIED DESIGN SYSTEM — Color Harmony v2
   نظام موحّد للألوان: يتناسق مع السايدبار بدون تغييره
   ═══════════════════════════════════════════════════════════════ */

/* ── Main Header — خط تمييز بالأسفل بلون primary ─────────────── */
.main-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(var(--primary-rgb), 0.5) 30%,
        rgba(var(--primary-rgb), 0.5) 70%,
        transparent 100%
    );
    pointer-events: none;
}

/* ── Card Header — خط تمييز أسفله بلون primary ──────────────── */
.card-header {
    position: relative;
    overflow: hidden;
}
.card-header::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 50%;
    height: 2px;
    background: linear-gradient(270deg,
        rgba(var(--primary-rgb), 0.55) 0%,
        transparent 100%
    );
    pointer-events: none;
    border-radius: 0 0 0 4px;
}

/* ── Card Header داخل الجداول — مظهر موحد ───────────────────── */
.card-header .fw-bold,
.card-header .fw-semibold {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header .fw-bold::before,
.card-header .fw-semibold::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Page Header h2 — خط رأسي بجانبه ───────────────────────── */
.page-header h2,
.page-header h1 {
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-header h2::before,
.page-header h1::before {
    content: '';
    width: 4px;
    height: 26px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-block;
}

/* ── Table Container — شريط primary في الأعلى ───────────────── */
.table-container {
    border-top: 3px solid var(--primary);
    overflow: hidden;
}

/* ── Table Header — تظليل خفيف بلون primary ─────────────────── */
.table thead th {
    background: rgba(var(--primary-rgb), 0.05) !important;
    color: var(--primary) !important;
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.15) !important;
}

/* ── Stat Card — حدود يمين عند hover ────────────────────────── */
.stat-card {
    border-right: 3px solid transparent;
    transition: var(--transition), border-right-color 0.25s;
}
.stat-card:hover {
    border-right-color: var(--primary);
}

/* ── Section Title Utility Class — عنوان قسم موحد ───────────── */
.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}
.section-title::before {
    content: '';
    width: 3px;
    height: 18px;
    background: linear-gradient(180deg, var(--primary), var(--primary-light));
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── Page Hero — بانر الصفحة الموحّد (بديل عن كل hero خاص) ─── */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    color: #fff;
}
.page-hero::before {
    content: '';
    position: absolute;
    top: -70px; right: -50px;
    width: 220px; height: 220px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
    pointer-events: none;
}
.page-hero::after {
    content: '';
    position: absolute;
    bottom: -90px; left: -40px;
    width: 280px; height: 280px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    pointer-events: none;
}
.page-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.page-hero-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.page-hero-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}
.page-hero h1, .page-hero-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}
.page-hero-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.72);
    margin-top: 3px;
}
.page-hero .breadcrumb-custom {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}
.page-hero .breadcrumb-custom a {
    color: rgba(255,255,255,0.8);
    transition: color .2s;
}
.page-hero .breadcrumb-custom a:hover { color: #fff; }
.page-hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: var(--primary);
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.18);
    text-decoration: none;
    font-family: inherit;
}
.page-hero-btn:hover {
    background: #f0f5ff;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.22);
    color: var(--primary);
}
@media (max-width: 767px) {
    .page-hero { padding: 20px 18px; }
    .page-hero h1, .page-hero-title { font-size: 18px; }
}

/* ── Attendance Scanner & Search Hero — align to primary ─────── */
.attendance-scanner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}
.search-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

/* ── Payments Hero — ألوان أعمق قليلاً لتناسق مع primary ─────── */
.pay-hero {
    background: linear-gradient(135deg, #00293f 0%, var(--primary) 55%, var(--primary-light) 100%);
}

/* ── Nav Tabs — primary active ───────────────────────────────── */
.nav-tabs .nav-link {
    color: var(--text-secondary);
    font-weight: 600;
    border: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    border-radius: 0;
}
.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-bottom-color: rgba(var(--primary-rgb), 0.3);
    background: transparent;
}
.nav-tabs .nav-link.active {
    color: var(--primary) !important;
    font-weight: 700;
    border-bottom: 2px solid var(--primary) !important;
    background: transparent !important;
    border-top: none; border-left: none; border-right: none;
}
.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
}

/* ── Settings Nav ─────────────────────────────────────────────── */
.settings-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.3);
}

/* ── Pagination — primary ────────────────────────────────────── */
.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}
.page-link { color: var(--primary); }
.page-link:hover { color: var(--primary-light); }

/* ── Progress Bar ─────────────────────────────────────────────── */
.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
}

/* ── Form Checkbox / Radio ───────────────────────────────────── */
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── Header Avatar ───────────────────────────────────────────── */
.header-user-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

/* ── Breadcrumb active ───────────────────────────────────────── */
.breadcrumb-item.active {
    color: var(--primary);
    font-weight: 600;
}

/* ── Empty State Icon ─────────────────────────────────────────── */
.empty-state i {
    color: var(--primary);
    opacity: 0.25;
}

/* ── Dashboard Restore Bar ────────────────────────────────────── */
.dash-restore-bar {
    background: linear-gradient(135deg, #00293f, var(--primary));
}

/* ── Login Page ───────────────────────────────────────────────── */
.login-page {
    background: linear-gradient(135deg, #0d1117 0%, #10172a 50%, var(--primary) 100%);
}

/* ── Dark Mode — overrides للكلاسات الجديدة ─────────────────── */
[data-theme="dark"] .table-container {
    border-top-color: rgba(var(--primary-rgb), 0.6);
}
[data-theme="dark"] .table thead th {
    background: rgba(var(--primary-rgb), 0.1) !important;
    color: var(--primary-light) !important;
    border-bottom-color: rgba(var(--primary-rgb), 0.25) !important;
}
[data-theme="dark"] .stat-card:hover {
    border-right-color: var(--primary-light);
}
[data-theme="dark"] .page-hero {
    background: linear-gradient(135deg, #001d2f 0%, var(--primary) 100%);
}
[data-theme="dark"] .attendance-scanner,
[data-theme="dark"] .search-hero {
    background: linear-gradient(135deg, #001d2f 0%, var(--primary) 100%);
}
[data-theme="dark"] .pay-hero {
    background: linear-gradient(135deg, #001520 0%, #00293f 50%, var(--primary) 100%);
}
[data-theme="dark"] .dash-restore-bar {
    background: linear-gradient(135deg, #001520, var(--primary));
}
[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #060810 0%, #0d1117 60%, #001d2f 100%);
}
[data-theme="dark"] .section-title {
    border-bottom-color: #2a2d3e;
}
[data-theme="dark"] .card-header::after {
    background: linear-gradient(270deg,
        rgba(var(--primary-rgb), 0.4) 0%,
        transparent 100%
    );
}
[data-theme="dark"] .main-header::after {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(var(--primary-rgb), 0.4) 30%,
        rgba(var(--primary-rgb), 0.4) 70%,
        transparent 100%
    );
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Comprehensive Contrast & Readability Fixes
   إصلاح شامل لتباين الألوان في الوضع الداكن
   ═══════════════════════════════════════════════════════════════ */

/* ── Primary color — light blue in dark mode ─────────────────── */
/* --primary = #00416A (dark blue) → barely visible on dark bg    */
/* Fix: use a light accessible blue instead                       */
:root {
    --primary-dark-mode: #5db8e8;   /* light blue for dark mode text */
    --primary-dark-mode-bg: rgba(93, 184, 232, 0.12);
}

[data-theme="dark"] .text-primary,
[data-theme="dark"] a.text-primary {
    color: var(--primary-dark-mode) !important;
}

[data-theme="dark"] code {
    background: rgba(93, 184, 232, 0.1);
    color: var(--primary-dark-mode);
    border: 1px solid rgba(93, 184, 232, 0.15);
    border-radius: 4px;
    padding: 1px 6px;
}

/* ── Badges — primary & stage ────────────────────────────────── */
[data-theme="dark"] .badge-primary,
[data-theme="dark"] .badge-stage.badge-primary {
    background: var(--primary-dark-mode-bg);
    color: var(--primary-dark-mode);
}

[data-theme="dark"] .badge.bg-primary {
    background-color: var(--primary) !important;
}

[data-theme="dark"] .badge.bg-secondary {
    background-color: #3a3f55 !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .badge.bg-success {
    background-color: rgba(25,135,84,0.8) !important;
}

[data-theme="dark"] .badge.bg-warning {
    background-color: rgba(255,193,7,0.8) !important;
    color: #1a1a1a !important;
}

[data-theme="dark"] .badge.bg-danger {
    background-color: rgba(220,53,69,0.8) !important;
}

[data-theme="dark"] .badge.bg-info {
    background-color: rgba(13,202,240,0.8) !important;
    color: #0f172a !important;
}

[data-theme="dark"] .badge.bg-light {
    background-color: #2a2d3e !important;
    color: var(--text-secondary) !important;
}

/* ── Outline Buttons — readable in dark ──────────────────────── */
[data-theme="dark"] .btn-outline-primary {
    color: var(--primary-dark-mode) !important;
    border-color: var(--primary-dark-mode) !important;
}
[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-primary:focus {
    background-color: rgba(93,184,232,0.15) !important;
    color: #fff !important;
    border-color: var(--primary-dark-mode) !important;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #94a3b8 !important;
    border-color: #3a3f55 !important;
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: #2a2d3e !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .btn-outline-success {
    color: #86efac !important;
    border-color: #86efac !important;
}
[data-theme="dark"] .btn-outline-success:hover {
    background-color: rgba(134,239,172,0.15) !important;
    color: #86efac !important;
}

[data-theme="dark"] .btn-outline-danger {
    color: #fca5a5 !important;
    border-color: #fca5a5 !important;
}
[data-theme="dark"] .btn-outline-danger:hover {
    background-color: rgba(252,165,165,0.15) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .btn-outline-info {
    color: #67e8f9 !important;
    border-color: #67e8f9 !important;
}
[data-theme="dark"] .btn-outline-info:hover {
    background-color: rgba(103,232,249,0.15) !important;
    color: #67e8f9 !important;
}

[data-theme="dark"] .btn-outline-warning {
    color: #fde047 !important;
    border-color: #fde047 !important;
}
[data-theme="dark"] .btn-outline-warning:hover {
    background-color: rgba(253,224,71,0.15) !important;
    color: #fde047 !important;
}

/* ── Solid Buttons — refine ──────────────────────────────────── */
[data-theme="dark"] .btn-primary {
    background-color: #1a5f8a !important;
    border-color: #1a5f8a !important;
    color: #fff !important;
}
[data-theme="dark"] .btn-primary:hover {
    background-color: #2272a0 !important;
    border-color: #2272a0 !important;
}

[data-theme="dark"] .btn-secondary {
    background-color: #2a2d3e !important;
    border-color: #3a3f55 !important;
    color: var(--text-primary) !important;
}

/* ── Table Header — visible blue in dark ─────────────────────── */
[data-theme="dark"] .table thead th {
    background: rgba(93,184,232,0.08) !important;
    color: var(--primary-dark-mode) !important;
    border-bottom-color: rgba(93,184,232,0.2) !important;
}

/* ── Table Container top border ──────────────────────────────── */
[data-theme="dark"] .table-container {
    border-top-color: #1a5f8a;
}

/* ── Input Group Text ─────────────────────────────────────────── */
[data-theme="dark"] .input-group-text {
    background: #1e2130;
    border-color: #2a2d3e;
    color: var(--text-secondary);
}

/* ── Select options background ───────────────────────────────── */
[data-theme="dark"] select option {
    background: #1e2130;
    color: var(--text-primary);
}

/* ── Links in dark ───────────────────────────────────────────── */
[data-theme="dark"] a:not(.btn):not(.nav-link):not(.sidebar-nav-link):not(.page-link):not(.dropdown-item) {
    color: var(--primary-dark-mode);
}
[data-theme="dark"] a:not(.btn):not(.nav-link):not(.sidebar-nav-link):not(.page-link):not(.dropdown-item):hover {
    color: #93d4f0;
}

/* ── Breadcrumb in dark ──────────────────────────────────────── */
[data-theme="dark"] .breadcrumb-custom a {
    color: var(--primary-dark-mode);
}
[data-theme="dark"] .breadcrumb-custom {
    color: var(--text-secondary);
}

/* ── Page header title ───────────────────────────────────────── */
[data-theme="dark"] .page-header h2,
[data-theme="dark"] .page-header h1 {
    color: var(--text-primary);
}

/* ── Card & Content readability ──────────────────────────────── */
[data-theme="dark"] .fw-semibold,
[data-theme="dark"] .fw-bold,
[data-theme="dark"] strong {
    color: var(--text-primary);
}

[data-theme="dark"] small,
[data-theme="dark"] .small {
    color: var(--text-secondary);
}

/* ── Nav tabs in dark ────────────────────────────────────────── */
[data-theme="dark"] .nav-tabs .nav-link {
    color: var(--text-secondary);
    border-bottom-color: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--primary-dark-mode);
    border-bottom-color: rgba(93,184,232,0.3);
    background: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
    color: var(--primary-dark-mode) !important;
    border-bottom-color: var(--primary-dark-mode) !important;
}

/* ── Pagination in dark ──────────────────────────────────────── */
[data-theme="dark"] .page-item.active .page-link {
    background-color: #1a5f8a;
    border-color: #1a5f8a;
}
[data-theme="dark"] .page-link {
    color: var(--primary-dark-mode);
}
[data-theme="dark"] .page-link:hover {
    color: #93d4f0;
    background: #2a2d3e;
}
[data-theme="dark"] .page-item.disabled .page-link {
    color: #4a5568;
    background: transparent;
}

/* ── Progress bar in dark ────────────────────────────────────── */
[data-theme="dark"] .progress {
    background: #2a2d3e;
}
[data-theme="dark"] .progress-bar {
    background: linear-gradient(90deg, #1a5f8a, var(--primary-dark-mode));
}

/* ── Form check in dark ──────────────────────────────────────── */
[data-theme="dark"] .form-check-input:checked {
    background-color: #1a5f8a;
    border-color: #1a5f8a;
}

/* ── Table toolbar (contains search/filter) ──────────────────── */
[data-theme="dark"] .table-toolbar {
    background: #1a1d27;
    border-bottom-color: #2a2d3e;
}

/* ── Empty state ─────────────────────────────────────────────── */
[data-theme="dark"] .empty-state i {
    color: var(--primary-dark-mode);
    opacity: 0.2;
}
[data-theme="dark"] .empty-state h5 {
    color: var(--text-secondary);
}

/* ── Stat card icons in dark ─────────────────────────────────── */
[data-theme="dark"] .stat-card-icon.primary {
    background: rgba(93,184,232,0.12);
    color: var(--primary-dark-mode);
}

/* ── Settings nav active in dark ─────────────────────────────── */
[data-theme="dark"] .settings-nav .nav-link.active {
    background: linear-gradient(135deg, #1a5f8a, var(--primary-dark-mode));
    box-shadow: 0 4px 14px rgba(93,184,232,0.2);
}

/* ── pay-tabs active in dark ─────────────────────────────────── */
[data-theme="dark"] .pay-tab.active {
    background: rgba(93,184,232,0.1);
    color: var(--primary-dark-mode);
}
[data-theme="dark"] .pay-tab-badge {
    background: rgba(93,184,232,0.12);
    color: var(--primary-dark-mode);
}
[data-theme="dark"] .pay-month-badge {
    background: rgba(93,184,232,0.12);
    color: var(--primary-dark-mode);
}

/* ── section-title in dark ───────────────────────────────────── */
[data-theme="dark"] .section-title {
    color: var(--text-primary);
    border-bottom-color: #2a2d3e;
}

/* ── Modal header default ─────────────────────────────────────── */
[data-theme="dark"] .modal-header:not([style]) {
    background: linear-gradient(135deg, #001d2f 0%, #1a5f8a 100%);
    border-bottom-color: #2a2d3e;
}

/* ── card-header after line in dark ─────────────────────────── */
[data-theme="dark"] .card-header {
    color: var(--text-primary);
}

/* ── Button icon variants ─────────────────────────────────────── */
[data-theme="dark"] .btn-icon.btn-outline-primary {
    color: var(--primary-dark-mode) !important;
    border-color: rgba(93,184,232,0.4) !important;
}
[data-theme="dark"] .btn-icon.btn-outline-primary:hover {
    background: rgba(93,184,232,0.15) !important;
    border-color: var(--primary-dark-mode) !important;
}

/* ── Dashboard customize btn ─────────────────────────────────── */
[data-theme="dark"] .dash-customize-btn {
    background: #1e2130;
    border-color: #2a2d3e;
    color: var(--text-primary);
}
[data-theme="dark"] .dash-customize-btn:hover {
    background: #1a5f8a;
    border-color: #1a5f8a;
}

/* ── Header user avatar ──────────────────────────────────────── */
[data-theme="dark"] .header-user-avatar {
    background: linear-gradient(135deg, #1a5f8a, var(--primary-dark-mode));
}

/* ── Sidebar user avatar — don't touch (sidebar is already dark) */

/* ── Stat card hover border in dark ─────────────────────────── */
[data-theme="dark"] .stat-card:hover {
    border-right-color: var(--primary-dark-mode);
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE — Inline Style Overrides (Page-specific classes)
   إصلاح inline styles في صفحات محددة
   ═══════════════════════════════════════════════════════════════ */

/* ── activity-log.php card headers with inline style ─────────── */
[data-theme="dark"] .card-header[style*="background:#fff"],
[data-theme="dark"] .card-header[style*="background: #fff"],
[data-theme="dark"] .card-header[style*="background:white"],
[data-theme="dark"] .card-header[style*="background: white"] {
    background: #1e2130 !important;
    border-bottom-color: #2a2d3e !important;
    color: var(--text-primary) !important;
}

/* ── registrations.php inline white cards ─────────────────────── */
[data-theme="dark"] .reg-card[style*="background:#fff"],
[data-theme="dark"] [style*="background:#fef2f2"] {
    background: #2a1515 !important;
    border-color: rgba(220,38,38,.3) !important;
}
[data-theme="dark"] [style*="background:#f0f4fb"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background:#f8f9fa"] {
    background: #1e2130 !important;
}
[data-theme="dark"] [style*="background:linear-gradient(135deg,#f0fdf4"],
[data-theme="dark"] [style*="background: linear-gradient(135deg, #f0fdf4"] {
    background: rgba(25,135,84,.1) !important;
    border-color: rgba(25,135,84,.2) !important;
}
[data-theme="dark"] [style*="background:#fffbeb"] {
    background: rgba(217,119,6,.1) !important;
    border-color: rgba(217,119,6,.2) !important;
    color: #fde047 !important;
}

/* ── parent-messages.php chat area ───────────────────────────── */
[data-theme="dark"] [style*="background: #f0f2f8"],
[data-theme="dark"] [style*="background:#f0f2f8"] {
    background: #13151f !important;
}
[data-theme="dark"] [style*="background:white"][style*="padding"][style*="border-bottom"],
[data-theme="dark"] [style*="background: white"][style*="padding"] {
    background: #1a1d27 !important;
}

/* ── attendance-stats.php table ──────────────────────────────── */
[data-theme="dark"] .table-stats thead th {
    background: rgba(93,184,232,.08) !important;
    color: #5db8e8 !important;
}

/* ── autocomplete items ──────────────────────────────────────── */
[data-theme="dark"] .autocomplete-item:hover,
[data-theme="dark"] .autocomplete-item:focus {
    background: #2a2d3e !important;
    color: var(--text-primary) !important;
}

/* ── Generic: any div with white bg inside main-content ──────── */
[data-theme="dark"] .main-content [style*="background:#fff"]:not(.sidebar):not(.main-header),
[data-theme="dark"] .main-content [style*="background: #fff"]:not(.sidebar):not(.main-header),
[data-theme="dark"] .main-content [style*="background:white"]:not(.sidebar):not(.main-header),
[data-theme="dark"] .main-content [style*="background: white"]:not(.sidebar):not(.main-header) {
    background: #1a1d27 !important;
    color: var(--text-primary) !important;
}

/* ── Inline light border colors ──────────────────────────────── */
[data-theme="dark"] .main-content [style*="border-bottom:1px solid #eef"],
[data-theme="dark"] .main-content [style*="border-bottom: 1px solid #eef"],
[data-theme="dark"] .main-content [style*="border:1px solid #e5e7eb"],
[data-theme="dark"] .main-content [style*="border: 1px solid #e5e7eb"] {
    border-color: #2a2d3e !important;
}
