@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --primary: #0d5c3f;
    --primary-light: #11785a;
    --primary-dark: #093d2a;
    --primary-50: #e8f5ef;
    --accent: #d4a843;
    --accent-light: #fef9e7;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --sidebar-w: 260px;
    --radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

/* ====== SHARED LAYOUT ====== */
.layout-container { display: flex; min-height: 100vh; }

.sidebar-main {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    position: fixed; top: 0; left: 0; bottom: 0;
    overflow-y: auto; z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-header-top {
    display: flex; align-items: center; justify-content: space-between;
}
.sidebar-logo-area {
    display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
}
.sidebar-logo-img {
    width: 40px; height: 40px; object-fit: contain;
    border-radius: 8px; background: rgba(255,255,255,0.15);
    padding: 4px; flex-shrink: 0;
}
.sidebar-logo-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    background: rgba(255,255,255,0.15); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-text { min-width: 0; }
.sidebar-brand {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 15px; font-weight: 700; color: white;
    letter-spacing: 0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-school {
    font-size: 10px; color: rgba(255,255,255,0.55);
    margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav { padding: 8px 0; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 18px; color: rgba(255,255,255,0.7);
    font-size: 13.5px; font-weight: 600; transition: all 0.2s;
    border-left: 3px solid transparent; cursor: pointer;
    text-decoration: none !important;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-item.active { background: rgba(255,255,255,0.12); color: white; border-left-color: var(--accent); }
.nav-item svg { opacity: 0.7; flex-shrink: 0; transition: transform 0.2s; }
.nav-item:hover svg { opacity: 1; transform: translateX(2px); }
.nav-item.disabled { opacity: 0.4; pointer-events: none; }

.nav-group-label {
    padding: 10px 18px 5px;
    font-size: 10px; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
}
.nav-divider { border-top: 1px solid rgba(255,255,255,0.08); margin: 10px 16px; }

.content-wrapper {
    margin-left: var(--sidebar-w); flex: 1; min-height: 100vh;
    background: var(--bg); transition: margin-left 0.3s;
}

.topbar-main {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 13px 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 500;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--primary-dark); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }

.page-container {
    padding: 28px;
    max-width: 1400px;
    margin: 0 auto;
    animation: fadeIn 0.35s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== CARDS ====== */
.card {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
}
.card-header {
    padding: 16px 22px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.card-body { padding: 22px; }

/* ====== STATS ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: white; border-radius: var(--radius);
    padding: 22px; display: flex; align-items: center; gap: 18px;
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-body { flex: 1; min-width: 0; }
.stat-value { font-size: 30px; font-weight: 800; color: var(--primary-dark); line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 5px; }
.stat-info .stat-icon { background: var(--info-light); color: var(--info); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-gold .stat-icon { background: var(--warning-light); color: var(--warning); }

/* ====== TABLES ====== */
.table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100% !important; min-width: 100%; border-collapse: collapse; font-size: 13.5px;
    table-layout: auto;
}
.table th {
    padding: 13px 15px; text-align: left; font-weight: 700;
    color: var(--primary-dark); font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.8px; border-bottom: 2px solid var(--border); background: #f8fafc;
    white-space: nowrap;
}
.table td {
    padding: 13px 15px; border-bottom: 1px solid var(--border);
    vertical-align: middle; color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fcfdfe; }

/* ====== TOOLBAR ====== */
.toolbar {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 10px; margin-bottom: 18px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; min-width: 8px; }

.search-box {
    display: flex; align-items: center; gap: 8px;
    background: white; border: 1px solid var(--border);
    border-radius: 8px; padding: 0 12px; height: 36px;
    min-width: 200px; max-width: 300px;
}
.search-box svg { color: var(--text-secondary); flex-shrink: 0; }
.search-box input {
    border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 13px; color: var(--text);
    width: 100%; min-width: 0;
}
.search-box input::placeholder { color: var(--text-secondary); }

.per-page-select {
    height: 36px; padding: 0 10px; border: 1px solid var(--border);
    border-radius: 8px; background: white; font-family: inherit;
    font-size: 13px; color: var(--text); cursor: pointer; outline: none;
}

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.2s; white-space: nowrap;
    text-decoration: none !important; line-height: 1.4;
}
.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); opacity: 1; }
.btn-secondary { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); opacity: 1; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; opacity: 1; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; opacity: 1; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; opacity: 1; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.action-group {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* ====== BADGES ====== */
.badge {
    display: inline-flex; padding: 3px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.badge-success   { background: var(--success-light); color: var(--success); }
.badge-danger    { background: var(--danger-light); color: var(--danger); }
.badge-info      { background: var(--info-light); color: var(--info); }
.badge-warning   { background: var(--warning-light); color: var(--warning); }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* ====== FORMS ====== */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 13px; font-weight: 600;
    color: var(--text); margin-bottom: 6px;
}
.form-input {
    width: 100%; padding: 9px 13px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; color: var(--text);
    background: white; transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus {
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px var(--primary-50);
}
.form-input[type="file"] { padding: 7px 10px; cursor: pointer; }
.form-input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.form-select {
    width: 100%; padding: 9px 13px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; color: var(--text);
    background: white; cursor: pointer; outline: none;
    appearance: auto; transition: border-color 0.2s;
}
.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.form-select-sm { height: 36px; padding: 4px 10px; font-size: 13px; width: auto; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-textarea {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 13.5px; font-family: inherit; color: var(--text);
    background: white; outline: none; resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s; line-height: 1.6;
}
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.form-section { margin-bottom: 20px; }
.form-section-title {
    font-size: 12px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1px; color: var(--primary); margin-bottom: 14px;
    padding-bottom: 8px; border-bottom: 2px solid var(--primary-50);
}

/* ====== GRIDS ====== */
.grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.grid-3 {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px;
}

/* ====== FLEX UTILITIES ====== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* ====== SPACING UTILITIES ====== */
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

/* ====== TEXT UTILITIES ====== */
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ====== TAB BAR ====== */
.tab-bar {
    display: flex; gap: 4px; flex-wrap: wrap;
    margin-bottom: 20px;
    background: white; padding: 6px;
    border-radius: 10px; border: 1px solid var(--border);
}
.tab-btn {
    padding: 8px 16px; border-radius: 7px;
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
    transition: all 0.2s; text-decoration: none !important;
    white-space: nowrap;
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--primary); color: white; }

/* ====== MODALS ====== */
.modal-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000; align-items: center; justify-content: center; padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal-dialog {
    background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
    max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-dialog-lg { max-width: 760px; }
.modal-header {
    padding: 18px 22px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; background: white; z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--primary-dark); }
.modal-close {
    width: 30px; height: 30px; border-radius: 6px;
    background: var(--bg); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 16px;
    transition: all 0.2s; text-decoration: none !important;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 22px; }
.modal-footer {
    padding: 14px 22px; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 10px;
    background: #f8fafc; border-radius: 0 0 16px 16px;
    position: sticky; bottom: 0;
}

/* ====== ALERTS ====== */
.alert {
    padding: 13px 18px; border-radius: 10px; margin-bottom: 18px;
    font-size: 13.5px; font-weight: 500;
    display: flex; align-items: flex-start; gap: 12px;
}
.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: #1e40af; border: 1px solid #93c5fd; }

/* ====== EMPTY STATE ====== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-state-icon  { font-size: 42px; margin-bottom: 12px; }
.empty-state-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state-sub   { font-size: 13px; color: var(--text-secondary); }

/* ====== LOGIN ====== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 20px; padding: 40px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}

/* ====== RESPONSIVE / HAMBURGER ====== */
.hamburger-btn {
    display: none; width: 38px; height: 38px;
    background: none; border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; flex-direction: column; justify-content: center;
    align-items: center; gap: 5px; flex-shrink: 0;
}
.hamburger-btn span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; display: block; }

.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 999;
}
.sidebar-overlay.active { display: block; }

.sidebar-close-btn {
    display: none; background: rgba(255,255,255,0.12); border: none;
    color: white; width: 30px; height: 30px; border-radius: 6px;
    cursor: pointer; font-size: 16px; flex-shrink: 0;
    align-items: center; justify-content: center;
}

@media (max-width: 992px) {
    .sidebar-main { transform: translateX(-100%); width: 280px; }
    .sidebar-main.open { transform: translateX(0); }
    .content-wrapper { margin-left: 0 !important; }
    .hamburger-btn { display: flex; }
    .sidebar-close-btn { display: flex; }
    .grid-2 { grid-template-columns: 1fr !important; }
    .grid-3 { grid-template-columns: 1fr !important; }
    .tab-bar { overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 768px) {
    .alert { flex-direction: column; gap: 6px; }
}

@media (max-width: 600px) {
    .page-container { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr; }
    .tab-bar { gap: 3px; }
    .tab-btn { padding: 7px 10px; font-size: 12px; }
    .topbar-main { padding: 10px 14px; }
    .topbar-user { display: none; }
    .toolbar { gap: 8px; }
    .toolbar-spacer { display: none; }
    .modal-dialog { border-radius: 12px; }
    .card-body { padding: 14px; }
    .card-header { padding: 12px 16px; }
    .search-box { min-width: 150px; }
}

/* ====== ANNOUNCEMENT ====== */
.announcement-card {
    background: var(--primary-50); padding: 20px;
    border-radius: var(--radius); margin-bottom: 24px;
    border-left: 4px solid var(--primary);
}
