:root {
  /* Palet terinspirasi batik & ukiran khas Kalimantan Timur:
     terracotta tanah liat, emas ukiran, hijau hutan tropis, cokelat kayu ulin */
  --primary: #B5541F;        /* terracotta / warna tanah */
  --primary-dark: #8F3E14;
  --primary-light: #FBEEE0;
  --gold: #C69214;           /* emas ukiran */
  --gold-light: #F4E1AE;
  --forest: #35573C;         /* hijau hutan tropis Kaltim */
  --forest-dark: #24402B;
  --accent: #C69214;
  --success: #3E7A3D;
  --danger: #B3261E;
  --warning: #B5541F;
  --bg: #FAF5EC;             /* krem kertas/kain tenun */
  --card: #FFFDF8;
  --text: #2B1D12;           /* cokelat tua nyaris hitam, seperti ukiran kayu */
  --text-muted: #7A6A57;
  --border: #E9DCC6;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(91, 58, 22, 0.08);
  --shadow-lg: 0 12px 42px rgba(60, 34, 10, 0.22);
  --batik-border: url('../img/batik-border-gold.svg');
  --batik-border-soft: url('../img/batik-border-soft.svg');
  --batik-field: url('../img/batik-field.svg');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---------- Motif batik reusable ---------- */
.batik-strip {
  height: 16px;
  background-image: var(--batik-border);
  background-repeat: repeat-x;
  background-size: 80px 16px;
  background-position: center;
}
.batik-strip.soft {
  background-image: var(--batik-border-soft);
}
.batik-field-bg {
  background-image: var(--batik-field);
  background-repeat: repeat;
  background-size: 120px 120px;
}

/* ---------- Layout umum ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.page { padding: 32px 0 64px; }

/* ---------- Topbar ---------- */
.topbar {
  background: linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 55%, var(--forest-dark) 100%);
  color: #fff;
  padding: 20px 0;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.15rem; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: #fff;
  border: 1.5px solid rgba(232,185,74,0.55);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  padding: 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; }
.btn-logout {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(232,185,74,0.5);
  color: #fff; padding: 8px 16px; border-radius: 10px;
  font-size: 0.85rem; cursor: pointer; transition: 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.26); }

/* ---------- Sidebar / Nav Tabs ---------- */
.nav-tabs-custom {
  display: flex; gap: 6px; background: var(--card);
  padding: 6px; border-radius: 14px; box-shadow: var(--shadow);
  margin-bottom: 28px; flex-wrap: wrap;
  border: 1px solid var(--border);
}
.nav-tabs-custom a {
  padding: 10px 18px; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
  color: var(--text-muted); transition: 0.2s;
}
.nav-tabs-custom a:hover { background: var(--primary-light); color: var(--primary); }
.nav-tabs-custom a.active { background: var(--primary); color: #fff; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  border: 1px solid var(--border);
  position: relative;
}
.card + .card { margin-top: 24px; }
.card-title {
  font-size: 1.1rem; font-weight: 700; margin: 0 0 20px;
  display: flex; align-items: center; gap: 10px;
  color: var(--primary-dark);
}

