:root {
    --primary: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --secondary: #06b6d4;
    --bg-dark: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.7);
    --card-bg: rgba(30, 41, 59, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --sidebar-width: 260px;
    --header-height: 80px;
}

/* Class Cards & Grids */
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.class-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.class-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.class-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.class-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.class-name {
    font-size: 20px;
    font-weight: 700;
}

.class-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-glow);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.class-stats {
    display: flex;
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-val {
    font-weight: 700;
    font-size: 18px;
}

.stat-lbl {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Avatar Circle */
.avatar-circle {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: var(--bg-dark);
    text-transform: uppercase;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 48px;
}

.logo-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 0 20px var(--primary-glow);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 8px;
    transition: var(--transition);
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-glow);
    border: 1px solid var(--glass-border);
}

.nav-icon {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding-top: 24px;
}

.sidebar-foo.mt-1 {
    margin-top: 10px;
}

.mt-32 {
    margin-top: 32px;
}

.mb-32 {
    margin-bottom: 32px;
}

.mt-8 {
    margin-top: 8px;
}

/* Schools Table */
.schools-table {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}

td {
    font-size: 14px;
}

.text-center {
    text-align: center;
}

.pill {
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
}

.pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pill.active {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.status-card {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.status-indicator.invited {
    background: #f59e0b;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.status-indicator.offline {
    background: #ef4444;
}

.status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--header-height);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    gap: 32px;
}

.page-title-box h1 {
    font-size: 24px;
    font-weight: 700;
}

.page-title-box p {
    font-size: 14px;
    color: var(--text-muted);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 24px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 100px;
}

.sync-icon {
    width: 14px;
    height: 14px;
}

.syncing .sync-icon {
    animation: rotate 2s linear infinite;
    color: var(--primary);
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-profile {
    position: relative;
    cursor: pointer;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px;
    min-width: 160px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1001;
}

.user-profile:hover .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.btn-logout svg {
    opacity: 0.8;
}

.view-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

/* Cards & Forms */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
}

.form-card {
    max-width: 800px;
    margin: 0 auto;
}

.card-header {
    margin-bottom: 32px;
}

.card-header h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.card-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-width {
    grid-column: span 2;
}

label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

input,
select,
textarea {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.form-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}


/* Badges & Pills */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

.filter-pill {
    transition: var(--transition);
}

.filter-pill.active {
    background: var(--primary) !important;
    color: var(--bg-dark) !important;
}

/* Search Bar Styles */
.search-container {
    position: relative;
    margin-bottom: 24px;
    max-width: 450px;
    width: 100%;
}

.search-container.global-search {
    margin: 0;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    pointer-events: none;
    opacity: 0.7;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 42px !important;
    font-size: 14px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    /* Slightly brighter */
    border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
    /* Thicker and clearer border */
    border-radius: 12px !important;
    color: #fff !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-glow), 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

/* Global Top Bar Items Alignment */
.page-title-box {
    flex-shrink: 0;
}

.top-bar-actions {
    flex-shrink: 0;
}

/* Modal Overlay Enhancement */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* ─── STATS GRIDS ─────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ─── HAMBURGER BUTTON (hidden on desktop) ───────────────────────────────── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: rgba(255,255,255,0.05);
}

/* ─── SIDEBAR OVERLAY (mobile) ───────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

/* ─── TABLET: Collapse sidebar to icons ─────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
        padding: 16px 10px;
        overflow: hidden;
    }

    .sidebar span,
    .logo-text,
    .sidebar-footer .status-text,
    .nav-item span {
        display: none;
    }

    .sidebar-header {
        margin-bottom: 24px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .logo-box {
        justify-content: center;
    }

    .top-bar {
        padding: 0 20px;
        gap: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* ─── MOBILE: Full overlay sidebar ─────────────────────────────────────── */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    /* Show hamburger */
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar becomes a slide-in overlay */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 260px !important;
        padding: 24px;
        z-index: 200;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Show all sidebar text again when open */
    .sidebar.mobile-open span,
    .sidebar.mobile-open .logo-text,
    .sidebar.mobile-open .status-text,
    .sidebar.mobile-open .nav-item span {
        display: initial;
    }

    .sidebar.mobile-open .nav-item {
        justify-content: flex-start;
    }

    .sidebar.mobile-open .logo-box {
        justify-content: flex-start;
    }

    /* Show overlay when sidebar is open */
    .sidebar-overlay.active {
        display: block;
    }

    /* Main content takes full width */
    .main-content {
        width: 100%;
    }

    /* Compact top bar */
    .top-bar {
        padding: 0 16px;
        height: 60px;
        gap: 8px;
    }

    .page-title-box h1 {
        font-size: 18px;
    }

    .page-title-box p,
    .sync-status span,
    .page-subtitle {
        display: none;
    }

    .sync-status {
        padding: 6px 8px;
    }

    /* View content padding */
    .view-content {
        padding: 16px;
    }

    /* Cards */
    .card {
        padding: 20px;
        border-radius: 16px;
    }

    /* Forms: single column */
    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: span 1;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Stats grid: 2 columns */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    /* Class grid: 1 column */
    .class-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Tables: horizontal scroll */
    .schools-table,
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th, td {
        padding: 12px 10px;
        white-space: nowrap;
    }

    /* Modal: full screen */
    .modal-content {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
    }

    .modal-overlay {
        align-items: flex-end;
    }

    /* Search bar */
    .search-container {
        max-width: 100%;
    }

    .search-container.global-search {
        max-width: none;
        flex: 1;
    }

    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }
}

/* ─── SMALL PHONES ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .top-bar {
        height: 56px;
    }

    .view-content {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: 14px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    .modal-content {
        padding: 16px;
    }
}


@media print {
    body {
        background: white !important;
        color: black !important;
        overflow: visible !important;
    }

    /* Hide everything by default */
    .app-container,
    .sidebar,
    .top-bar,
    .view-content,
    .btn,
    .sync-status,
    #report-filter-container {
        display: none !important;
    }

    /* Show only the modal content */
    #modal-container {
        position: relative !important;
        display: block !important;
        background: white !important;
        backdrop-filter: none !important;
    }

    .modal-overlay {
        position: relative !important;
        background: white !important;
        display: block !important;
        padding: 0 !important;
    }

    .modal-content {
        width: 100% !important;
        max-width: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
    }

    .schools-table table {
        border: 1px solid #eee;
    }

    th {
        color: #333 !important;
        border-bottom: 2px solid #333 !important;
    }

    td {
        border-bottom: 1px solid #eee !important;
        color: black !important;
    }

    .text-muted {
        color: #666 !important;
    }

    #modal-title {
        color: black !important;
        font-size: 24pt !important;
    }

    .badge {
        border: 1px solid #ccc !important;
        background: transparent !important;
        color: black !important;
    }
}