/* =====================================================================
   MUSLIM MUTTABA' EDUCATION — token desain
   Palet   : zamrud tua (#0B4A3B), zamrud gelap (#082F26), emas (#C89B3C),
             gading (#FBF8F1), sage lembut (#EAF1EC), arang (#1F2A24)
   Tipe    : "Amiri" (display, berkarakter kaligrafis) + "Plus Jakarta Sans"
             (body) + "JetBrains Mono" (nomor induk / data tabel)
   Motif   : bintang bersudut delapan (khatam) sebagai elemen pemisah
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    --emerald-900: #082f26;
    --emerald-700: #0b4a3b;
    --emerald-600: #115c49;
    --emerald-100: #eaf1ec;
    --gold-500: #c89b3c;
    --gold-300: #e0c476;
    --ivory: #fbf8f1;
    --charcoal: #1f2a24;
    --charcoal-soft: #4b564f;
    --line: #ded6c2;
    --success: #1e7a4c;
    --success-bg: #e4f3ea;
    --warning: #a5721f;
    --warning-bg: #faf0dd;
    --danger: #ab3226;
    --danger-bg: #fbe9e6;
    --neutral-bg: #eef0ec;

    --font-display: 'Amiri', 'Georgia', serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius: 14px;
    --shadow-soft: 0 4px 24px rgba(8, 47, 38, 0.08);
    --shadow-card: 0 2px 10px rgba(8, 47, 38, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--ivory);
    color: var(--charcoal);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

:focus-visible {
    outline: 3px solid var(--gold-500);
    outline-offset: 2px;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- Motif bintang delapan (elemen tanda tangan) ---------- */
.khatam-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 8px 0;
    color: var(--gold-500);
}
.khatam-divider::before,
.khatam-divider::after {
    content: '';
    height: 1px;
    flex: 1;
    background: var(--line);
    max-width: 120px;
}
.khatam-divider svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ---------- Header / navigasi ---------- */
.site-header {
    background: var(--ivory);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 78px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    background: var(--emerald-700);
    border-radius: 10px;
    color: var(--gold-300);
}
.brand-text .brand-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--emerald-900);
    line-height: 1.1;
}
.brand-text .brand-tagline {
    font-size: 0.72rem;
    color: var(--charcoal-soft);
    letter-spacing: 0.02em;
}
.main-nav { display: flex; gap: 28px; }
.main-nav a {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--charcoal-soft);
    padding: 8px 0;
    border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--emerald-700);
    border-bottom-color: var(--gold-500);
}
.nav-admin-link {
    background: var(--emerald-700);
    color: var(--ivory) !important;
    padding: 9px 18px !important;
    border-radius: 8px;
    border-bottom: none !important;
}
.nav-admin-link:hover { background: var(--emerald-900); color: var(--ivory) !important; }

/* ---------- Hero + pencarian ---------- */
.hero {
    position: relative;
    background: linear-gradient(160deg, var(--emerald-900) 0%, var(--emerald-700) 55%, var(--emerald-600) 100%);
    color: var(--ivory);
    padding: 64px 0 96px;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(45deg, rgba(200,155,60,0.055) 0 2px, transparent 2px 46px),
        repeating-linear-gradient(-45deg, rgba(200,155,60,0.055) 0 2px, transparent 2px 46px);
    opacity: 0.6;
}
.hero-inner { position: relative; text-align: center; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--gold-300);
    font-weight: 600;
    margin-bottom: 18px;
}
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 4.2vw, 3.1rem);
    font-weight: 700;
    margin: 0 0 14px;
    line-height: 1.2;
}
.hero p.lead {
    max-width: 620px;
    margin: 0 auto 40px;
    color: rgba(251,248,241,0.82);
    font-size: 1.05rem;
}

.search-card {
    background: var(--ivory);
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    padding: 22px;
    max-width: 780px;
    margin: 0 auto;
    text-align: left;
}

