/* ═══════════════════════════════════════════════════════
   Cendekia Edukatif — Main Stylesheet
   Dual theme: Dark (default) & Light
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap');

/* ── DARK THEME (default) ─────────────────────────────── */
:root {
  --bg:      #061525;
  --bg2:     #0b1e35;
  --bg3:     #112843;
  --text:    #eef3f7;
  --text2:   #9db3c8;
  --text3:   #6a8da8;
  --teal:    #0ea5a0;
  --teal2:   #2ec8c2;
  --teal3:   rgba(14,165,160,.1);
  --gold:    #e8b84b;
  --border:  rgba(14,165,160,.18);
  --border2: rgba(14,165,160,.38);
  --red:     #e05a5a;
  --green:   #3cb87a;
  --card-bg: var(--bg2);
  --input-bg: rgba(255,255,255,.055);
  --input-border: var(--border);
  --nav-bg:  #061525;
  --modal-bg: #0b1e35;
  --shadow:  0 2px 16px rgba(0,0,0,.35);
  --badge-bg: rgba(14,165,160,.1);
}

/* ── LIGHT THEME ──────────────────────────────────────── */
[data-theme="light"] {
  --bg:      #f0f6fb;
  --bg2:     #ffffff;
  --bg3:     #e4eef7;
  --text:    #0b1e35;
  --text2:   #3a5a78;
  --text3:   #6a8da8;
  --teal:    #0a8f8a;
  --teal2:   #0ea5a0;
  --teal3:   rgba(14,165,160,.08);
  --gold:    #c47d0a;
  --border:  rgba(14,165,160,.22);
  --border2: rgba(14,165,160,.42);
  --red:     #c0392b;
  --green:   #1e8449;
  --card-bg: #ffffff;
  --input-bg: #f8fbfd;
  --input-border: rgba(14,165,160,.3);
  --nav-bg:  #ffffff;
  --modal-bg: #ffffff;
  --shadow:  0 2px 16px rgba(0,0,0,.1);
  --badge-bg: rgba(14,165,160,.08);
}

/* ── AUTO: ikuti preferensi sistem ───────────────────────
   Hanya aktif jika tidak ada pilihan manual di localStorage */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:      #f0f6fb;
    --bg2:     #ffffff;
    --bg3:     #e4eef7;
    --text:    #0b1e35;
    --text2:   #3a5a78;
    --text3:   #6a8da8;
    --teal:    #0a8f8a;
    --teal2:   #0ea5a0;
    --teal3:   rgba(14,165,160,.08);
    --gold:    #c47d0a;
    --border:  rgba(14,165,160,.22);
    --border2: rgba(14,165,160,.42);
    --red:     #c0392b;
    --green:   #1e8449;
    --card-bg: #ffffff;
    --input-bg: #f8fbfd;
    --input-border: rgba(14,165,160,.3);
    --nav-bg:  #ffffff;
    --modal-bg: #ffffff;
    --shadow:  0 2px 16px rgba(0,0,0,.1);
    --badge-bg: rgba(14,165,160,.08);
  }
}

/* ── BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 20px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
h1,h2,h3,h4 { font-family: 'Lora', serif; }
a { color: var(--teal2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
::selection { background: rgba(14,165,160,.28); color: var(--text); }

/* ── THEME TOGGLE BUTTON ──────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--teal3); border: .5px solid var(--border);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 21px; transition: .2s;
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(14,165,160,.2); }

/* ── SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(14,165,160,.4); }

/* ── NAVBAR ───────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; height: 58px;
  background: var(--nav-bg);
  border-bottom: .5px solid var(--border);
  transition: background .25s ease;
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--teal); display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 18px; height: 18px; color: #fff; }
.brand-text .brand-main { font-size: 19px; font-weight: 700; color: var(--text); font-family: 'Lora', serif; }
.brand-text .brand-main span { color: var(--teal2); }
.brand-text .brand-domain { font-size: 14px; color: var(--text2); display: block; }
.nav-links { display: flex; gap: 2px; }
.nav-link {
  padding: 6px 13px; font-size: 17px; color: var(--text2);
  background: none; border: none; cursor: pointer;
  border-radius: 6px; transition: .15s; text-decoration: none; display: inline-block;
}
.nav-link:hover { color: var(--text); background: rgba(14,165,160,.08); text-decoration: none; }
.nav-right { display: flex; gap: 8px; align-items: center; }
.btn-ghost {
  padding: 6px 14px; font-size: 17px; color: var(--text2);
  border: .5px solid var(--border); background: none;
  border-radius: 6px; cursor: pointer; transition: .15s; text-decoration: none;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); background: var(--teal3); text-decoration: none; }
.btn-teal {
  padding: 6px 16px; font-size: 17px; color: #fff;
  background: var(--teal); border: none; border-radius: 6px;
  cursor: pointer; font-weight: 600; transition: .15s; text-decoration: none;
}
.btn-teal:hover { background: var(--teal2); text-decoration: none; }

/* ── HERO ─────────────────────────────────────────────── */
.hero { position: relative; padding: 3.5rem 1.5rem 2.5rem; text-align: center; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 90% 55% at 50% -5%, rgba(14,165,160,.11) 0%, transparent 68%);
}
.hero-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px),
                    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px; opacity: .5;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--badge-bg); border: .5px solid var(--border2);
  border-radius: 99px; padding: 5px 16px; font-size: 11.5px;
  color: var(--teal2); margin-bottom: 1.25rem;
}
.hero-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal2); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:.7} 50%{opacity:1} }
.hero h1 { font-size: clamp(24px,4.5vw,38px); line-height: 1.22; color: var(--text); max-width: 540px; margin: 0 auto 1rem; }
.hero h1 em { color: var(--teal2); font-style: normal; }
.hero-sub { font-size: 18px; color: var(--text2); max-width: 420px; margin: 0 auto 1.5rem; line-height: 1.8; }
.hero-url-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 16px; color: var(--teal2); background: var(--badge-bg);
  border: .5px solid var(--border); border-radius: 6px; padding: 3px 12px; margin-bottom: 1.5rem;
}
.search-wrap { max-width: 500px; margin: 0 auto 1.75rem; position: relative; }
.search-input {
  width: 100%; padding: 13px 48px 13px 18px; font-size: 18px;
  font-family: 'DM Sans', sans-serif; color: var(--text);
  background: var(--input-bg); border: .5px solid var(--border2);
  border-radius: 10px; outline: none; transition: .2s;
}
.search-input::placeholder { color: var(--text2); }
.search-input:focus { border-color: var(--teal); background: var(--bg2); box-shadow: 0 0 0 3px rgba(14,165,160,.14); }
.search-btn {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 7px; background: var(--teal);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .15s;
}
.search-btn:hover { background: var(--teal2); }
.search-btn svg { width: 15px; height: 15px; color: #fff; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.hero-tag {
  padding: 5px 14px; font-size: 16px; color: var(--text2);
  border: .5px solid var(--border); border-radius: 99px; cursor: pointer;
  transition: .15s; background: transparent; text-decoration: none;
}
.hero-tag:hover { color: var(--teal2); border-color: var(--border2); background: var(--teal3); text-decoration: none; }

/* ── STATS ────────────────────────────────────────────── */
.stats-bar {
  display: grid; grid-template-columns: repeat(4,1fr);
  background: var(--bg2); border-top: .5px solid var(--border); border-bottom: .5px solid var(--border);
  transition: background .25s ease;
}
.stat-item { padding: 1.2rem .75rem; text-align: center; border-right: .5px solid var(--border); }
.stat-item:last-child { border-right: none; }
.stat-num { font-size: 25px; font-weight: 700; color: var(--teal2); display: block; font-family: 'Lora', serif; }
.stat-lbl { font-size: 10.5px; color: var(--text2); margin-top: 3px; display: block; }

/* ── SECTION ──────────────────────────────────────────── */
.section { padding: 2.75rem 1.5rem; }
.section-head { text-align: center; margin-bottom: 1.75rem; }
.section-label { font-size: 10.5px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--teal2); }
.section-title { font-size: clamp(19px,2.8vw,26px); color: var(--text); margin-top: 7px; }
.section-sub { font-size: 17px; color: var(--text2); margin-top: 8px; line-height: 1.75; }

/* ── FEATURE CARDS ────────────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; max-width: 900px; margin: 0 auto; }
@media(max-width:700px){ .features-grid { grid-template-columns: 1fr; } }
.feat-card {
  background: var(--card-bg); border: .5px solid var(--border);
  border-radius: 11px; padding: 1.2rem; transition: .2s;
}
.feat-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: var(--shadow); }
.feat-icon { font-size: 26px; margin-bottom: 10px; }
.feat-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.feat-desc { font-size: 12.5px; color: var(--text2); line-height: 1.72; }

/* ── ARTICLE CARDS ────────────────────────────────────── */
.articles-list { display: flex; flex-direction: column; gap: 8px; max-width: 860px; margin: 0 auto; }
.art-card {
  background: var(--card-bg); border: .5px solid var(--border);
  border-radius: 10px; padding: .95rem 1.1rem; cursor: pointer;
  transition: .15s; display: block; text-decoration: none;
}
.art-card:hover { border-color: var(--border2); box-shadow: var(--shadow); text-decoration: none; }
.art-body { flex: 1; }
.art-meta { font-size: 15px; color: var(--teal2); margin-bottom: 4px; }
.art-meta a { color: var(--teal2); text-decoration: none; font-weight: 400; font-size: 18px; }
.art-title { font-size: 16.5px; color: var(--text); line-height: 1.45; font-weight: 600; margin-bottom: 4px; font-family: 'Lora', serif; }
.art-authors { font-size: 11.5px; color: var(--text2); }
.art-badge { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 14px; border: .5px solid; margin-left: 7px; }
.badge-doi { color: var(--teal2); border-color: rgba(14,165,160,.3); }
.badge-pdf { color: var(--gold); border-color: rgba(232,184,75,.35); }

