/* ============================================================
   School Management System - Main Stylesheet
   Premium SaaS-quality design with mobile-first approach
   ============================================================ */

/* ----------------------------------------------------------
   CSS Variables / Theme
   ---------------------------------------------------------- */
:root {
    --primary: #1a73e8;
    --primary-light: #e8f0fe;
    --primary-dark: #1557b0;
    --primary-darker: #0d3b7a;
    --secondary: #00897b;
    --secondary-light: #e0f2f1;
    --secondary-dark: #00695c;
    --accent: #f4b400;
    --accent-light: #fef3cd;
    --success: #34a853;
    --success-light: #e6f4ea;
    --danger: #ea4335;
    --danger-light: #fce8e6;
    --warning: #fbbc04;
    --warning-light: #fef7e0;
    --info: #4285f4;
    --info-light: #e8f0fe;
    --bg-main: #f5f7fa;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f8f9fa;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-light: #9aa0a6;
    --text-inverse: #ffffff;
    --border: #e0e0e0;
    --border-light: #f0f0f0;
    --border-focus: #1a73e8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.16);
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
    --font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Consolas', 'Courier New', monospace;
    --z-sidebar: 1000;
    --z-header: 900;
    --z-overlay: 1100;
    --z-modal: 1200;
    --z-toast: 1300;
    --z-tooltip: 1400;
}


/* ----------------------------------------------------------
   Reset & Base Styles
   ---------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-light) transparent;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

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

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

::selection {
    background-color: var(--primary-light);
    color: var(--primary-dark);
}

/* Focus visible outline for accessibility */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* ----------------------------------------------------------
   App Layout
   ---------------------------------------------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}


/* ----------------------------------------------------------
   Sidebar
   ---------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary-darker) 100%);
    color: var(--text-inverse);
    z-index: var(--z-sidebar);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    /* Mobile: hidden by default */
    transform: translateX(-100%);
}

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

.sidebar-header {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.sidebar-school-name {
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-school-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-nav-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.5;
    margin-top: 0.5rem;
}

.sidebar-nav a,
.sidebar-nav button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.875rem;
    font-weight: 400;
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    text-align: inherit;
    position: relative;
    font-family: inherit;
}

.sidebar-nav a:hover,
.sidebar-nav button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-nav a.active,
.sidebar-nav button.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 500;
}

.sidebar-nav a.active::before,
.sidebar-nav button.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-badge {
    margin-inline-start: auto;
    background: var(--accent);
    color: var(--text-primary);
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-inline-start: auto;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

@media (min-width: 1024px) {
    .sidebar-close {
        display: none;
    }
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

.sidebar-logo-icon {
    font-size: 1.5rem;
    color: white;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8125rem;
}

.sidebar-user .material-symbols-rounded {
    font-size: 1.25rem;
}

.sidebar-user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active,
.sidebar-overlay.open {
    display: block;
    opacity: 1;
}


/* ----------------------------------------------------------
   Main Content Area
   ---------------------------------------------------------- */
.main-content {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Mobile: full width */
    width: 100%;
    transition: var(--transition);
}

.header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 0 1rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Hamburger icon */
.sidebar-toggle .hamburger {
    width: 20px;
    height: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-toggle .hamburger span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    transition: var(--transition-fast);
}

.page-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-spacer {
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.125rem;
    transition: var(--transition-fast);
    position: relative;
}

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

.header-btn .notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-white);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid var(--border-light);
    transition: var(--transition-fast);
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar:hover {
    border-color: var(--primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lang-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.625rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-fast);
    font-family: inherit;
}

.lang-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    font-size: 1.375rem;
}

.page-header p {
    margin-bottom: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-light);
    flex-wrap: wrap;
}

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

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

.breadcrumb-separator {
    font-size: 0.75rem;
}


