/* ==========================================================
   MGMP Geografi SMA DKI Jakarta - Design System v2
   ========================================================== */

:root {
    /* Brand */
    --primary: #1b7a43;
    --primary-dark: #125c31;
    --primary-light: #e8f5ec;
    --accent: #f2a93c;
    --accent-dark: #d68f26;

    /* Neutrals */
    --ink: #1f2937;
    --ink-soft: #5b6472;
    --ink-faint: #8a93a1;
    --bg: #f5f7f6;
    --surface: #ffffff;
    --border: #e4e8e6;

    /* Status */
    --danger: #dc2626;
    --danger-bg: #fdecea;
    --warning: #b45309;
    --warning-bg: #fef3e0;
    --success: #15803d;
    --success-bg: #e6f6ec;

    /* Scale */
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(16, 40, 26, 0.06);
    --shadow: 0 6px 20px rgba(16, 40, 26, 0.08);
    --shadow-lg: 0 16px 40px rgba(16, 40, 26, 0.14);
}

* { box-sizing: border-box; }

svg { vertical-align: middle; flex-shrink: 0; }

.icon-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: "Poppins", "Inter", sans-serif;
    font-weight: 600;
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 12px;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; margin-top: 8px; }
h3 { font-size: 1.1rem; }

a { color: var(--primary-dark); }
p { margin: 0 0 12px; color: var(--ink-soft); }

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header / Nav ---------- */
.site-header {
    background: linear-gradient(120deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 14px 20px;
    gap: 12px;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: "Poppins", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    line-height: 1.2;
}
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}
.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.brand small {
    display: block;
    font-weight: 400;
    font-size: 0.72rem;
    opacity: 0.85;
    letter-spacing: 0.02em;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    margin: 0 auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.main-nav a, .auth-area a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.main-nav a:hover, .auth-area a:hover {
    background: rgba(255, 255, 255, 0.16);
    text-decoration: none;
}

.auth-area {
    display: flex;
    align-items: center;
    gap: 6px;
}
.auth-area .btn-outline {
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.auth-area .btn-outline:hover {
    background: #fff;
    color: var(--primary-dark);
}

/* ---------- Layout ---------- */
.page-content {
    min-height: 60vh;
    padding: 32px 20px 56px;
}

/* ---------- Hero ---------- */
.hero {
    background:
        radial-gradient(circle at 1.5px 1.5px, rgba(27, 122, 67, 0.14) 1.5px, transparent 0) 0 0/22px 22px,
        linear-gradient(135deg, var(--primary-light) 0%, #ffffff 70%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 52px 44px;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "";
    position: absolute;
    right: -70px;
    top: -70px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(27, 122, 67, 0.12) 0%, rgba(27, 122, 67, 0) 70%);
    border-radius: 50%;
}
.hero-content { position: relative; max-width: 680px; }
.eyebrow {
    display: inline-block;
    background: rgba(27, 122, 67, 0.12);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    padding: 5px 12px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.hero h1 {
    font-size: 2.3rem;
    margin-bottom: 12px;
}
.hero p {
    font-size: 1.04rem;
    margin-bottom: 22px;
}
.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.btn-lg {
    padding: 12px 22px;
    font-size: 1rem;
}
.btn-ghost {
    background: transparent;
    color: var(--primary-dark);
    border: 1.5px solid var(--primary);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--primary);
    color: #fff;
}

/* ---------- Value props ---------- */
.value-props {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 8px 0 40px;
}
.value-prop { text-align: left; }
.value-prop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 50%;
    margin-bottom: 12px;
}
.value-prop h3 { margin-bottom: 6px; }
.value-prop p { font-size: 0.92rem; margin-bottom: 0; }

.empty-state {
    text-align: center;
    padding: 40px 24px;
}

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #c6ebd4; }
.alert-danger  { background: var(--danger-bg); color: var(--danger); border-color: #f5cdc8; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.18s ease, transform 0.18s ease;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
}

.card-thumb {
    display: block;
    width: calc(100% + 40px);
    height: 150px;
    object-fit: cover;
    margin: -20px -20px 14px -20px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg);
}

.detail-thumb {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: var(--radius);
    margin: 16px 0 20px;
}

a.card {
    text-decoration: none;
    color: inherit;
    display: block;
}
.grid a.card:hover, a.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
    border-color: #c9e4d3;
}