/* Tab filter pil (dipakai di search.php pada halaman hasil pencarian) */
.search-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.search-tabs button {
    font-family: var(--font-body);
    border: 1px solid var(--line);
    background: #fff;
    color: var(--charcoal-soft);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 9px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.search-tabs button.active {
    background: var(--emerald-700);
    border-color: var(--emerald-700);
    color: var(--ivory);
}

/* Tombol filter tunggal (dropdown) — dipakai di hero halaman depan (index.php) */
.search-form {
    display: flex;
    gap: 10px;
    position: relative;
}
.filter-select { position: relative; flex-shrink: 0; }
.filter-btn {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    border: 1px solid var(--line);
    background: var(--emerald-100);
    color: var(--emerald-900);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0 16px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.filter-btn:hover { background: #e0e9e2; }
.filter-btn .filter-chevron { transition: transform 0.15s ease; color: var(--charcoal-soft); }
.filter-btn[aria-expanded="true"] .filter-chevron { transform: rotate(180deg); }
.filter-btn[aria-expanded="true"] { border-color: var(--gold-500); }
.filter-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 210px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(8, 47, 38, 0.18);
    padding: 6px;
    z-index: 30;
}
.filter-menu.open { display: block; }
.filter-option {
    display: block;
    width: 100%;
    text-align: left;
    font-family: var(--font-body);
    border: none;
    background: #ffffff;
    color: var(--charcoal);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.filter-option + .filter-option { margin-top: 2px; }
.filter-option:hover { background: var(--emerald-100); }
.filter-option.active {
    background: var(--emerald-700);
    color: var(--ivory);
    font-weight: 600;
}
.search-form input[type="text"] {
    flex: 1;
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--charcoal);
}
.search-form input[type="text"]:focus { border-color: var(--gold-500); }
.search-form button[type="submit"] {
    background: var(--gold-500);
    color: var(--emerald-900);
    border: none;
    font-weight: 700;
    font-family: var(--font-body);
    padding: 0 24px;
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background 0.15s ease;
}
.search-form button[type="submit"]:hover { background: var(--gold-300); }
.search-hint { font-size: 0.78rem; color: var(--charcoal-soft); margin-top: 10px; }

@media (max-width: 640px) {
    .search-form { flex-wrap: wrap; }
    .filter-select { flex: 1 1 100%; }
    .filter-btn { width: 100%; justify-content: space-between; padding: 12px 16px; }
    .search-form input[type="text"] { flex: 1 1 100%; }
    .search-form button[type="submit"] { flex: 1 1 100%; justify-content: center; padding: 12px; }
}

/* ---------- Kartu jenis pencarian (grid ala PDDikti) ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: -56px;
    position: relative;
    z-index: 5;
}
.category-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px 20px;
    text-align: center;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); }
.category-icon {
    width: 56px; height: 56px;
    margin: 0 auto 14px;
    display: grid; place-items: center;
    background: var(--emerald-100);
    border-radius: 12px;
    color: var(--emerald-700);
}
.category-card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--emerald-900); }
.category-card p { margin: 0; font-size: 0.85rem; color: var(--charcoal-soft); }

/* ---------- Section umum ---------- */
.section { padding: 72px 0; }
.section-heading { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.section-heading .eyebrow {
    font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--gold-500); font-weight: 700; margin-bottom: 10px;
}
.section-heading h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--emerald-900);
    margin: 0 0 12px;
}
.section-heading p { color: var(--charcoal-soft); margin: 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.stat-card {
    background: var(--emerald-100);
    border-radius: var(--radius);
    padding: 26px 20px;
    text-align: center;
}
.stat-card .num {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--emerald-700);
}
.stat-card .label { font-size: 0.85rem; color: var(--charcoal-soft); margin-top: 6px; }

/* ---------- Hasil pencarian ---------- */
.results-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.results-toolbar .count { color: var(--charcoal-soft); font-size: 0.92rem; }
.result-list { display: flex; flex-direction: column; gap: 14px; }
.result-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.result-main { display: flex; gap: 16px; align-items: center; }
.result-avatar {
    width: 48px; height: 48px; border-radius: 10px;
    background: var(--emerald-700); color: var(--gold-300);
    display: grid; place-items: center; font-weight: 700; font-family: var(--font-display);
    flex-shrink: 0;
}
.result-title { font-weight: 700; color: var(--emerald-900); }
.result-meta { font-size: 0.85rem; color: var(--charcoal-soft); margin-top: 2px; }
.result-id { font-family: var(--font-mono); font-size: 0.88rem; color: var(--emerald-700); }
.result-right { display: flex; align-items: center; gap: 14px; }
.btn-detail {
    border: 1px solid var(--emerald-700);
    color: var(--emerald-700);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 8px;
}
.btn-detail:hover { background: var(--emerald-700); color: #fff; }

.badge {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
    padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
.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); }
.badge-neutral { background: var(--neutral-bg); color: var(--charcoal-soft); }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--charcoal-soft);
}
.empty-state svg { color: var(--line); margin-bottom: 16px; }