/* ----------------------------------------------------------
   Cards
   ---------------------------------------------------------- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

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

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: var(--transition);
    border-top: 3px solid var(--primary);
    position: relative;
    overflow: hidden;
}

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

.stat-card.stat-primary   { border-top-color: var(--primary); }
.stat-card.stat-secondary { border-top-color: var(--secondary); }
.stat-card.stat-success   { border-top-color: var(--success); }
.stat-card.stat-warning   { border-top-color: var(--warning); }
.stat-card.stat-danger    { border-top-color: var(--danger); }
.stat-card.stat-info      { border-top-color: var(--info); }

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-primary .stat-card-icon   { background: var(--primary-light); color: var(--primary); }
.stat-secondary .stat-card-icon { background: var(--secondary-light); color: var(--secondary); }
.stat-success .stat-card-icon   { background: var(--success-light); color: var(--success); }
.stat-warning .stat-card-icon   { background: var(--warning-light); color: var(--warning); }
.stat-danger .stat-card-icon    { background: var(--danger-light); color: var(--danger); }
.stat-info .stat-card-icon      { background: var(--info-light); color: var(--info); }

.stat-card-content {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
}

.stat-card-change {
    font-size: 0.75rem;
    margin-top: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.stat-card-change.up {
    background: var(--success-light);
    color: var(--success);
}

.stat-card-change.down {
    background: var(--danger-light);
    color: var(--danger);
}


/* ----------------------------------------------------------
   Tables
   ---------------------------------------------------------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    white-space: nowrap;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table th {
    background: var(--bg-main);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.75rem 1rem;
    text-align: inherit;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

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

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .actions-cell {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Table with card wrapper */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.table-card .data-table th:first-child,
.table-card .data-table td:first-child {
    padding-inline-start: 1.25rem;
}

.table-card .data-table th:last-child,
.table-card .data-table td:last-child {
    padding-inline-end: 1.25rem;
}

/* Table toolbar */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-light);
}

.table-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Sortable column */
.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background: var(--border-light);
}

.data-table th.sort-asc::after {
    content: ' \25B2';
    font-size: 0.625rem;
}

.data-table th.sort-desc::after {
    content: ' \25BC';
    font-size: 0.625rem;
}

/* Empty table state */
.table-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-light);
}

.table-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.table-empty-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.table-empty-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}


/* ----------------------------------------------------------
   Forms
   ---------------------------------------------------------- */
