@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: #f0d78a;
    --bg: #f4f1ec;
    --bg-card: #ffffff;
    --text: #1a2332;
    --text-secondary: #5a6a7a;
    --border: #e2ddd5;
    --danger: #c0392b;
    --danger-light: #fdecea;
    --success: #27ae60;
    --success-light: #eafaf1;
    --warning: #f39c12;
    --warning-light: #fef9e7;
    --info: #2980b9;
    --info-light: #eaf2f8;
    --sidebar-w: 260px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

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

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

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

/* ====== LOGIN PAGE ====== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%; right: -30%;
    width: 80%; height: 200%;
    background: radial-gradient(ellipse, rgba(212,168,67,0.12) 0%, transparent 70%);
}
.login-page::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 40%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23093d2a' fill-opacity='0.3' d='M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,218.7C672,235,768,245,864,234.7C960,224,1056,192,1152,181.3C1248,171,1344,181,1392,186.7L1440,192L1440,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") no-repeat bottom/cover;
}
.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 28px; font-weight: 700;
    box-shadow: 0 4px 15px rgba(13,92,63,0.3);
}
.login-title { font-family: 'Playfair Display', serif; font-size: 22px; text-align: center; color: var(--primary-dark); margin-bottom: 4px; }
.login-subtitle { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 28px; }
.login-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 4px; margin-bottom: 24px; }
.login-tab {
    flex: 1; padding: 8px; text-align: center;
    border: none; background: transparent; border-radius: 6px;
    font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; color: var(--text-secondary); transition: all 0.2s;
}
.login-tab.active { background: white; color: var(--primary); box-shadow: var(--shadow); }

/* ====== FORMS ====== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.form-input, .form-select {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit;
    transition: all 0.2s; background: var(--bg);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,92,63,0.1); background: white;
}
.form-textarea {
    width: 100%; padding: 10px 14px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 14px; font-family: inherit;
    resize: vertical; min-height: 80px; background: var(--bg);
}
.form-input-sm { padding: 5px 8px; font-size: 12px; width: 65px; text-align: center; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ====== BUTTONS ====== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; 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;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; box-shadow: 0 2px 8px rgba(13,92,63,0.25); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(13,92,63,0.35); }
.btn-secondary { background: white; color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a93226; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ====== ADMIN LAYOUT ====== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar {
    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: 100;
}
.sidebar-header { padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-brand { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--accent-light); }
.sidebar-school { font-size: 11px; opacity: 0.7; margin-top: 2px; }
.sidebar-nav { padding: 12px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px; color: rgba(255,255,255,0.7);
    font-size: 13px; font-weight: 500;
    text-decoration: none; transition: all 0.2s;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.15); color: var(--accent-light); border-right: 3px solid var(--accent); }
.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }
.nav-divider { border-top: 1px solid rgba(255,255,255,0.1); margin: 8px 0; }

.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; }
.topbar {
    background: white; padding: 14px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.page-content { padding: 24px 28px; }

/* ====== CARDS ====== */
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ====== STATS ====== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-value { font-size: 28px; font-weight: 800; font-family: 'Playfair Display', serif; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.stat-green .stat-value { color: var(--primary); }
.stat-gold .stat-value { color: var(--accent); }
.stat-red .stat-value { color: var(--danger); }

/* ====== TABLE ====== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--primary-50); }
th { padding: 10px 14px; text-align: left; font-weight: 700; color: var(--primary-dark); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover { background: rgba(13,92,63,0.02); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.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); }

/* ====== TOOLBAR ====== */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.search-box {
    display: flex; align-items: center; gap: 6px;
    background: white; border: 1.5px solid var(--border);
    border-radius: 8px; padding: 0 12px;
    min-width: 180px; max-width: 300px;
}
.search-box input { border: none; outline: none; padding: 8px 0; font-size: 13px; font-family: inherit; width: 100%; background: transparent; }
.per-page-select { padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; background: white; }

/* ====== ALERTS ====== */
.alert {
    padding: 12px 18px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); border: 1px solid var(--info); }

/* ====== MODAL ====== */
.modal-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal-dialog {
    background: white; border-radius: 14px;
    width: 100%; max-width: 560px;
    max-height: 85vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-dialog-wide { max-width: 720px; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-secondary); }