/* ── SUGGEST SECTION ──────────────────────────────────── */
.suggest-section { background: var(--bg2); border-top: .5px solid var(--border); border-bottom: .5px solid var(--border); padding: 2.75rem 1.5rem; transition: background .25s ease; }
.suggest-inner { max-width: 560px; margin: 0 auto; }
.suggest-form { display: flex; flex-direction: column; gap: 11px; margin-top: 1.5rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media(max-width:600px){ .form-row { grid-template-columns: 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 16px; color: var(--text2); font-weight: 500; }
.form-input, .form-select, .form-textarea, .form-control {
  padding: 9px 12px; font-size: 15px; font-family: 'DM Sans', sans-serif;
  color: var(--text); background: var(--input-bg);
  border: .5px solid var(--input-border); border-radius: 8px; outline: none; transition: .15s;
  width: 100%;
}
.form-input::placeholder, .form-textarea::placeholder, .form-control::placeholder { color: var(--text3); }
.form-input:focus, .form-select:focus, .form-textarea:focus, .form-control:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14,165,160,.12);
  background: var(--bg2);
}
.form-select option { background: var(--bg2); color: var(--text); }
.form-textarea { resize: vertical; min-height: 78px; }
.submit-btn {
  padding: 11px 24px; font-size: 13.5px; font-family: 'DM Sans', sans-serif;
  font-weight: 600; color: #fff; background: var(--teal); border: none;
  border-radius: 8px; cursor: pointer; transition: .15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.submit-btn:hover { background: var(--teal2); }
.submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.ai-response-box { background: var(--teal3); border: .5px solid var(--border2); border-radius: 10px; padding: 1rem; margin-top: 4px; }
.ai-label { font-size: 10.5px; color: var(--teal2); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 7px; }
.ai-text { font-size: 17px; color: var(--text); line-height: 1.8; }

/* ── FOOTER ───────────────────────────────────────────── */
.footer { padding: 2rem 1.5rem 1.5rem; border-top: .5px solid var(--border); background: var(--bg2); transition: background .25s ease; }
.footer-top { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1.5rem; }
.footer-brand-name { font-size: 14.5px; font-weight: 700; color: var(--text); font-family: 'Lora', serif; }
.footer-brand-name span { color: var(--teal2); }
.footer-desc { font-size: 11.5px; color: var(--text2); max-width: 220px; line-height: 1.7; }
.footer-links-group { display: flex; gap: 3rem; flex-wrap: wrap; }
.footer-col-title { font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--teal2); margin-bottom: 10px; }
.footer-link { display: block; font-size: 12.5px; color: var(--text2); padding: 3px 0; transition: .12px; }
.footer-link:hover { color: var(--teal2); text-decoration: none; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; padding-top: 1.25rem; border-top: .5px solid var(--border); }
.footer-copy { font-size: 15px; color: var(--text2); }
.footer-badges { display: flex; gap: 8px; }
.footer-badge { font-size: 14px; padding: 3px 9px; border-radius: 99px; border: .5px solid var(--border); color: var(--text2); }

