/* ===== Sistem Tipografi ===== */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text-color: #2b2f38;
  --text-muted: #6b7280;
  /* Warna tema aplikasi - default biru bawaan. Bisa ditimpa per sekolah lewat
     <style> inline di tiap halaman (lihat includes/layout_top.php, login.php,
     dsb) berdasarkan kolom sekolah.warna_tema. */
  --tema-dark: #1e3c72;
  --tema-base: #2a5298;
  --tema-light: #4facfe;
}

html { font-size: 15px; }

body {
  padding-top: 56px;
  background: #eef1f8;
  font-family: var(--font-sans);
  color: var(--text-color);
  font-size: .9375rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: #1e2a3a;
  letter-spacing: -.01em;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.25rem; margin-bottom: 1.1rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: .875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

p, td, th, li, label, .form-label, .form-control, .form-select { font-size: .9rem; }

small, .small { font-size: .8125rem; }

/* Kartu */
.card-header { font-size: .9rem; font-weight: 700; color: #1e2a3a; background: #f7f9fc; }
.card-body { font-size: .9rem; }
.card-title { font-size: 1rem; font-weight: 700; }

/* Tabel */
.table { font-size: .875rem; }
.table thead th {
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: #4b5566; background: #f4f6fb; border-bottom-width: 1px; white-space: nowrap;
}
.table td, .table th { vertical-align: middle; padding: .6rem .75rem; }

/* Form */
.form-label { font-weight: 600; font-size: .82rem; color: #3a4453; margin-bottom: .3rem; }
.form-control, .form-select { font-size: .875rem; }
.form-control::placeholder { color: #9aa3b2; font-size: .85rem; }
.input-group-text { font-size: .875rem; }

/* Tombol */
.btn { font-size: .85rem; font-weight: 600; letter-spacing: .01em; }
.btn-sm { font-size: .78rem; }
.btn-lg { font-size: .95rem; }

/* Badge */
.badge { font-size: .72rem; font-weight: 600; letter-spacing: .01em; padding: .38em .6em; }

/* Nav / menu */
.nav-link { font-size: .875rem; }
.navbar-brand { font-size: 1.05rem; }
.dropdown-item { font-size: .875rem; }

/* Alert */
.alert { font-size: .875rem; }

.sidebar {
  width: 230px;
  min-height: calc(100vh - 56px);
  padding-top: 10px;
}
.sidebar .nav-link {
  color: #ced4da;
  padding: 10px 16px;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
  background: #495057;
  color: #fff;
}
.content { min-height: calc(100vh - 56px); width: 100%; }

/* Topbar */
.topbar {
  z-index: 1030;
  background: linear-gradient(90deg, var(--tema-dark) 0%, var(--tema-base) 55%, var(--tema-light) 100%) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.topbar .navbar-brand { font-weight: 700; letter-spacing: .3px; }
.topbar .navbar-brand i { color: #ffd166; margin-right: 6px; }

/* Ribbon */
.ribbon-wrap { background: linear-gradient(180deg, #f4f7ff 0%, #e9edf7 100%); border-bottom: 1px solid #dbe1ee; }
.ribbon-tabs { border-bottom: none; }
.ribbon-tabs .nav-link { color: #34495e; font-weight: 600; border-radius: 8px 8px 0 0; }
.ribbon-tabs .nav-link.active { color: #fff; background: var(--tema-base); border-color: var(--tema-base); }
.ribbon-tabs .nav-link:hover:not(.active) { background: #dde6f7; }

.ribbon-icons { display: flex; flex-wrap: wrap; gap: 8px; }
.ribbon-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 92px; height: 76px; padding: 6px 4px; border: 1px solid #e1e6f0; border-radius: 10px;
  background: #ffffff; color: #333; text-decoration: none; font-size: 11px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  position: relative;
}
.ribbon-btn i {
  font-size: 22px; margin-bottom: 5px;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff;
}
.ribbon-btn:hover { background: #f0f4ff; color: #000; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.12); }

/* Warna-warni ikon ribbon berdasarkan urutan */
.ribbon-icons .ribbon-btn:nth-child(9n+1) i { background: linear-gradient(135deg,#43cea2,#185a9d); }
.ribbon-icons .ribbon-btn:nth-child(9n+2) i { background: linear-gradient(135deg,#ff9a56,#ff6a88); }
.ribbon-icons .ribbon-btn:nth-child(9n+3) i { background: linear-gradient(135deg,#6a82fb,#fc5c7d); }
.ribbon-icons .ribbon-btn:nth-child(9n+4) i { background: linear-gradient(135deg,#f7971e,#ffd200); }
.ribbon-icons .ribbon-btn:nth-child(9n+5) i { background: linear-gradient(135deg,#56ab2f,#a8e063); }
.ribbon-icons .ribbon-btn:nth-child(9n+6) i { background: linear-gradient(135deg,#8e2de2,#4a00e0); }
.ribbon-icons .ribbon-btn:nth-child(9n+7) i { background: linear-gradient(135deg,#11998e,#38ef7d); }
.ribbon-icons .ribbon-btn:nth-child(9n+8) i { background: linear-gradient(135deg,#f857a6,#ff5858); }
.ribbon-icons .ribbon-btn:nth-child(9n+9) i { background: linear-gradient(135deg,#396afc,#2948ff); }

/* Dashboard stat cards */
.stat-card {
  border: none; border-radius: 14px; overflow: hidden; color: #2c3e50;
  box-shadow: 0 3px 10px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,.14); }
.stat-card .stat-header {
  padding: 8px 14px; font-weight: 700; color: #fff; font-size: .85rem;
  letter-spacing: .3px; text-transform: uppercase;
}
.stat-card .stat-body { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; }
.stat-card .stat-icon {
  width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
}
.stat-card .stat-number { font-size: 2rem; font-weight: 800; }
.stat-card .stat-sub { font-size: .8rem; color: #6c757d; }

.stat-card.card-blue { background: linear-gradient(135deg,#d9e4ff,#b6c9ff); }
.stat-card.card-blue .stat-header { background: #4361ee; }
.stat-card.card-blue .stat-icon { background: linear-gradient(135deg,#4361ee,#3a0ca3); }

.stat-card.card-orange { background: linear-gradient(135deg,#ffe3c2,#ffcf94); }
.stat-card.card-orange .stat-header { background: #fb8500; }
.stat-card.card-orange .stat-icon { background: linear-gradient(135deg,#fb8500,#e85d04); }

.stat-card.card-green { background: linear-gradient(135deg,#d7f6dc,#b6ecc0); }
.stat-card.card-green .stat-header { background: #2a9d8f; }
.stat-card.card-green .stat-icon { background: linear-gradient(135deg,#2a9d8f,#218380); }

.stat-card.card-purple { background: linear-gradient(135deg,#e6d9ff,#cdb4f7); }
.stat-card.card-purple .stat-header { background: #7b2cbf; }
.stat-card.card-purple .stat-icon { background: linear-gradient(135deg,#7b2cbf,#560bad); }

.stat-card.card-yellow { background: linear-gradient(135deg,#fff3b0,#ffe066); }
.stat-card.card-yellow .stat-header { background: #e9c46a; color: #4a3200; }
.stat-card.card-yellow .stat-icon { background: linear-gradient(135deg,#f4a261,#e9c46a); }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top left, #4a0e6b, #1e0533 60%, #120022);
  padding: 24px 16px;
}
.login-wrap {
  width: 100%; max-width: 960px;
  display: flex; align-items: stretch; gap: 0;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.login-features {
  flex: 1 1 46%;
  background: linear-gradient(150deg, var(--tema-dark), var(--tema-base) 55%, var(--tema-light));
  color: #fff; padding: 34px 30px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-features h4 { color: #fff; font-weight: 800; margin-bottom: 6px; }
.login-features p.lead-sub { color: #dce8ff; font-size: .85rem; margin-bottom: 22px; }
.login-features ul { list-style: none; padding: 0; margin: 0; }
.login-features ul li {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.12);
  font-size: .85rem; line-height: 1.4;
}
.login-features ul li:last-child { border-bottom: none; }
.login-features ul li i {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
  color: #ffd166; font-size: .8rem; margin-top: 1px;
}
.login-features ul li strong { display: block; color: #fff; }
.login-features ul li span { color: #dce8ff; }
.login-card {
  flex: 1 1 54%;
  width: 100%; max-width: 460px; overflow: hidden;
  background: #fff;
}
.login-card .login-head {
  background: linear-gradient(120deg, var(--tema-dark), var(--tema-base), var(--tema-light));
  color: #fff; padding: 26px 22px 20px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
}
.login-card .login-head i { font-size: 40px; color: #ffd166; }
.login-card .login-head img { width: 64px; height: 64px; }
.login-card .login-head h5 { margin: 0; font-weight: 700; }
.login-card .login-head small { color: #d92b2b; font-weight: 700; background: #fff; padding: 1px 8px; border-radius: 4px; display: inline-block; }
.login-card .login-body { padding: 26px 24px; }
.btn-login { background: linear-gradient(135deg,#2ecc71,#27ae60); border: none; font-weight: 700; }
.btn-login:hover { background: linear-gradient(135deg,#27ae60,#1e8449); }

/* Halaman full-page seperti login/aktivasi/registrasi tidak punya navbar
   fixed-top, jadi padding-top global body (disediakan untuk halaman admin)
   harus dinolkan supaya tidak ada celah kosong di atas. */
body.page-fullscreen { padding-top: 0; }

@media (max-width: 767.98px) {
  .login-wrap { flex-direction: column; max-width: 440px; border-radius: 14px; }
  .login-features { padding: 24px 22px; order: 2; }
  .login-card { order: 1; max-width: 100%; }
}

/* ===== Login v2 - gaya hero atas + kartu split (mirip Dapodik) ===== */
.loginv2-page { min-height: 100vh; background: #eef1f8; padding-bottom: 40px; }

.loginv2-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--tema-dark), var(--tema-base) 60%, var(--tema-light));
  padding: 46px 24px 90px;
  color: #fff;
}
.loginv2-hero::before, .loginv2-hero::after {
  content: ""; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.loginv2-hero::before { width: 420px; height: 420px; top: -220px; right: -120px; }
.loginv2-hero::after { width: 300px; height: 300px; bottom: -180px; left: 8%; background: rgba(255,255,255,.06); }

.loginv2-hero-inner {
  position: relative; z-index: 2;
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
}
.loginv2-hero-logo {
  width: 72px; height: 72px; border-radius: 18px; background: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,.2); overflow: hidden;
}
.loginv2-hero-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.loginv2-hero-logo i { font-size: 34px; color: var(--tema-base); }
.loginv2-hero-text h1 { color: #fff; font-size: 1.6rem; font-weight: 800; margin: 0 0 4px; letter-spacing: .3px; }
.loginv2-hero-text p { margin: 0 0 6px; color: rgba(255,255,255,.9); font-size: .9rem; }
.loginv2-hero-text small { background: rgba(255,255,255,.15); padding: 3px 10px; border-radius: 20px; font-weight: 700; letter-spacing: .04em; }

/* Gelombang dekoratif di dasar hero - full-bleed, keluar dari padding hero */
.loginv2-wave { display: block; position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 60px; z-index: 1; }
.loginv2-wave path { fill: #eef1f8; }

/* Footer nama sekolah & tahun */
.loginv2-footer { text-align: center; padding: 18px 12px 6px; color: #7c869c; font-size: .82rem; }

.loginv2-panel-wrap { max-width: 1040px; margin: -70px auto 0; padding: 0 24px; position: relative; z-index: 3; }
.loginv2-panel-card {
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(20,30,60,.18);
  display: flex; align-items: stretch;
}
.loginv2-panel-left { flex: 1 1 50%; padding: 36px 34px; }
.loginv2-panel-left h4 { font-weight: 800; margin-bottom: 20px; }
.loginv2-panel-right {
  flex: 1 1 50%; padding: 36px 34px;
  background: linear-gradient(160deg, #f4f7ff, #e9edf9);
  border-left: 1px solid #e5e9f4;
  display: flex; flex-direction: column; justify-content: center;
}
.loginv2-panel-right h5 { font-weight: 800; color: var(--tema-dark); margin-bottom: 8px; }
.loginv2-panel-right p { color: #5a6478; font-size: .87rem; margin-bottom: 18px; }
.loginv2-panel-right .btn { text-align: left; }

/* Kalau lisensi sudah aktif, panel kanan (ajakan aktivasi) disembunyikan -
   form login jadi satu kolom saja, rapi dan terpusat. */
.loginv2-panel-card.loginv2-single { max-width: 460px; margin: 0 auto; }
.loginv2-panel-card.loginv2-single .loginv2-panel-left { flex: 1 1 100%; }

@media (max-width: 767.98px) {
  .loginv2-hero { padding: 30px 18px 70px; }
  .loginv2-hero-inner { flex-direction: column; text-align: center; gap: 12px; }
  .loginv2-panel-card { flex-direction: column; }
  .loginv2-panel-right { border-left: none; border-top: 1px solid #e5e9f4; }
  .loginv2-panel-wrap { margin-top: -50px; padding: 0 14px; }
  .loginv2-panel-left, .loginv2-panel-right { padding: 26px 22px; }
}

/* Form Input Siswa/Guru bergaya dialog */
.formdlg { border: none; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.12); background: #fff; }
.formdlg-head {
  background: linear-gradient(120deg,#1e3c72,#2a5298,#4facfe); color: #fff;
  padding: 14px 22px;
}
.formdlg-head h4 { margin: 0; font-weight: 800; letter-spacing: .3px; }
.formdlg-head p { margin: 2px 0 0; opacity: .9; font-size: .85rem; }

.formdlg-tabs { background: #eef2fb; border-bottom: 1px solid #dbe1ee; padding: 8px 16px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.formdlg-tabs .nav-link {
  border: none; border-radius: 8px 8px 0 0; color: #445; font-weight: 600; font-size: .88rem;
  padding: 9px 16px; background: transparent;
}
.formdlg-tabs .nav-link i { margin-right: 5px; }
.formdlg-tabs .nav-link.active { background: #fff; color: #1e3c72; box-shadow: 0 -2px 6px rgba(0,0,0,.06); }
.formdlg-body { padding: 22px; background: #fff; }

.foto-box { text-align: center; }
.foto-box .foto-frame {
  width: 130px; height: 150px; border: 2px solid #c7d2e6; border-radius: 8px; background: #f4f6fb;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; overflow: hidden;
}
.foto-box .foto-frame img { width: 100%; height: 100%; object-fit: cover; }
.foto-box .foto-frame i { font-size: 46px; color: #b7c1d6; }
.foto-box label.title { display: block; font-weight: 700; color: #c0392b; margin-bottom: 6px; font-size: .85rem; }

.penempatan-box { background: linear-gradient(160deg,#f4f7ff,#e9edf9); border: 1px solid #dbe1ee; border-radius: 10px; padding: 14px 16px; }
.penempatan-box .title { font-weight: 700; color: #1e3c72; margin-bottom: 10px; }

.formdlg-footer { background: #eef2fb; border-top: 1px solid #dbe1ee; padding: 14px 22px; display: flex; gap: 8px; justify-content: space-between; }
.info-tab-card { background: #f4f7ff; border: 1px dashed #b6c4e6; border-radius: 10px; padding: 24px; text-align: center; color: #445; }
.info-tab-card i { font-size: 34px; color: #4facfe; margin-bottom: 10px; display: block; }

/* ===== Responsif - seluruh aplikasi ===== */

/* Tabel: bisa digeser horizontal di layar kecil supaya tidak merusak layout */
.table-responsive-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Ribbon menu (tab + ikon aksi): scroll horizontal di HP alih-alih menumpuk berantakan */
@media (max-width: 991.98px) {
  .ribbon-tabs {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .ribbon-tabs::-webkit-scrollbar { height: 4px; }
  .ribbon-tabs .nav-item { flex-shrink: 0; }

  .ribbon-icons { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .ribbon-icons .ribbon-btn, .ribbon-icons .dropdown { flex-shrink: 0; }
}

@media (max-width: 767.98px) {
  html { font-size: 14px; }
  body { padding-top: 52px; }

  .content { padding: 14px !important; }

  .topbar .navbar-brand { font-size: .92rem; }
  .topbar span.text-white { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }

  .ribbon-btn { width: 78px; height: 68px; font-size: 10px; }
  .ribbon-btn i { width: 28px; height: 28px; font-size: 18px; }

  /* Kartu form/dialog: kurangi padding supaya konten muat */
  .formdlg-body, .login-card .login-body { padding: 16px; }
  .formdlg-head, .formdlg-footer { padding: 12px 16px; }

  /* Statistik dashboard: 1 kolom penuh di HP */
  .stat-card .stat-number { font-size: 1.6rem; }

  /* Tabel jadi lebih rapat di layar kecil */
  .table td, .table th { padding: .45rem .55rem; font-size: .8rem; }

  /* Tombol full-width di dalam form pada layar sempit */
  .d-flex.gap-2.mt-4 > .btn, .d-flex.gap-2.mt-3 > .btn { min-width: 0; }
}

@media (max-width: 575.98px) {
  .foto-box .foto-frame { width: 110px; height: 128px; }
  .penempatan-box { padding: 12px; }
}

/* Bungkus semua tabel data dengan scroll horizontal otomatis di layar kecil,
   tanpa perlu ubah HTML di tiap halaman (fallback bawaan Bootstrap sudah ada
   lewat .table-responsive, aturan ini untuk tabel yang belum dibungkus). */
@media (max-width: 767.98px) {
  table.table:not(.table-modern) { display: block; overflow-x: auto; white-space: nowrap; }
}