.form-group {
    margin-bottom: 0.75rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-label .required {
    color: var(--danger);
    margin-inline-start: 0.125rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    outline: none;
    line-height: 1.5;
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-control:hover {
    border-color: var(--text-light);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.12);
}

.form-control.is-valid {
    border-color: var(--success);
}

.form-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

textarea.form-control {
    min-height: 70px;
    resize: vertical;
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6368' d='M3 5l3 3 3-3H3z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    line-height: 1.5;
}

.form-select:hover {
    border-color: var(--text-light);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* Custom checkbox & radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    position: relative;
    padding: 0.25rem 0;
    min-height: 1.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-check-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    background: var(--bg-white);
}

.form-check input[type="radio"] + .form-check-indicator {
    border-radius: 50%;
}

.form-check input:checked + .form-check-indicator {
    background: var(--primary);
    border-color: var(--primary);
}

.form-check input:checked + .form-check-indicator::after {
    content: '';
    display: block;
}

.form-check input[type="checkbox"]:checked + .form-check-indicator::after {
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.form-check input[type="radio"]:checked + .form-check-indicator::after {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.form-check:hover .form-check-indicator {
    border-color: var(--primary);
}

.form-check-label {
    cursor: pointer;
    user-select: none;
}

/* Toggle switch */
.form-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.form-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-switch-slider {
    width: 40px;
    height: 22px;
    background: var(--border);
    border-radius: var(--radius-full);
    position: relative;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.form-switch-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.form-switch input:checked + .form-switch-slider {
    background: var(--primary);
}

.form-switch input:checked + .form-switch-slider::after {
    transform: translateX(18px);
}

/* Form row (grid layout) */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Input group */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
    border-radius: 0;
}

.input-group .form-control:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .form-control:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-group-addon {
    display: flex;
    align-items: center;
    padding: 0 0.75rem;
    background: var(--bg-main);
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.input-group-addon:first-child {
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group-addon:last-child {
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}


/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.5;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    outline: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--text-inverse);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-inverse);
    border-color: var(--secondary);
}

.btn-secondary:hover {
    background: var(--secondary-dark);
    border-color: var(--secondary-dark);
    color: var(--text-inverse);
}

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
    border-color: var(--success);
}

.btn-success:hover {
    background: #2d9249;
    border-color: #2d9249;
    color: var(--text-inverse);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #d5372b;
    border-color: #d5372b;
    color: var(--text-inverse);
}

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

.btn-warning:hover {
    background: #e5ab00;
    border-color: #e5ab00;
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

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

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

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

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-outline-danger:hover {
    background: var(--danger-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-link {
    background: transparent;
    color: var(--primary);
    border-color: transparent;
    padding-inline: 0;
}

.btn-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    border-radius: var(--radius);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-icon.btn-sm {
    width: 30px;
    height: 30px;
}

.btn-icon.btn-lg {
    width: 44px;
    height: 44px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-group {
    display: inline-flex;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.btn-group .btn {
    border-radius: 0;
    margin-inline-start: -1.5px;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    margin-inline-start: 0;
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-lg);
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.fab:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-xl);
    transform: scale(1.05);
}


/* ----------------------------------------------------------
   Modal
   ---------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: flex-start;
    padding: 1rem;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modal-overlay.active,
.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    margin: auto;
    animation: modalSlideIn 0.3s ease;
    position: relative;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-full { max-width: calc(100vw - 2rem); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 1.125rem;
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.25rem;
    transition: var(--transition-fast);
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


/* ----------------------------------------------------------
   Badges / Tags
   ---------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-full);
    white-space: nowrap;
    background: var(--bg-main);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-secondary {
    background: var(--secondary-light);
    color: var(--secondary-dark);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: #8a6d00;
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-dot.success { background: var(--success); }
.badge-dot.danger  { background: var(--danger); }
.badge-dot.warning { background: var(--warning); }
.badge-dot.info    { background: var(--info); }


/* ----------------------------------------------------------
   Alerts
   ---------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1.125rem;
    margin-top: 0.0625rem;
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-content strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.alert-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: var(--transition-fast);
    padding: 0;
    line-height: 1;
    color: inherit;
}

.alert-close:hover {
    opacity: 1;
}

.alert-success {
    background: var(--success-light);
    border-color: #a8dab5;
    color: #1e7e34;
}

.alert-danger {
    background: var(--danger-light);
    border-color: #f5c6cb;
    color: #c0392b;
}

.alert-warning {
    background: var(--warning-light);
    border-color: #f5e79e;
    color: #856404;
}

.alert-info {
    background: var(--info-light);
    border-color: #b8d4fe;
    color: #31639c;
}


/* ----------------------------------------------------------
   Pagination
   ---------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding: 0.75rem 0;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
    text-decoration: none;
}

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

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

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-inline-start: 0.75rem;
}


/* ----------------------------------------------------------
   Search
   ---------------------------------------------------------- */
.search-global {
    position: relative;
    flex: 1;
    max-width: 400px;
    display: none;
}

.search-global .material-symbols-rounded {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.125rem;
    pointer-events: none;
}

[dir="rtl"] .search-global .material-symbols-rounded {
    right: auto;
    left: 0.75rem;
}

.search-global input {
    width: 100%;
    padding: 0.4rem 2.25rem 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-family: inherit;
    background: var(--bg-main);
    border: 1.5px solid transparent;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    transition: var(--transition-fast);
    outline: none;
}

[dir="rtl"] .search-global input {
    padding: 0.4rem 0.75rem 0.4rem 2.25rem;
}

.search-global input::placeholder {
    color: var(--text-light);
}

.search-global input:focus {
    background: var(--bg-white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.875rem 0.5rem 2.25rem;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-main);
    border: 1.5px solid transparent;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    transition: var(--transition-fast);
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-light);
}

.search-box input:focus {
    background: var(--bg-white);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.search-box-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    max-height: 400px;
    overflow-y: auto;
    z-index: var(--z-tooltip);
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:hover {
    background: var(--primary-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Inline search filter for tables */
.filter-search {
    position: relative;
    width: 100%;
    max-width: 280px;
}

.filter-search input {
    width: 100%;
    padding: 0.5rem 0.875rem 0.5rem 2.25rem;
    font-size: 0.8125rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

.filter-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.filter-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.8125rem;
    pointer-events: none;
}


/* ----------------------------------------------------------
   Login Page
   ---------------------------------------------------------- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1557b0 0%, #1a73e8 30%, #00897b 70%, #00695c 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    top: -150px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    bottom: -100px;
    left: -100px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.login-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
}

.login-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.25rem;
}

.login-form .form-group {
    margin-bottom: 0.75rem;
}

.login-form .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.login-footer a {
    color: var(--primary);
    font-weight: 500;
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}


/* ----------------------------------------------------------
   Dashboard Specific
   ---------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    padding: 1.25rem;
    min-height: 250px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.quick-action-btn:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);
}

.quick-action-icon {
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    color: var(--primary);
}

.quick-action-label {
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
}


/* ----------------------------------------------------------
   Attendance Specific
   ---------------------------------------------------------- */
.attendance-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.attendance-row:hover {
    box-shadow: var(--shadow-sm);
}

.attendance-student-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.attendance-student-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendance-student-id {
    font-size: 0.75rem;
    color: var(--text-light);
}

.attendance-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.present-btn,
.absent-btn,
.late-btn {
    padding: 0.375rem 0.875rem;
    border: 1.5px solid;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
    background: transparent;
}

.present-btn {
    border-color: var(--success);
    color: var(--success);
}

.present-btn:hover,
.present-btn.active {
    background: var(--success);
    color: white;
}

.absent-btn {
    border-color: var(--danger);
    color: var(--danger);
}

.absent-btn:hover,
.absent-btn.active {
    background: var(--danger);
    color: white;
}

.late-btn {
    border-color: var(--warning);
    color: #8a6d00;
}

.late-btn:hover,
.late-btn.active {
    background: var(--warning);
    color: var(--text-primary);
}

/* Attendance summary bar */
.attendance-summary {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.attendance-summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.attendance-summary-count {
    font-weight: 700;
    font-size: 1.125rem;
}


/* ----------------------------------------------------------
   Transfer Specific
   ---------------------------------------------------------- */
.transfer-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.transfer-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.transfer-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.transfer-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}

.transfer-card-info {
    flex: 1;
    min-width: 0;
}

.transfer-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.transfer-card-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.transfer-card-check {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.transfer-card.selected .transfer-card-check {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.transfer-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}


/* ----------------------------------------------------------
   Loading States
   ---------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.spinner-lg {
    width: 48px;
    height: 48px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-center {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    flex-direction: column;
    gap: 1rem;
}

.loading-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg,
        var(--border-light) 0%,
        #e8e8e8 40%,
        var(--border-light) 80%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-xs);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 0.625rem;
    width: 100%;
}

.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 70%; }

.skeleton-heading {
    height: 22px;
    width: 50%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius);
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Page loading overlay */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}


/* ----------------------------------------------------------
   Dropdown Menu
   ---------------------------------------------------------- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    min-width: 180px;
    z-index: var(--z-tooltip);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: var(--transition-fast);
    padding: 0.375rem 0;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5625rem 1rem;
    font-size: 0.8125rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: inherit;
    font-family: inherit;
}

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

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0.375rem 0;
}


/* ----------------------------------------------------------
   Tabs
   ---------------------------------------------------------- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
    white-space: nowrap;
    font-family: inherit;
}

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

.tab-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
}

.tab-content {
    padding: 1.25rem 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}


/* ----------------------------------------------------------
   Toast / Notifications
   ---------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
    width: calc(100% - 2rem);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    animation: toastSlideIn 0.3s ease;
    position: relative;
    pointer-events: auto;
}

.toast-success { border-inline-start: 4px solid var(--success); }
.toast-danger  { border-inline-start: 4px solid var(--danger); }
.toast-warning { border-inline-start: 4px solid var(--warning); }
.toast-info    { border-inline-start: 4px solid var(--info); }

.toast-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1rem;
    padding: 0.25rem;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ----------------------------------------------------------
   Tooltip
   ---------------------------------------------------------- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    pointer-events: none;
    z-index: var(--z-tooltip);
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}


/* ----------------------------------------------------------
   Avatar
   ---------------------------------------------------------- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--primary-light);
    color: var(--primary);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs { width: 24px; height: 24px; font-size: 0.625rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.25rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.75rem; }

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    border: 2px solid var(--bg-white);
    margin-inline-start: -0.5rem;
}

.avatar-group .avatar:first-child {
    margin-inline-start: 0;
}


/* ----------------------------------------------------------
   Progress Bar
   ---------------------------------------------------------- */
.progress {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--primary);
    transition: width 0.6s ease;
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

.progress-sm { height: 4px; }
.progress-lg { height: 12px; }


/* ----------------------------------------------------------
   Empty State
   ---------------------------------------------------------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.empty-state-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 320px;
    margin-bottom: 1.5rem;
}


/* ----------------------------------------------------------
   Divider
   ---------------------------------------------------------- */
.divider {
    height: 1px;
    background: var(--border-light);
    margin: 1.5rem 0;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.8125rem;
}

.divider-text::before,
.divider-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}


/* ----------------------------------------------------------
   Utility Classes
   ---------------------------------------------------------- */

/* Text alignment */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.text-start   { text-align: start; }
.text-end     { text-align: end; }

/* Text color */
.text-primary   { color: var(--primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-info      { color: var(--info) !important; }
.text-light     { color: var(--text-light) !important; }
.text-muted     { color: var(--text-light) !important; }

/* Font weight */
.fw-normal { font-weight: 400; }
.fw-medium { font-weight: 500; }
.fw-semibold { font-weight: 600; }
.fw-bold   { font-weight: 700; }

/* Font size */
.fs-sm { font-size: 0.8125rem; }
.fs-xs { font-size: 0.75rem; }
.fs-lg { font-size: 1.125rem; }

/* Margin top */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 2rem !important; }

/* Margin bottom */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 2rem !important; }

/* Margin inline */
.ms-auto { margin-inline-start: auto !important; }
.me-auto { margin-inline-end: auto !important; }
.mx-auto { margin-inline: auto !important; }
.ms-1 { margin-inline-start: 0.25rem !important; }
.ms-2 { margin-inline-start: 0.5rem !important; }
.ms-3 { margin-inline-start: 1rem !important; }
.me-1 { margin-inline-end: 0.25rem !important; }
.me-2 { margin-inline-end: 0.5rem !important; }
.me-3 { margin-inline-end: 1rem !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 2rem !important; }

.px-1 { padding-inline: 0.25rem !important; }
.px-2 { padding-inline: 0.5rem !important; }
.px-3 { padding-inline: 1rem !important; }
.px-4 { padding-inline: 1.5rem !important; }

.py-1 { padding-block: 0.25rem !important; }
.py-2 { padding-block: 0.5rem !important; }
.py-3 { padding-block: 1rem !important; }
.py-4 { padding-block: 1.5rem !important; }

/* Display */
.d-flex    { display: flex !important; }
.d-none    { display: none !important; }
.d-block   { display: block !important; }
.d-inline  { display: inline !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid    { display: grid !important; }

/* Flex utilities */
.flex-column    { flex-direction: column !important; }
.flex-row       { flex-direction: row !important; }
.flex-wrap      { flex-wrap: wrap !important; }
.flex-nowrap    { flex-wrap: nowrap !important; }
.flex-1         { flex: 1 !important; }
.flex-shrink-0  { flex-shrink: 0 !important; }
.align-items-center   { align-items: center !important; }
.align-items-start    { align-items: flex-start !important; }
.align-items-end      { align-items: flex-end !important; }
.justify-content-center  { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end     { justify-content: flex-end !important; }
.justify-content-start   { justify-content: flex-start !important; }

/* Gap */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* Width */
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

/* Overflow */
.overflow-auto   { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }

/* Border */
.border       { border: 1px solid var(--border) !important; }
.border-0     { border: 0 !important; }
.border-top   { border-top: 1px solid var(--border) !important; }
.border-bottom { border-bottom: 1px solid var(--border) !important; }
.rounded       { border-radius: var(--radius) !important; }
.rounded-sm    { border-radius: var(--radius-sm) !important; }
.rounded-lg    { border-radius: var(--radius-lg) !important; }
.rounded-full  { border-radius: var(--radius-full) !important; }

/* Shadow */
.shadow-none { box-shadow: none !important; }
.shadow-sm   { box-shadow: var(--shadow-sm) !important; }
.shadow      { box-shadow: var(--shadow) !important; }
.shadow-lg   { box-shadow: var(--shadow-lg) !important; }

/* Background */
.bg-white   { background-color: var(--bg-white) !important; }
.bg-main    { background-color: var(--bg-main) !important; }
.bg-primary-light { background-color: var(--primary-light) !important; }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }

/* Truncate text */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Visually hidden (accessible) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ----------------------------------------------------------
   Animations
   ---------------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeIn    { animation: fadeIn 0.3s ease; }
.animate-fadeInUp  { animation: fadeInUp 0.4s ease; }
.animate-fadeInDown { animation: fadeInDown 0.4s ease; }
.animate-scaleIn   { animation: scaleIn 0.3s ease; }

/* Page transition */
.page-enter {
    animation: fadeInUp 0.35s ease;
}


/* ----------------------------------------------------------
   Responsive Breakpoints (Mobile-First)
   ---------------------------------------------------------- */

/* Tablet: 768px and up */
@media (min-width: 768px) {

    .content-area {
        padding: 1.5rem;
    }

    .header {
        padding: 0 1.5rem;
    }

    .search-global {
        display: block;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }

    .transfer-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal {
        margin: 3rem auto;
    }

    .page-header {
        margin-bottom: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .login-card {
        padding: 3rem 2.5rem;
    }

    /* Hide on tablet+ */
    .d-md-none { display: none !important; }
    .d-md-flex { display: flex !important; }
    .d-md-block { display: block !important; }
}

/* Desktop: 1024px and up */
@media (min-width: 1024px) {

    .sidebar {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content {
        margin-inline-start: var(--sidebar-width);
    }

    .content-area {
        padding: 1.75rem 2rem;
    }

    .header {
        padding: 0 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Hide on desktop+ */
    .d-lg-none { display: none !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-block { display: block !important; }
}

/* Large screens: 1280px and up */
@media (min-width: 1280px) {

    .content-area {
        padding: 2rem 2.5rem;
    }

    .header {
        padding: 0 2.5rem;
    }

    .search-global {
        max-width: 480px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
    }

    /* Hide on large+ */
    .d-xl-none { display: none !important; }
    .d-xl-flex { display: flex !important; }
    .d-xl-block { display: block !important; }
}

/* Extra large screens: 1536px and up */
@media (min-width: 1536px) {

    .content-area {
        max-width: 1400px;
    }
}


/* ----------------------------------------------------------
   Print Styles
   ---------------------------------------------------------- */
@media print {

    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    .sidebar,
    .sidebar-overlay,
    .sidebar-toggle,
    .header,
    .fab,
    .btn,
    .pagination,
    .toast-container,
    .modal-overlay,
    .search-global,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }

    .content-area {
        padding: 0 !important;
    }

    .card {
        border: 1px solid #ccc !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .data-table {
        border-collapse: collapse;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #ccc !important;
        padding: 6px 8px !important;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666 !important;
    }

    .print-only {
        display: block !important;
    }
}

.print-only {
    display: none;
}


/* ----------------------------------------------------------
   Accessibility: Reduced Motion
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}


/* ----------------------------------------------------------
   Accessibility: High Contrast
   ---------------------------------------------------------- */
@media (forced-colors: active) {
    .btn {
        border: 2px solid currentColor;
    }

    .form-control,
    .form-select {
        border: 2px solid currentColor;
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* ----------------------------------------------------------
   Missing Styles: Filters, Input Icon, Toast, etc.
   ---------------------------------------------------------- */

/* Filters Row */
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.filters-row .form-select,
.filters-row .form-control {
    flex: 1;
    min-width: 120px;
    max-width: 200px;
    padding: 0.4rem 0.6rem;
    font-size: 0.8125rem;
}

.filters-row .search-box {
    flex: 1;
    min-width: 180px;
    max-width: 300px;
}

/* Input with icon */
.input-icon {
    position: relative;
}

.input-icon .material-symbols-rounded {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 0.75rem;
    color: var(--text-light);
    font-size: 1.125rem;
    pointer-events: none;
}

[dir="rtl"] .input-icon .material-symbols-rounded {
    right: auto;
    left: 0.75rem;
}

.input-icon .form-control {
    padding-right: 2.5rem;
}

[dir="rtl"] .input-icon .form-control {
    padding-right: 0.75rem;
    padding-left: 2.5rem;
}

/* Search box inline */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .material-symbols-rounded {
    position: absolute;
    right: 0.6rem;
    color: var(--text-light);
    font-size: 1.125rem;
    pointer-events: none;
}

[dir="rtl"] .search-box .material-symbols-rounded {
    right: auto;
    left: 0.6rem;
}

.search-box .search-input {
    width: 100%;
    padding: 0.4rem 2rem 0.4rem 0.6rem;
    font-size: 0.8125rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--bg-white);
    transition: var(--transition-fast);
    font-family: inherit;
}

[dir="rtl"] .search-box .search-input {
    padding: 0.4rem 0.6rem 0.4rem 2rem;
}

.search-box .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

[dir="rtl"] .toast-container {
    left: auto;
    right: 1rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.8125rem;
    animation: slideInUp 0.3s ease;
    min-width: 250px;
    max-width: 400px;
    pointer-events: auto;
}

.toast .material-symbols-rounded {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success { background: var(--success); }
.toast-danger { background: var(--danger); }
.toast-warning { background: #e65100; color: white; }
.toast-info { background: var(--info); }

.toast-hide {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dropdown list (for guardian search etc.) */
.dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}

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

.dropdown-item.disabled {
    color: var(--text-light);
    cursor: default;
}

/* Name cell with avatar */
.name-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.avatar-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Actions cell */
.actions-cell {
    display: flex;
    gap: 0.25rem;
    white-space: nowrap;
}

.btn-action {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

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

.btn-action.text-danger:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

/* Form section title */
.form-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-light);
}

/* Form grid */
.form-grid {
    display: grid;
    gap: 0;
}

/* Checkbox grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
}

.checkbox-grid .form-check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    font-size: 0.8125rem;
    border-radius: var(--radius-xs);
    transition: var(--transition-fast);
}

.checkbox-grid .form-check:hover {
    background: var(--bg-white);
}

.checkbox-grid .form-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Profile details */
.profile-details {
    padding: 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8125rem;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Student profile */
.student-profile .profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.profile-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo .material-symbols-rounded {
    font-size: 2rem;
    color: var(--primary);
}

.profile-info h3 {
    font-size: 1rem;
    margin: 0;
}

.profile-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0.125rem 0 0;
}

/* Tree view (Academic) */
.tree-card {
    margin-bottom: 1rem;
}

.tree-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tree-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tree-title h3 {
    font-size: 0.9375rem;
    margin: 0;
}

.tree-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.tree-children {
    padding: 0.75rem 1rem;
}

.tree-grade {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.tree-grade:last-child {
    border-bottom: none;
}

.tree-grade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.4rem;
}

.tree-classes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding-top: 0.25rem;
}

.tree-class-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-main);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
}

.tag-edit, .tag-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-light);
    display: flex;
    align-items: center;
}

.tag-edit:hover { color: var(--primary); }
.tag-delete:hover { color: var(--danger); }

/* Attendance */
.attendance-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.attendance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    gap: 0.5rem;
}

.attendance-student {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.attendance-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.attendance-name {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendance-toggle {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.att-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-white);
    cursor: pointer;
    font-size: 0.6875rem;
    font-family: inherit;
    transition: var(--transition-fast);
    color: var(--text-secondary);
}

.att-btn .material-symbols-rounded {
    font-size: 0.875rem;
}

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

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

/* Transfer */
.transfer-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
}

.transfer-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}

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

.transfer-item input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.transfer-name {
    flex: 1;
}

.transfer-class {
    color: var(--text-light);
    font-size: 0.75rem;
}

.transfer-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* List items in settings */
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8125rem;
}

.list-item:last-child {
    border-bottom: none;
}

/* Fee summary */
.fee-summary {
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

/* Confirm message */
.confirm-message {
    text-align: center;
    font-size: 0.9375rem;
    padding: 1rem 0;
}

/* Empty states */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    text-align: center;
}

.empty-state .material-symbols-rounded {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.empty-state-sm {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Dashboard chart bars */
.chart-bars {
    padding: 0.5rem 0;
}

.chart-bar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.chart-bar-label {
    width: 70px;
    font-size: 0.75rem;
    text-align: end;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.chart-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-main);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-xs);
    transition: width 0.5s ease;
    min-width: 2px;
}

.chart-bar-value {
    width: 30px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: start;
    flex-shrink: 0;
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* Recent items */
.recent-list {
    padding: 0;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.recent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recent-avatar .material-symbols-rounded {
    font-size: 1.25rem;
    color: var(--primary);
}

.recent-name {
    font-size: 0.8125rem;
    font-weight: 500;
}

.recent-meta {
    font-size: 0.6875rem;
    color: var(--text-light);
}

/* Text helpers */
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }

/* Global search results */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 0.25rem;
}

.search-group {
    padding: 0.25rem 0;
}

.search-group-title {
    padding: 0.4rem 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.8125rem;
    transition: var(--transition-fast);
}

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

.search-item .material-symbols-rounded {
    font-size: 1rem;
    color: var(--text-light);
}

.search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.8125rem;
}

/* Login language button */
.login-lang {
    text-align: center;
    margin-top: 1rem;
}

/* Card header with actions */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 0.9375rem;
    margin: 0;
}

.card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-light);
}

/* Responsive filters */
@media (max-width: 767px) {
    .filters-row {
        flex-direction: column;
    }

    .filters-row .form-select,
    .filters-row .form-control,
    .filters-row .search-box {
        max-width: 100%;
        width: 100%;
    }

    .attendance-row {
        flex-direction: column;
        align-items: stretch;
    }

    .attendance-toggle {
        justify-content: flex-end;
    }

    .transfer-list {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .transfer-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