.category-card {
    text-align: left;
    position: relative;
}
.category-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-dark);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.category-card:hover .category-link {
    opacity: 1;
    transform: translateX(0);
}
.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}
.category-card h3 {
    margin-bottom: 4px;
}
.category-count {
    color: var(--ink-faint);
    font-size: 0.88rem;
    margin: 0;
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }

/* ---------- Filters & forms ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.filters select, .filters input,
form input, form select, form textarea {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form select:focus, form textarea:focus, .filters select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 122, 67, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--primary-dark); text-decoration: none; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--ink-soft); }
.btn-secondary:hover { background: var(--ink); }

form.stacked label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 14px 0 5px;
    color: var(--ink);
}
form.stacked input, form.stacked select, form.stacked textarea {
    width: 100%;
}
form.stacked em {
    color: var(--ink-faint);
    font-size: 0.85rem;
}

/* ---------- Konten kaya-teks (WYSIWYG) ---------- */
.rich-content {
    line-height: 1.7;
    font-size: 0.98rem;
}
.rich-content p { margin: 0 0 14px; }
.rich-content p:last-child { margin-bottom: 0; }
.rich-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 6px 0; }
.rich-content ul, .rich-content ol { margin: 0 0 14px; padding-left: 22px; }
.rich-content a { color: var(--primary-dark); }
.rich-content h1, .rich-content h2, .rich-content h3 { font-family: 'Poppins', sans-serif; margin: 18px 0 8px; }

.rich-editor-wrap { margin-bottom: 4px; }
.rich-editor {
    width: 100%;
    background: var(--surface);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.rich-editor .ql-toolbar {
    border: 1.5px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: var(--bg);
}
.rich-editor .ql-container {
    border: 1.5px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
}
.rich-editor .ql-editor {
    min-height: 90px;
}
.rich-editor.rich-editor-compact .ql-editor {
    min-height: 44px;
}
.rich-editor .ql-editor.ql-blank::before {
    color: var(--ink-faint);
    font-style: normal;
}
.rich-editor .ql-editor img {
    max-height: 160px;
    border-radius: var(--radius-sm);
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table th, table td {
    border-bottom: 1px solid var(--border);
    padding: 11px 14px;
    text-align: left;
    font-size: 0.9rem;
}
table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: #fafcfb; }

/* ---------- Admin tabs ---------- */
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-sm);
}
.admin-tabs a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-soft);
    transition: background 0.15s ease, color 0.15s ease;
}
.admin-tabs a:hover { background: var(--primary-light); color: var(--primary-dark); }
.admin-tabs a.active { background: var(--primary); color: #fff; }

/* ---------- Stat cards ---------- */
.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.stat-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    font-family: "Poppins", sans-serif;
    color: var(--ink);
    line-height: 1.1;
    margin: 2px 0 4px;
}

/* ---------- Table action buttons ---------- */
.table-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 24px 0;
}
.pagination a, .pagination span {
    padding: 7px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 0.88rem;
    color: var(--ink-soft);
    background: var(--surface);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary-dark); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

.meta-text { color: var(--ink-faint); font-size: 0.85rem; margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--ink);
    color: rgba(255, 255, 255, 0.75);
    padding: 24px 0;
    text-align: center;
    font-size: 0.85rem;
    margin-top: 40px;
}
.site-footer p { color: inherit; margin: 0; }
.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    font-family: "Poppins", sans-serif;
    font-weight: 600;
    color: #fff;
}
.footer-brand img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* ---------- Auth pages (login/register) ---------- */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}
.auth-brand img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
.auth-brand h1 { margin: 0; }

/* ---------- Game embed (jenis=game, ditampilkan lewat iframe) ---------- */
.game-embed { padding: 16px; }
.game-frame-wrap {
    position: relative;
    width: 100%;
    height: 640px;
    max-height: 80vh;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg);
}
.game-frame-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
@media (max-width: 600px) {
    .game-frame-wrap { height: 520px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 780px) {
    .nav-toggle { display: flex; }
    .nav-wrap {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        background: var(--primary-dark);
        border-radius: var(--radius);
        padding: 12px;
        margin-top: 10px;
    }
    .nav-wrap.nav-open { display: flex; }
    .main-nav, .auth-area { flex-direction: column; align-items: flex-start; width: 100%; gap: 2px; }
    .main-nav a, .auth-area a { width: 100%; }
    .hero { padding: 26px; }
    .hero h1 { font-size: 1.6rem; }
}