/* ---------- Detail record ---------- */
.detail-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 34px; max-width: 720px; margin: 0 auto;
}
.detail-head {
    display: flex; gap: 20px; align-items: center;
    padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line);
}
.detail-head .result-avatar { width: 64px; height: 64px; font-size: 1.4rem; }
.detail-head h2 { margin: 0; color: var(--emerald-900); font-family: var(--font-display); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; }
.detail-field .label { font-size: 0.76rem; color: var(--charcoal-soft); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.detail-field .value { font-weight: 600; color: var(--charcoal); }
.detail-field .value.mono { font-family: var(--font-mono); color: var(--emerald-700); }
.detail-programs .program-item {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--emerald-100);
}
.detail-programs .program-item .value { color: var(--emerald-900); margin-bottom: 4px; }
.detail-programs .program-item .label { text-transform: none; letter-spacing: normal; font-size: 0.82rem; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--emerald-900);
    color: rgba(251,248,241,0.75);
    padding: 48px 0 24px;
    margin-top: 40px;
}
.footer-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; margin-bottom: 28px; }
.footer-brand .brand-name { color: var(--ivory); font-family: var(--font-display); font-size: 1.15rem; }
.footer-brand p { max-width: 320px; font-size: 0.88rem; margin-top: 8px; }
.footer-col h4 { color: var(--gold-300); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.footer-col a { display: block; font-size: 0.9rem; margin-bottom: 8px; color: rgba(251,248,241,0.75); }
.footer-col a:hover { color: var(--gold-300); }
.footer-bottom { border-top: 1px solid rgba(251,248,241,0.12); padding-top: 20px; font-size: 0.8rem; text-align: center; }

/* ---------- Form umum (dipakai di admin & login) ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; color: var(--charcoal); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; font-family: var(--font-body); font-size: 0.95rem;
    padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-list {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
}
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.92rem;
}
.checkbox-item:hover { background: var(--emerald-100); }
.checkbox-item input[type="checkbox"] { width: auto; accent-color: var(--emerald-700); }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
    padding: 11px 22px; border-radius: 8px; border: none; cursor: pointer;
}
.btn-primary { background: var(--emerald-700); color: #fff; }
.btn-primary:hover { background: var(--emerald-900); }
.btn-outline { background: #fff; border: 1px solid var(--line); color: var(--charcoal); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 0.88rem; margin-bottom: 18px; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger { background: var(--danger-bg); color: var(--danger); }

/* ---------- Login admin ---------- */
.login-wrap {
    min-height: 100vh;
    display: grid; place-items: center;
    background: linear-gradient(160deg, var(--emerald-900), var(--emerald-700));
    padding: 20px;
}
.login-card {
    background: var(--ivory); border-radius: 16px; padding: 40px;
    width: 100%; max-width: 400px; box-shadow: var(--shadow-soft);
}
.login-card .brand { justify-content: center; margin-bottom: 8px; }
.login-card h1 { text-align: center; font-family: var(--font-display); font-size: 1.3rem; color: var(--emerald-900); margin: 6px 0 28px; }

/* ---------- Admin layout ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px; background: var(--emerald-900); color: rgba(251,248,241,0.85);
    flex-shrink: 0; padding: 24px 0;
}
.admin-sidebar .brand { padding: 0 20px 24px; border-bottom: 1px solid rgba(251,248,241,0.12); margin-bottom: 16px; }
.admin-sidebar .brand-name, .admin-sidebar .brand-tagline { color: var(--ivory); }
.admin-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; font-size: 0.9rem; font-weight: 600;
    color: rgba(251,248,241,0.75); border-left: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
    background: rgba(251,248,241,0.06); color: var(--ivory); border-left-color: var(--gold-500);
}
.admin-main { flex: 1; background: var(--ivory); }
.admin-topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 32px; border-bottom: 1px solid var(--line); background: #fff;
}
.admin-content { padding: 32px; }
.admin-topbar .who { font-size: 0.88rem; color: var(--charcoal-soft); }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data-table { width: 100%; border-collapse: collapse; background: #fff; }
table.data-table th, table.data-table td { padding: 12px 16px; text-align: left; font-size: 0.88rem; vertical-align: middle; }
table.data-table th { background: var(--emerald-100); color: var(--emerald-900); font-weight: 700; }
table.data-table td.mono { font-family: var(--font-mono); color: var(--emerald-700); }
table.data-table tbody tr { border-bottom: 1px solid var(--line); }
table.data-table tbody tr:last-child { border-bottom: none; }
.table-actions { display: flex; align-items: center; gap: 8px; }
.table-actions form { margin: 0; display: flex; }

.dashboard-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 32px; }
.dash-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.dash-card .num { font-family: var(--font-mono); font-size: 1.8rem; font-weight: 700; color: var(--emerald-700); }
.dash-card .label { color: var(--charcoal-soft); font-size: 0.85rem; margin-top: 4px; }

/* ---------- Responsif ---------- */
@media (max-width: 900px) {
    .main-nav { display: none; }
    .category-grid { grid-template-columns: 1fr; margin-top: 24px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .dashboard-cards { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}