/* ── ARTICLE DETAIL ───────────────────────────────────── */
.article-page { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem; }
.breadcrumb { font-size: 17px; color: var(--text2); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--teal2); }
.subject-badge { display: inline-block; padding: 3px 12px; border-radius: 99px; background: var(--teal3); color: var(--teal2); font-size: 16px; margin-bottom: 12px; border: .5px solid var(--border2); }
.article-title { font-size: clamp(24px,3vw,30px); line-height: 1.35; color: var(--text); margin-bottom: 1rem; }
.author-chip { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; margin-bottom: 4px; }
.author-avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--teal3); color: var(--teal2); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.author-name { font-size: 17px; color: var(--text); }
.article-meta-bar { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text2); padding: 12px 0; border-top: .5px solid var(--border); border-bottom: .5px solid var(--border); margin-bottom: 1.5rem; }
.article-links { display: flex; gap: 10px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.link-doi { padding: 7px 14px; background: var(--teal3); color: var(--teal2); border: .5px solid var(--border2); border-radius: 6px; font-size: 17px; font-weight: 600; }
.link-pdf { padding: 7px 14px; background: rgba(232,184,75,.1); color: var(--gold); border: .5px solid rgba(232,184,75,.3); border-radius: 6px; font-size: 17px; font-weight: 600; }
.section-h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.abstract-text { line-height: 1.85; color: var(--text2); font-size: 14.5px; margin-bottom: 1.5rem; }
.kw-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 1.5rem; }
.kw-tag { padding: 4px 12px; background: var(--bg3); color: var(--text2); border-radius: 99px; font-size: 12.5px; border: .5px solid var(--border); }
.citation-box { background: var(--bg3); border: .5px solid var(--border); border-radius: 10px; padding: 1rem; margin-bottom: 1.5rem; }
.citation-label { font-size: 15px; font-weight: 700; color: var(--text2); margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.citation-text { font-size: 17px; color: var(--text2); line-height: 1.7; }

/* ── BROWSE ───────────────────────────────────────────── */
.browse-wrap { max-width: 900px; margin: 0 auto; padding: 2rem 1.5rem; }
.filter-bar { display: grid; grid-template-columns: 1fr 180px 160px 130px; gap: 8px; margin-bottom: 1.25rem; }
@media(max-width:700px){ .filter-bar { grid-template-columns: 1fr; } }
.result-count { font-size: 17px; color: var(--text2); margin-bottom: 1rem; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.page-btn { padding: 6px 12px; border: .5px solid var(--border); border-radius: 6px; font-size: 17px; color: var(--text2); text-decoration: none; transition: .15s; }
.page-btn:hover, .page-btn.active { border-color: var(--teal); color: var(--teal2); text-decoration: none; }

/* ── ADMIN ────────────────────────────────────────────── */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-card { background: var(--card-bg); border: .5px solid var(--border); border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; transition: background .25s ease; }
.admin-title { font-size: 22px; color: var(--text); margin-bottom: 1rem; }
.upload-zone { border: 2px dashed var(--border2); border-radius: 10px; padding: 2.5rem; text-align: center; cursor: pointer; transition: .2s; }
.upload-zone:hover { border-color: var(--teal); background: var(--teal3); }
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 1rem; }
.alert-success { background: rgba(60,184,122,.1); border: .5px solid rgba(60,184,122,.35); color: var(--green); }
.alert-error   { background: rgba(224,90,90,.1);  border: .5px solid rgba(224,90,90,.35);  color: var(--red); }
.alert-info    { background: var(--teal3); border: .5px solid var(--border2); color: var(--teal2); }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg3); border-radius: 8px; padding: 14px; text-align: center; }
.stat-card .num { font-size: 26px; font-weight: 700; color: var(--teal2); font-family: 'Lora', serif; }
.stat-card .lbl { font-size: 13px; color: var(--text2); margin-top: 3px; }

/* ── MODAL (admin) ────────────────────────────────────── */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:200; align-items:center; justify-content:center; padding:1rem; }
.modal-overlay.open { display:flex; animation:mfade .2s ease; }
@keyframes mfade { from{opacity:0} to{opacity:1} }
.modal-box {
  background: var(--bg2);
  border: .5px solid var(--border2);
  border-radius: 14px; width:100%; max-width:560px;
  padding:1.75rem; max-height:90vh; overflow-y:auto; position:relative;
}
.modal-close { position:absolute; right:.9rem; top:.9rem; width:26px; height:26px; border-radius:50%; background:var(--bg3); border:none; color:var(--text2); cursor:pointer; font-size:14px; }
.modal-close:hover { background:var(--border); }

/* ── LOGIN ────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--bg); }
.login-box { background: var(--card-bg); border: .5px solid var(--border2); border-radius: 16px; width: 100%; max-width: 380px; padding: 2rem; }
.login-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 1.5rem; }
.forgot { background: none; border: none; color: var(--teal2); font-size: 11.5px; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.forgot:hover { text-decoration: underline; }

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem; color: var(--text2); }
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ── UTILS ────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-1{margin-top:.5rem;} .mt-2{margin-top:1rem;} .mt-3{margin-top:1.5rem;}
.mb-1{margin-bottom:.5rem;} .mb-2{margin-bottom:1rem;}

/* ── MOBILE ───────────────────────────────────────────── */
@media(max-width:640px){
  .navbar { padding: 0 1rem; }
  .nav-links { display: none; }
  .hero { padding: 2.5rem 1rem 2rem; }
  .stats-bar { grid-template-columns: repeat(2,1fr); }
  .section { padding: 2rem 1rem; }
  .admin-wrap, .browse-wrap, .article-page { padding: 1.5rem 1rem; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .filter-bar { grid-template-columns: 1fr; }
  .footer-links-group { gap: 1.5rem; }
}