/* ============================================================
   ADMIN CSS - School Management System
   ============================================================ */

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

:root {
    --primary: #1a3a5c;
    --primary-light: #2563a8;
    --accent: #e8a020;
    --accent-light: #fbbf24;
    --sidebar-w: 260px;
    --header-h: 64px;
    --bg: #f0f4f8;
    --white: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --shadow: 0 2px 12px rgba(26,58,92,0.08);
    --shadow-lg: 0 8px 30px rgba(26,58,92,0.12);
    --radius: 10px;
    --font: 'DM Sans', sans-serif;
    --font-display: 'Playfair Display', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); color: var(--text); background: var(--bg); }

/* ---- ADMIN LAYOUT ---- */
.admin-wrap { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-icon {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--white);
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-logo-sub { font-size: 0.65rem; color: var(--accent-light); font-family: var(--font); font-weight: 400; letter-spacing: 1px; }

.sidebar-nav { padding: 16px 0; flex: 1; }

.sidebar-section-label {
    padding: 12px 20px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    margin: 2px 0;
}

.sidebar-link:hover {
    color: var(--white);
    background: rgba(255,255,255,0.07);
    border-left-color: var(--accent);
}

.sidebar-link.active {
    color: var(--white);
    background: rgba(232,160,32,0.1);
    border-left-color: var(--accent);
}

.sidebar-link .icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-footer a:hover { color: var(--danger); }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.topbar-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 700;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.topbar-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 0.9rem;
}

/* ---- PAGE BODY ---- */
.page-body { padding: 28px; flex: 1; }

/* ---- STAT CARDS ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.blue::after { background: var(--info); }
.stat-card.green::after { background: var(--success); }
.stat-card.gold::after { background: var(--accent); }
.stat-card.red::after { background: var(--danger); }

.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: rgba(59,130,246,0.1); }
.stat-icon.green { background: rgba(16,185,129,0.1); }
.stat-icon.gold { background: rgba(232,160,32,0.1); }
.stat-icon.red { background: rgba(239,68,68,0.1); }

.stat-info p { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-info h3 { font-size: 1.8rem; font-family: var(--font-display); color: var(--primary); font-weight: 700; line-height: 1.2; margin-top: 2px; }

/* ---- CARD / PANEL ---- */
.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 { font-size: 1rem; color: var(--primary); font-weight: 700; }

.panel-body { padding: 24px; }

/* ---- TABLE ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

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

/* ---- BADGES ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background: rgba(16,185,129,0.1); color: var(--success); }
.badge-red { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-gold { background: rgba(232,160,32,0.1); color: var(--accent); }
.badge-blue { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-gray { background: rgba(100,116,139,0.1); color: var(--text-muted); }

/* ---- FORMS ---- */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 7px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.92rem;
    color: var(--text);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,0.08);
}

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); color: var(--white); }
.btn-accent { background: var(--accent); color: var(--primary); }
.btn-accent:hover { background: var(--accent-light); color: var(--primary); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { opacity: 0.85; color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: 0.85; color: var(--white); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---- SEARCH BAR ---- */
.search-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrap input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.9rem;
    outline: none;
    background: var(--bg);
    color: var(--text);
}

.search-input-wrap input:focus { border-color: var(--primary-light); background: var(--white); }

.search-input-wrap::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
}

/* ---- LOGIN PAGE ---- */
.admin-login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #0f2441 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo-icon {
    width: 60px; height: 60px;
    background: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 14px;
}

.login-logo h2 { font-family: var(--font-display); color: var(--primary); font-size: 1.4rem; }
.login-logo p { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 6px; margin-top: 20px; justify-content: center; }
.page-btn {
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.page-btn.active, .page-btn:hover { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .page-body { padding: 16px; }
}
