/**
 * Soft UI Dashboard–inspired theme
 * Ministry of Education — Back to Learning
 */

@font-face {
    font-family: "Parwarda 2026";
    src: url("../PARWARDA-2026%20BOLD.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Parwarda 2026";
    src: url("../PARWARDA-2026%20BOLD.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Parwarda 2026";
    src: url("../PARWARDA-2026%20BOLD.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Parwarda 2026";
    src: url("../PARWARDA-2026%20BOLD.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #344767;
    --primary-dark: #1a2035;
    --primary-light: #5e72e4;
    --primary-soft: rgba(94, 114, 228, 0.12);
    --accent: #82d616;
    --accent-soft: rgba(130, 214, 22, 0.15);
    --secondary: #8392ab;
    --success: #82d616;
    --danger: #ea0606;
    --warning: #fbcf33;
    --info: #17c1e8;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 80px;
    --navbar-height: 58px;
    --bg-body: #f8f9fa;
    --bg-card: #ffffff;
    --bg-muted: #f8f9fa;
    --text-primary: #344767;
    --text-muted: #67748e;
    --border-color: #e9ecef;
    --shadow: 0 20px 27px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --radius: 1rem;
    --radius-sm: 0.75rem;
    --font-parwarda: "Parwarda 2026", sans-serif;
    --font-latin: var(--font-parwarda);
    --font-arabic: var(--font-parwarda);
    --font-display: var(--font-parwarda);
    --font-body: var(--font-parwarda);
}

html[lang="ku"],
html[lang="bdn"],
html[lang="ar"],
html[dir="rtl"] {
    --font-display: var(--font-parwarda);
    --font-body: var(--font-parwarda);
}

.dark-theme {
    --bg-body: #1a2035;
    --bg-card: #202940;
    --bg-muted: #252f45;
    --text-primary: #e9ecef;
    --text-muted: #a0aec0;
    --border-color: #2d3748;
    --shadow: 0 20px 27px 0 rgba(0, 0, 0, 0.3);
    --primary: #e9ecef;
    --primary-soft: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
select,
textarea,
.btn,
.form-control,
.form-select,
.nav-link,
.dropdown-item,
.table,
.card,
.modal,
.alert,
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-parwarda);
}

img, svg, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* Instant hand cursor on every interactive control (no hover delay from missing cursor rules). */
a[href],
button:not(:disabled),
.btn:not(:disabled),
.nav-link,
.dropdown-item,
.dropdown-toggle,
.page-link,
.lang-switch,
.notif-item,
.mark-all-read,
.sidebar-tool-btn,
.sidebar-account-link,
.sidebar-nav .nav-link,
.crumb-link,
.drilldown-row,
[role="button"],
[data-bs-toggle],
[data-action],
label[for],
summary,
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
input[type="reset"]:not(:disabled),
input[type="checkbox"],
input[type="radio"],
input[type="file"],
select:not(:disabled),
.btn-close,
.page-hero a,
.card-header .btn,
.table .btn,
.dropdown-menu a {
    cursor: pointer;
    touch-action: manipulation;
}

/* Isolate large regions so hover paint stays local (no visual change). */
.sidebar,
.page-content,
.card,
.stat-card {
    contain: layout style;
}

button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

/* Kurdish/Arabic script: consistent glyph metrics */
html[lang="ku"] body,
html[lang="bdn"] body,
html[lang="ar"] body,
[dir="rtl"] body {
    font-family: var(--font-arabic);
    font-feature-settings: "kern" 1;
    letter-spacing: 0;
    word-spacing: normal;
}

h1, h2, h3, h4, h5, h6,
.btn, .form-label, .nav-link, .table, .stat-value, .logo-text h5,
.public-hero h1, .gov-name, .gov-count, .info-value, .public-section-title,
.brand-name {
    font-family: var(--font-display);
}

html[lang="ku"] h1,
html[lang="ku"] h2,
html[lang="ku"] h3,
html[lang="ku"] h4,
html[lang="ku"] h5,
html[lang="ku"] h6,
html[lang="ku"] .btn,
html[lang="ku"] .nav-link,
html[lang="ku"] .form-label,
html[lang="ku"] .table,
html[lang="bdn"] h1,
html[lang="bdn"] h2,
html[lang="bdn"] h3,
html[lang="bdn"] h4,
html[lang="bdn"] h5,
html[lang="bdn"] h6,
html[lang="bdn"] .btn,
html[lang="bdn"] .nav-link,
html[lang="bdn"] .form-label,
html[lang="bdn"] .table,
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6,
html[lang="ar"] .btn,
html[lang="ar"] .nav-link,
html[lang="ar"] .form-label,
html[lang="ar"] .table {
    font-family: var(--font-arabic);
}

.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

/* Modals must sit above sidebar overlays; dialog must stay clickable. */
.modal {
    z-index: 20050 !important;
}
.modal-backdrop {
    z-index: 20040 !important;
}
.modal .modal-dialog {
    pointer-events: auto !important;
    z-index: 20060;
}
.modal .modal-content {
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
}

/* Soft UI Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    color: var(--text-primary);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border: none;
    margin: 1rem 0 1rem 1rem;
    height: calc(100vh - 2rem);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.dark-theme .sidebar { background: var(--bg-card); }

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar.collapsed .sidebar-header .logo-text,
.sidebar.collapsed .sidebar-nav .nav-link span { display: none; }

.sidebar.collapsed .sidebar-header { justify-content: center; text-align: center; }
.sidebar.collapsed .sidebar-nav .nav-link { justify-content: center; }
.sidebar.collapsed .sidebar-nav .nav-link i { width: auto; }
.sidebar.collapsed ~ .content { margin-left: calc(var(--sidebar-collapsed-width) + 1.5rem); }

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-container > i {
    width: 36px;
    height: 36px;
    border-radius: 0.75rem;
    background: linear-gradient(310deg, #7928ca, #ff0080);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.logo-text h5 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text small {
    display: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 1rem;
    margin: 0;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    border-left: none;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    cursor: pointer;
}

.sidebar-nav .nav-link:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: #344767;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-nav .nav-link i {
    width: 28px;
    height: 28px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--text-primary);
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-nav .nav-link.active i {
    background: #fff;
    color: #344767;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.sidebar-footer small { color: var(--text-muted) !important; }

/* Mobile sidebar: user → language/notifications under logo; profile/logout at bottom */
.sidebar-header .sidebar-user-chip {
    margin-top: 0.85rem;
    margin-bottom: 0;
}

.sidebar-top-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-public-auth {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-public-auth .sidebar-account-link {
    margin-top: 0;
}

.sidebar-nav-empty {
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-lang-dropdown {
    flex: 1;
    min-width: 0;
}

.sidebar-lang-dropdown .lang-switcher,
.sidebar-lang-dropdown .dropdown {
    width: 100%;
}

.sidebar-lang-dropdown .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    text-align: start;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.sidebar-lang-dropdown .dropdown-menu {
    width: 100%;
    min-width: 100%;
}

.sidebar-tool-btn {
    width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.sidebar-notif-menu {
    width: min(280px, calc(100vw - 3rem));
    max-height: 320px;
    overflow: hidden;
    padding-bottom: 0.25rem;
}

.sidebar-notif-list {
    max-height: 220px;
    overflow-y: auto;
}

.sidebar-notif-list .notif-item {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-notif-list .notif-item.unread {
    background: rgba(33, 82, 255, 0.04);
}

.sidebar-account {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    margin-top: auto;
}

.sidebar-account-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    margin-top: 0.35rem;
    border: 0;
    border-radius: 0.65rem;
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.sidebar-account-link i { width: 1.1rem; text-align: center; }
.sidebar-account-link:hover { background: rgba(0, 0, 0, 0.06); color: var(--text-primary); }
.sidebar-account-primary { background: #344767; color: #fff; }
.sidebar-account-primary:hover { background: #2a3954; color: #fff; }
.sidebar-account-danger { color: #c0392b; }
.sidebar-account-danger:hover { background: rgba(192, 57, 43, 0.08); color: #a93226; }

.sidebar-user-chip {
    padding: 0.7rem 0.8rem;
    border-radius: 0.65rem;
    background: rgba(33, 82, 255, 0.06);
    border: 1px solid rgba(33, 82, 255, 0.08);
}

.sidebar-user-chip strong {
    display: block;
    font-size: 0.875rem;
    line-height: 1.3;
    color: var(--text-primary);
    word-break: break-word;
}

.sidebar-user-chip small {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.navbar-page-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: calc(100% - 3.5rem);
}

/* Content */
.content {
    margin-left: calc(var(--sidebar-width) + 1.5rem);
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    background: var(--bg-body);
    position: relative;
    z-index: 1;
}

.top-navbar {
    /* Solid bg avoids costly backdrop-filter while matching the light bar look. */
    background: #f8f9fa;
    border-bottom: none;
    height: auto;
    padding: 1rem 1.25rem 0.5rem;
    box-shadow: none;
    position: sticky;
    top: 0;
    z-index: 900;
}

.page-content {
    padding: 0.75rem 1.25rem 1.5rem;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

.footer {
    padding: 1rem 1.25rem;
    background: transparent;
    border-top: none;
    color: var(--text-muted);
}

/* Soft UI Stat Cards */
.stat-card {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    border: 0;
    /* Transform-only transition = compositor-friendly hover (same end look). */
    transition: transform 0.2s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card::after { display: none; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 32px 0 rgba(0, 0, 0, 0.07);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff !important;
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0.35rem 0 0;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    text-transform: none;
}

.bg-primary-gradient { background: linear-gradient(310deg, #7928ca, #ff0080) !important; }
.bg-success-gradient { background: linear-gradient(310deg, #17ad37, #98ec2d) !important; }
.bg-warning-gradient { background: linear-gradient(310deg, #f53939, #fbcf33) !important; }
.bg-danger-gradient { background: linear-gradient(310deg, #ea0606, #ff667c) !important; }
.bg-info-gradient { background: linear-gradient(310deg, #2152ff, #21d4fd) !important; }
.bg-purple-gradient { background: linear-gradient(310deg, #7928ca, #ff0080) !important; }
.bg-teal-gradient { background: linear-gradient(310deg, #00b09b, #96c93d) !important; }
.bg-orange-gradient { background: linear-gradient(310deg, #f53939, #fbcf33) !important; }

/* Cards */
.card {
    background: #ffffff;
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    background: transparent;
    border-bottom: 0;
    font-weight: 700;
    padding: 1rem 1.25rem 0.25rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.card-body { padding: 1rem 1.25rem 1.25rem; }

/* Tables */
.table-responsive {
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.card,
.card-body {
    min-width: 0;
    max-width: 100%;
}
.table {
    color: var(--text-primary);
    width: 100%;
    margin-bottom: 0;
}
.dataTables_wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.dataTables_wrapper .dataTables_scroll,
.dataTables_wrapper .dataTables_scrollBody {
    width: 100% !important;
}
.dataTables_wrapper .row {
    margin-left: 0;
    margin-right: 0;
}
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    float: none;
    text-align: start;
    padding: 0.35rem 0;
}

.table thead th {
    background: transparent;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.table tbody tr { transition: background-color 0.12s ease; }
.table tbody tr:hover { background: rgba(0, 0, 0, 0.02); }

/* Students / advanced search lists: center all columns except name */
.students-list-table th,
.students-list-table td {
    text-align: center !important;
    vertical-align: middle;
}
.students-list-table th.col-name,
.students-list-table td.col-name {
    text-align: start !important;
}
.students-list-table td.text-center .badge {
    display: inline-block;
}

.attach-field {
    position: relative;
}
.attach-field .attach-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.attach-camera-stage {
    min-height: 220px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.5rem;
    border: 1px solid #d2d6da;
    background: #fff;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    border-color: #5e72e4;
    box-shadow: 0 0 0 2px rgba(94, 114, 228, 0.2);
}

.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
    color: var(--text-primary);
}

.input-group-text {
    border-radius: 0.5rem;
    border-color: #d2d6da;
    background: #fff;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0;
    text-transform: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: linear-gradient(310deg, #141727, #3a416f);
    border: 0;
    color: #fff;
}

.btn-primary:hover {
    background: linear-gradient(310deg, #1a1f38, #465083);
    color: #fff;
    border: 0;
}

.btn-success {
    background: linear-gradient(310deg, #17ad37, #98ec2d);
    border: 0;
    color: #fff;
}

.btn-outline-primary {
    color: #344767;
    border: 1px solid #d2d6da;
    background: #fff;
    box-shadow: none;
}

.btn-outline-primary:hover {
    background: #344767;
    border-color: #344767;
    color: #fff;
}

.btn-outline-secondary {
    border-color: #d2d6da;
    color: var(--text-primary);
    background: #fff;
    box-shadow: none;
}

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    gap: 0.25rem;
}

.nav-tabs .nav-link {
    border: none;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.6rem 1rem;
}

.nav-tabs .nav-link:hover { color: var(--text-primary); }

.nav-tabs .nav-link.active {
    color: #fff;
    background: #344767;
    border-bottom: none;
}

/* Workflow */
.workflow-steps {
    display: flex;
    justify-content: space-between;
    margin: 1.5rem 0;
    position: relative;
}

.workflow-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 5%;
    right: 5%;
    height: 3px;
    background: var(--border-color);
    z-index: 0;
}

.workflow-step { text-align: center; position: relative; z-index: 1; flex: 1; }

.workflow-step .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 700;
    font-size: 0.85rem;
}

.workflow-step.active .step-circle,
.workflow-step.completed .step-circle {
    background: linear-gradient(310deg, #17ad37, #98ec2d);
    color: #fff;
}

.workflow-step .step-label { font-size: 0.75rem; color: var(--text-muted); }

#governorateMap,
#studentsReturnMap {
    height: 480px;
    border-radius: var(--radius);
    border: 0;
    z-index: 1;
}

.map-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.map-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.b2l-student-marker {
    background: transparent;
    border: 0;
}

.b2l-marker-pin {
    width: 40px;
    height: 40px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: linear-gradient(145deg, #1a5276, #2e86ab);
    box-shadow: 0 8px 18px rgba(26, 82, 118, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.b2l-marker-pin i {
    transform: rotate(45deg);
    color: #fff;
    font-size: 0.95rem;
}

.b2l-marker-pin.district {
    width: 34px;
    height: 34px;
    background: linear-gradient(145deg, #0f766e, #14b8a6);
}

.b2l-leaflet-popup .leaflet-popup-content-wrapper {
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.b2l-leaflet-popup .leaflet-popup-content {
    margin: 0;
    min-width: 260px;
}

.b2l-map-popup {
    font-family: inherit;
}

.b2l-popup-head {
    padding: 0.9rem 1rem 0.7rem;
    background: linear-gradient(135deg, #0f3d5c, #1a5276);
    color: #fff;
}

.b2l-popup-badge {
    display: inline-block;
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    margin-bottom: 0.35rem;
}

.b2l-popup-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.b2l-popup-sub {
    opacity: 0.8;
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

.b2l-popup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    padding: 0.85rem;
}

.b2l-stat {
    border-radius: 12px;
    padding: 0.65rem 0.7rem;
    background: #f5f7fa;
}

.b2l-stat.visited { background: #eef6ff; }
.b2l-stat.returned { background: #e9f9ef; }
.b2l-stat.not-returned { background: #fff1f0; }
.b2l-stat.target { background: #fff8e8; }
.b2l-stat.formal { background: #e7f6f5; }
.b2l-stat.nonformal { background: #f1e9ff; }

.b2l-stat-value {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a2b3c;
    line-height: 1.2;
}

.b2l-stat-label {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.b2l-progress {
    padding: 0 0.85rem 0.95rem;
}

.b2l-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.b2l-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.b2l-progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #17ad37, #98ec2d);
}

.targets-gov-block {
    border: 1px solid #e5eaf0;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fbfcfe;
}

.targets-gov-block h6 {
    margin-bottom: 0.75rem;
}

.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
    border: 0;
    box-shadow: var(--shadow);
}

.notif-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.notif-item.unread { background: rgba(94, 114, 228, 0.06); }
.notif-item:hover { background: rgba(0, 0, 0, 0.03); }

.timeline { position: relative; padding-left: 30px; }

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
    padding-left: 10px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(310deg, #17ad37, #98ec2d);
    border: 2px solid #fff;
}

/* Login — Soft UI white */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #f8f9fa;
}

.login-page::before,
.login-page::after { display: none; }

.login-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    border: 0;
    overflow: hidden;
    max-width: 420px;
    width: 100%;
    animation: loginIn 0.4s ease;
}

@keyframes loginIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    background: #fff;
    color: var(--text-primary);
    padding: 2rem 2rem 1rem;
    text-align: center;
    border-bottom: 0;
}

.login-header h4 {
    font-weight: 700;
    margin-top: 0.35rem;
    color: var(--text-primary);
}

.login-logo {
    max-width: 260px;
    width: 100%;
    height: auto;
    margin-bottom: 1rem;
    display: inline-block;
}

.login-body { padding: 0.5rem 2rem 2rem; }

.btn-lang {
    border: 1px solid #d2d6da;
    color: var(--text-primary);
    background: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    box-shadow: none;
}

.btn-lang:hover,
.btn-lang.active {
    background: #344767;
    border-color: #344767;
    color: #fff;
}

.lang-flag { font-weight: 700; font-size: 0.8rem; }

.feature-panel {
    border: 0;
    border-radius: var(--radius);
    background: #ffffff;
    padding: 1.25rem;
    height: 100%;
    box-shadow: var(--shadow);
}

.feature-panel .panel-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(310deg, #2152ff, #21d4fd);
    color: #fff;
    margin-bottom: 0.85rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-hero {
    background: #ffffff;
    border: 0;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.badge-current {
    background: rgba(130, 214, 22, 0.15);
    color: #17ad37;
    border: 0;
    font-weight: 600;
}

.chart-container { position: relative; height: 280px; }

.qr-container {
    text-align: center;
    padding: 1rem;
    background: #fff;
    border-radius: 0.75rem;
    display: inline-block;
}

.alert {
    border-radius: 0.75rem;
    border: 0;
    box-shadow: var(--shadow-sm);
}

/* Public layout: full-width on desktop; mobile drawer = language only */
body.public-layout { background: var(--bg-body); }
body.public-layout .content {
    margin-left: 0;
    margin-right: 0;
}
body.public-layout .sidebar-public {
    display: none;
}

@media (min-width: 992px) {
    body.public-layout #sidebarToggle {
        display: none !important;
    }
    body.public-layout .navbar-page-title {
        display: none !important;
    }
}

@media (max-width: 991.98px) {
    body.public-layout .sidebar-public {
        display: flex;
    }
}

.public-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.gov-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gov-card {
    background: #ffffff;
    border: 0;
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.gov-card:hover { transform: translateY(-3px); }

.gov-card .gov-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 0.65rem;
    color: var(--text-primary);
}

.gov-card .gov-count {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
    color: var(--text-primary);
}

.gov-card .gov-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
    font-weight: 600;
}

.info-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-card {
    background: #ffffff;
    border: 0;
    border-radius: var(--radius);
    padding: 1.1rem;
    box-shadow: var(--shadow);
    position: relative;
}

.info-card .info-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.75rem;
    background: linear-gradient(310deg, #2152ff, #21d4fd);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
    color: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-card .info-value {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.info-card .info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
    font-weight: 600;
}

.public-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.85rem;
    color: var(--text-primary);
}

.public-filter-bar {
    background: #ffffff;
    border: 0;
    border-radius: var(--radius);
    padding: 1.15rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

@media (max-width: 1199.98px) {
    .navbar-user-name {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: bottom;
    }
    #dashboardFilterForm .col-md-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 991.98px) {
    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }
    .sidebar {
        margin: 0;
        height: 100%;
        height: 100dvh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateX(-105%);
        overflow-x: hidden;
        overflow-y: auto;
        width: min(300px, 86vw);
        z-index: 1050;
        pointer-events: none;
        visibility: hidden;
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0);
        pointer-events: auto;
        visibility: visible;
        box-shadow: var(--shadow);
    }
    .content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
        max-width: 100vw;
        z-index: 1;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1045;
        display: none;
        -webkit-tap-highlight-color: transparent;
    }
    .sidebar-overlay.show { display: block; }
    .top-navbar .search-form { display: none !important; }
    .top-navbar .container-fluid {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        flex-wrap: nowrap;
    }
    .page-content {
        padding: 0.85rem 0.85rem 1.25rem;
        overflow-x: clip;
    }
    .chart-container { height: 240px; }
    #studentsReturnMap { height: 340px; }
    .drilldown-card .table { font-size: 0.85rem; }
    #dashboardFilterForm .col-md-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .table-responsive,
    .dataTables_wrapper {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    .table-responsive > .table,
    .dataTables_wrapper table.dataTable {
        min-width: 720px;
    }
    .students-list-table {
        min-width: 860px;
    }
}

@media (max-width: 767.98px) {
    .stat-card .stat-value { font-size: 1.15rem; }
    .stat-card .stat-label { font-size: 0.72rem; }
    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }
    .workflow-steps { flex-wrap: wrap; gap: 0.5rem; }
    .workflow-step .step-label { display: none; }
    .page-content { padding: 0.7rem 0.75rem 1rem; }
    .login-header, .login-body { padding-left: 1.25rem; padding-right: 1.25rem; }
    .page-hero h4 { font-size: 1.05rem; }
    .page-hero { margin-bottom: 1rem !important; }
    .info-card-grid { grid-template-columns: 1fr 1fr; }
    .register-actions .btn { width: 100%; }
    .sticky-actions {
        position: sticky;
        bottom: 0;
        z-index: 20;
        background: var(--bg-card);
        padding: 0.75rem;
        border-top: 1px solid var(--border-color);
        display: grid;
        gap: 0.5rem;
    }
    .table-responsive {
        font-size: 0.82rem;
        -webkit-overflow-scrolling: touch;
        margin-inline: -0.15rem;
        padding-bottom: 0.25rem;
    }
    .public-filter-bar .col-md-2,
    #dashboardFilterForm .col-md-2,
    #dashboardFilterForm > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .card-header { font-size: 0.9rem; }
    .chart-container { height: 220px; }
    .row.g-3 > [class*="col-"] { margin-bottom: 0; }
    .navbar-page-title { font-size: 0.88rem; max-width: 55vw; }
    .drilldown-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.65rem;
    }
    .drilldown-breadcrumb { width: 100%; overflow-x: auto; }
    .drilldown-student-filters .col-md-3,
    .drilldown-student-filters .col-md-2 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .form-control, .form-select, .btn { min-height: 38px; }
    .modal-dialog { margin: 0.5rem; }
}

@media (max-width: 575.98px) {
    .info-card-grid { grid-template-columns: 1fr; }
    .logo-text h5 { font-size: 0.8rem; }
    #studentsReturnMap { height: 260px; }
    .col-6.col-md-4.col-xl-3 { flex: 0 0 100%; max-width: 100%; }
    .stat-card .d-flex { gap: 0.75rem !important; }
    .top-navbar { padding: 0.75rem 0.65rem 0.35rem; }
    .sidebar-header { padding: 1rem; }
    .sidebar-account { padding: 0.65rem 0.85rem; }
    .footer { padding: 0.75rem; font-size: 0.8rem; }
    .drilldown-student-filters .col-md-3,
    .drilldown-student-filters .col-md-2,
    .drilldown-student-filters .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .drilldown-title { font-size: 1rem; }
    .container-fluid { padding-left: 0.65rem; padding-right: 0.65rem; }
}

@media (max-width: 379.98px) {
    .navbar-page-title { max-width: 48vw; font-size: 0.8rem; }
    .stat-card .stat-value { font-size: 1.05rem; }
    .sidebar { width: min(280px, 92vw); }
}

/* Modern register form */
.form-section-header {
    background: linear-gradient(135deg, #0f3d5c, #1a5276);
    color: #fff;
    font-weight: 600;
}
.register-page .form-section {
    border: 0;
    box-shadow: var(--shadow);
    border-radius: 14px;
    overflow: hidden;
}
.register-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}
.offline-hint {
    border-radius: 12px;
}
.offline-sync-bar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    bottom: 1rem;
    z-index: 1080;
    background: #1a5276;
    color: #fff;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
    transition: transform .25s ease;
    max-width: calc(100vw - 1.5rem);
    font-size: 0.85rem;
}
.offline-sync-bar.show { transform: translateX(-50%) translateY(0); }
.offline-sync-bar.offline { background: #b45309; }
.offline-sync-bar.syncing { background: #0f766e; }
.offline-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1090;
    min-width: 240px;
    box-shadow: var(--shadow);
}

.dark-theme .card,
.dark-theme .stat-card,
.dark-theme .gov-card,
.dark-theme .info-card,
.dark-theme .feature-panel,
.dark-theme .public-filter-bar,
.dark-theme .page-hero,
.dark-theme .login-card {
    background: var(--bg-card);
    color: var(--text-primary);
}

.dark-theme .form-control,
.dark-theme .form-select {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark-theme .text-muted { color: var(--text-muted) !important; }
.dark-theme .btn-close { filter: invert(1) grayscale(100%); }

.dark-theme .public-topbar {
    background: rgba(32, 41, 64, 0.92);
}

.dark-theme .sidebar-nav .nav-link i {
    background: var(--bg-muted);
    color: var(--text-primary);
}

/* Dashboard drill-down table */
.drilldown-panel { margin-top: 0.25rem; }
.drilldown-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(22, 58, 95, 0.06);
    overflow: hidden;
}
.drilldown-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.25rem 0.85rem;
    background: linear-gradient(180deg, #f7fafc 0%, #ffffff 100%);
    border-bottom: 1px solid #e8eef4;
}
.drilldown-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #163a5f;
}
.drilldown-subtitle {
    margin-top: 0.25rem;
    font-size: 0.82rem;
    color: #6b7c8f;
}
.drilldown-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
}
.drilldown-breadcrumb .crumb-link {
    border: 0;
    background: #eef4fa;
    color: #1a5276;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-weight: 600;
    cursor: pointer;
}
.drilldown-breadcrumb .crumb-link:hover { background: #dceaf6; }
.drilldown-breadcrumb .crumb-sep { color: #9aabbc; }
.drilldown-breadcrumb .crumb-current {
    color: #163a5f;
    font-weight: 700;
    padding: 0.28rem 0.2rem;
}
.drilldown-student-filters {
    padding: 0.85rem 1.25rem;
    background: #fbfcfe;
    border-bottom: 1px solid #e8eef4;
}
.drilldown-table {
    --bs-table-bg: transparent;
    margin: 0;
}
.drilldown-table thead th {
    background: #f3f7fb;
    color: #5f7388;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    border-bottom: 1px solid #e2eaf1;
    white-space: nowrap;
    padding: 0.85rem 1rem;
}
.drilldown-table tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-color: #eef2f6;
    color: #1b2a3a;
    font-weight: 600;
    font-size: 0.92rem;
}
.drilldown-table tbody tr.drilldown-row {
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease;
}
.drilldown-table tbody tr.drilldown-row:hover {
    background: #f4f9ff;
}
.drilldown-table .dd-name { margin-inline-end: 0.45rem; }
.drilldown-table .dd-chevron {
    color: #9db0c3;
    font-size: 0.7rem;
}
.drilldown-table .dd-formal { color: #0f766e; }
.drilldown-table .dd-nonformal { color: #6d28d9; }
.drilldown-table .dd-returned { color: #1d4ed8; }
.drilldown-table .dd-notreturned { color: #b45309; }
.drilldown-table tfoot .drilldown-total td {
    background: #f7fafc;
    font-weight: 800;
    color: #163a5f;
    border-top: 1px solid #dce6f0;
    padding: 0.85rem 1rem;
}
.dd-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.dd-badge-ok { background: #e7f8ef; color: #0f7a45; }
.dd-badge-warn { background: #fff4e5; color: #9a5b00; }
.dd-badge-formal { background: #e7f6f5; color: #0f766e; }
.dd-badge-nonformal { background: #f1e9ff; color: #6d28d9; }
.dd-badge-muted { background: #eef1f4; color: #6b7785; }
.dd-student-link {
    color: #1a5276;
    text-decoration: none;
    font-weight: 700;
}
.dd-student-link:hover { text-decoration: underline; }

.dark-theme .drilldown-card,
.dark-theme .drilldown-header,
.dark-theme .drilldown-student-filters,
.dark-theme .drilldown-table thead th,
.dark-theme .drilldown-table tfoot .drilldown-total td {
    background: var(--bg-card, #202940);
    color: var(--text-primary, #e8eef6);
    border-color: rgba(255,255,255,0.06);
}
.dark-theme .drilldown-subtitle { color: var(--text-muted, #9aa8bc); }
.dark-theme .drilldown-breadcrumb .crumb-link { background: rgba(255,255,255,0.08); color: #d7e6f5; }
.dark-theme .drilldown-table tbody tr.drilldown-row:hover { background: rgba(255,255,255,0.04); }

/* School combobox: dropdown list + type-to-suggest */
.school-picker {
    position: relative;
}
.school-picker-control {
    position: relative;
    display: flex;
    align-items: stretch;
}
.school-picker-input {
    padding-inline-end: 2.4rem;
}
.school-picker-input:disabled {
    background: #f1f3f5;
}
.school-picker-toggle {
    position: absolute;
    inset-inline-end: 0;
    top: 0;
    bottom: 0;
    width: 2.4rem;
    border: 0;
    background: transparent;
    color: #8392ab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.school-picker-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.school-picker.is-open .school-picker-toggle i {
    transform: rotate(180deg);
}
.school-picker-menu {
    position: absolute;
    z-index: 1080;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(52, 71, 103, 0.14);
}
.school-picker-row {
    display: flex;
    align-items: stretch;
}
.school-picker-option {
    display: block;
    flex: 1 1 auto;
    width: auto;
    text-align: start;
    border: 0;
    background: transparent;
    padding: 0.55rem 0.85rem;
    font-size: 0.9rem;
    color: #344767;
    cursor: pointer;
}
.school-picker-option:hover,
.school-picker-option.is-active {
    background: #eef6ff;
}
.school-picker-edit {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #5e72e4;
    padding: 0 0.7rem;
    cursor: pointer;
}
.school-picker-edit:hover {
    background: #eef6ff;
    color: #324cdd;
}
.school-picker-empty {
    padding: 0.65rem 0.85rem;
    color: #8392ab;
    font-size: 0.85rem;
}

@media print {
    .sidebar, .top-navbar, .footer, .public-topbar { display: none !important; }
    .content { margin-left: 0 !important; }
}