/* ---------- Stat cards ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.1; color: var(--text); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: 7px; color: var(--text); }
input[type=text], input[type=password], input[type=file], input[type=search], select, textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 0.92rem; font-family: inherit;
  background: #fff; transition: 0.2s; color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 22px; border-radius: 10px; font-weight: 600; font-size: 0.9rem;
  border: none; cursor: pointer; transition: 0.2s; font-family: inherit;
}
.btn-primary { background: linear-gradient(120deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fbeae8; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--forest); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left; padding: 12px 14px; background: var(--primary-light);
  color: var(--primary-dark); font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1.5px solid var(--border);
}
tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: #fdf8f0; }
tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-success { background: #e3efdf; color: var(--success); }
.badge-warning { background: #f7e6d4; color: #9a5b1f; }
.badge-info { background: #fbeee0; color: var(--primary-dark); }
.badge-purple { background: #eef1de; color: var(--forest-dark); }

/* ---------- Alerts ---------- */
.alert {
  padding: 14px 18px; border-radius: 12px; margin-bottom: 20px;
  font-size: 0.9rem; display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #eaf4e8; color: var(--success); border: 1px solid #c8e2c2; }
.alert-error { background: #fbeae8; color: var(--danger); border: 1px solid #f1c6c1; }
.alert-info { background: #fbeee0; color: var(--primary-dark); border: 1px solid #eeddc4; }

/* ---------- Login Page ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 45%, var(--forest-dark) 100%);
  padding: 20px; position: relative; overflow: hidden;
}
.login-wrap::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--batik-field);
  background-repeat: repeat; background-size: 120px 120px;
  opacity: 0.9; pointer-events: none;
}
.login-card {
  background: var(--card); border-radius: 22px; padding: 40px 38px 32px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  position: relative; z-index: 2; overflow: hidden;
}
.login-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 8px; background: linear-gradient(90deg, var(--gold), var(--primary), var(--forest));
}
.login-logo {
  width: 76px; height: 76px; border-radius: 18px; margin: 14px auto 18px;
  background: #fff;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; color: #fff;
  padding: 8px; overflow: hidden; box-shadow: var(--shadow);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-title { text-align: center; font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.login-sub { text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 28px; }

/* ---------- Student landing hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--forest-dark) 100%);
  color: #fff; padding: 56px 0 90px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: var(--batik-field);
  background-repeat: repeat; background-size: 120px 120px;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 2; }
.hero-logo {
  width: 76px; height: 76px; object-fit: contain; background: #fff;
  border-radius: 18px; padding: 8px; margin-bottom: 16px; box-shadow: var(--shadow-lg);
}
.hero h1 { font-size: 2.2rem; font-weight: 800; margin: 14px 0 10px; }
.hero p { color: rgba(255,255,255,0.92); font-size: 1rem; max-width: 560px; margin: 0 auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.16);
  border: 1px solid rgba(232,185,74,0.55);
  padding: 7px 16px; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}

.search-card {
  background: var(--card); border-radius: 20px; box-shadow: var(--shadow-lg);
  padding: 32px; max-width: 560px; margin: -56px auto 0; position: relative; z-index: 3;
  overflow: hidden;
}
.search-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0;
  height: 8px; background: linear-gradient(90deg, var(--gold), var(--primary), var(--forest));
}

.steps-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 18px; margin-top: 40px;
}
.step-card { background: var(--card); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); text-align: center; border: 1px solid var(--border); }
.step-num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin: 0 auto 12px;
}

/* ---------- Choice cards (pilihan mapel) ---------- */
.mapel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; }
.mapel-option {
  border: 2px solid var(--border); border-radius: 14px; padding: 16px;
  cursor: pointer; transition: 0.15s; position: relative; background: #fff;
}
.mapel-option:hover { border-color: var(--primary); background: var(--primary-light); }
.mapel-option input { position: absolute; opacity: 0; }
.mapel-option.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px var(--gold-light); }
.mapel-option .check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; font-size: 0.7rem;
}
.mapel-option.selected .check { background: var(--primary); border-color: var(--primary); color: #fff; }
.mapel-option .name { font-weight: 600; font-size: 0.9rem; }

.progress-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.progress-dots span { width: 34px; height: 5px; border-radius: 3px; background: var(--border); }
.progress-dots span.active { background: var(--primary); }

.info-box {
  background: var(--primary-light); border-radius: 14px; padding: 18px 20px;
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px;
  border: 1px solid #eeddc4;
}
.info-box .icon { font-size: 1.4rem; }
.info-box strong { display: block; margin-bottom: 3px; color: var(--primary-dark); }
.info-box p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.result-card { text-align: center; padding: 48px 32px; }
.result-icon {
  width: 80px; height: 80px; border-radius: 50%; background: #e3efdf; color: var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 2.2rem; margin: 0 auto 20px;
}
.summary-row {
  display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border);
  text-align: left;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--text-muted); font-size: 0.85rem; }
.summary-row .value { font-weight: 700; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; padding: 20px; color: var(--text-muted); font-size: 0.78rem;
}
.site-footer a { color: var(--primary); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .search-card { padding: 22px; margin-top: -40px; }
  .topbar .container { flex-direction: column; gap: 10px; text-align: center; }
}