/* ====== TAB BAR ====== */
.tab-bar { display: flex; gap: 4px; background: var(--bg); border-radius: 8px; padding: 4px; margin-bottom: 16px; overflow-x: auto; }
.tab-btn {
    padding: 7px 14px; border: none; background: transparent;
    border-radius: 6px; font-size: 12px; font-weight: 600;
    font-family: inherit; cursor: pointer; white-space: nowrap;
    color: var(--text-secondary); transition: all 0.2s;
    text-decoration: none;
}
.tab-btn:hover { text-decoration: none; }
.tab-btn.active { background: white; color: var(--primary); box-shadow: var(--shadow); }

/* ====== STUDENT LAYOUT ====== */
.student-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white; padding: 18px 28px;
    display: flex; align-items: center; justify-content: space-between;
}
.student-header h2 { font-family: 'Playfair Display', serif; font-size: 18px; }
.student-nav { background: white; border-bottom: 1px solid var(--border); padding: 0 28px; }
.student-nav a {
    display: inline-block; padding: 12px 18px;
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary); text-decoration: none;
    border-bottom: 3px solid transparent;
}
.student-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }
.student-nav a.disabled { color: #ccc; pointer-events: none; }
.student-content { padding: 28px; max-width: 960px; margin: 0 auto; }

.announcement-box {
    background: linear-gradient(135deg, var(--primary-50), white);
    border: 1px solid var(--primary); border-left: 4px solid var(--primary);
    border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.announcement-box h3 { color: var(--primary); margin-bottom: 8px; font-size: 14px; }
.info-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; }
.info-label { font-weight: 600; color: var(--text-secondary); }

.action-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.action-card {
    background: white; border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--border); box-shadow: var(--shadow);
    text-align: center; transition: all 0.2s; text-decoration: none; color: var(--text);
}
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary); text-decoration: none; }
.action-card.disabled { opacity: 0.5; pointer-events: none; }
.action-card h3 { font-size: 15px; margin-bottom: 4px; color: var(--primary-dark); }
.action-card p { font-size: 12px; color: var(--text-secondary); }

/* ====== COUNTDOWN ====== */
.countdown-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white; text-align: center; padding: 20px;
}
.countdown-title { font-family: 'Playfair Display', serif; font-size: 24px; margin-bottom: 8px; }
.countdown-subtitle { opacity: 0.8; font-size: 14px; margin-bottom: 32px; }
.countdown-timer { display: flex; gap: 12px; justify-content: center; margin-bottom: 24px; }
.countdown-unit {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px; padding: 16px 20px; min-width: 80px;
}
.countdown-number { font-size: 36px; font-weight: 800; font-family: 'Playfair Display', serif; color: var(--accent-light); }
.countdown-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; opacity: 0.7; margin-top: 4px; }

/* ====== UTILITIES ====== */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }

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

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 199;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   SIDEBAR CLOSE BUTTON (shown on mobile inside sidebar)
   ============================================================ */
.sidebar-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.sidebar-close-btn {
    display: none;
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    margin-left: 8px;
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
    /* sidebar hidden off-screen by default */
    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 200;
        width: 270px !important;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close-btn { display: flex; align-items: center; justify-content: center; }

    /* main content full width */
    .main-content { margin-left: 0 !important; }

    /* show hamburger in topbar */
    .hamburger-btn { display: flex; }

    /* topbar tweaks */
    .topbar {
        justify-content: space-between;
        padding: 10px 14px;
    }
    .topbar-title { font-size: 15px; }
    .topbar-user span:first-child { display: none; }

    /* siswa sidebar same treatment */
    .siswa-sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 260px !important;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 200;
    }
    .siswa-sidebar.open { transform: translateX(0); }
    .siswa-main { margin-left: 0 !important; }
    .siswa-topbar { padding: 10px 14px; }
    .siswa-page { padding: 16px !important; }

    /* general layout */
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
    .toolbar { gap: 6px; flex-wrap: wrap; }
    .search-box { max-width: none; flex: 1; }

    /* tables scroll on mobile */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 600px; }
}
