/* Lokasi fail: assets/css/app.css
   Sistem reka bentuk: flat moden, sudut lengkung, bayang lembut, togol
   terang/gelap melalui pemboleh ubah CSS (data-theme pada <html>). */

@import url('../vendor/fonts/inter/inter.css');

:root {
  --font-app: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-alt: #f1f3f8;
  --text: #1c2331;
  --text-muted: #667085;
  --border: #e4e7ec;
  --primary: #3457ec;
  --primary-hover: #2a46c4;
  --primary-soft: #eaefff;
  --success: #12b76a;
  --warning: #f79009;
  --danger: #e02424;
  --info: #0ba5ec;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 2px 8px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 264px;
}

:root[data-theme="dark"] {
  --bg: #0d1220;
  --surface: #151b2c;
  --surface-alt: #1b2338;
  --text: #e7eaf3;
  --text-muted: #93a0b8;
  --border: #262f47;
  --primary: #5c7cfa;
  --primary-hover: #7c96fb;
  --primary-soft: #1c2748;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1220;
    --surface: #151b2c;
    --surface-alt: #1b2338;
    --text: #e7eaf3;
    --text-muted: #93a0b8;
    --border: #262f47;
    --primary: #5c7cfa;
    --primary-hover: #7c96fb;
    --primary-soft: #1c2748;
  }
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-app);
  background: var(--bg);
  color: var(--text);
  transition: background-color .15s ease, color .15s ease;
}

a { color: var(--primary); }

/* ---------- Bingkai Aplikasi (sidebar + topbar) ---------- */

.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .2s ease;
}

.app-sidebar .brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.1rem 1.25rem; font-weight: 700; font-size: 1.02rem;
  border-bottom: 1px solid var(--border);
}
.app-sidebar .brand .bi { font-size: 1.4rem; color: var(--primary); }

.app-nav { padding: .75rem; }
.app-nav .nav-section {
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted); padding: 1rem .75rem .35rem;
}
.app-nav .nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  color: var(--text); font-size: .89rem; font-weight: 500;
}
.app-nav .nav-link .bi { font-size: 1.05rem; color: var(--text-muted); }
.app-nav .nav-link:hover { background: var(--surface-alt); }
.app-nav .nav-link.active { background: var(--primary-soft); color: var(--primary); }
.app-nav .nav-link.active .bi { color: var(--primary); }

.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1.5rem;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.app-topbar .brand-logo { height: 28px; width: 28px; object-fit: contain; flex-shrink: 0; }

.app-content { padding: 1.5rem; padding-bottom: 3rem; }

.app-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1010;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .4rem 1.25rem;
  font-size: .72rem; color: var(--text-muted);
  background: var(--surface); border-top: 1px solid var(--border);
}
@media print { .app-footer { display: none !important; } }

.theme-toggle {
  border: 1px solid var(--border); background: var(--surface-alt);
  color: var(--text); border-radius: 999px; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
}
:root[data-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .bi-sun { display: none; }

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.terbuka { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

/* ---------- Kad, borang & jadual ---------- */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); }

.stat-card { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.stat-card .stat-icon {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-size: 1.25rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; }

.form-control, .form-select {
  background: var(--surface); color: var(--text); border-color: var(--border);
  border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
  background: var(--surface); color: var(--text);
  border-color: var(--primary); box-shadow: 0 0 0 .2rem var(--primary-soft);
}

.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.table { color: var(--text); }
.table > :not(caption) > * > * { border-bottom-color: var(--border); }
.badge { font-weight: 600; border-radius: 999px; padding: .4em .75em; }

/* Status kelulusan/kehadiran/kes - dipakai merentas modul cuti/kehadiran/tatatertib */
.status-badge.menunggu, .status-badge.dalam_siasatan { background: #fef3c7; color: #92400e; }
.status-badge.diluluskan, .status-badge.selesai, .status-badge.hadir, .status-badge.aktif { background: #d1fae5; color: #065f46; }
.status-badge.ditolak, .status-badge.tidak_hadir { background: #fee2e2; color: #991b1b; }
.status-badge.dibatalkan, .status-badge.tidak_aktif { background: #e5e7eb; color: #374151; }
.status-badge.lewat, .status-badge.rayuan { background: #fef3c7; color: #92400e; }
.status-badge.cuti, .status-badge.mc, .status-badge.bertukar { background: #dbeafe; color: #1e40af; }
.status-badge.berhenti_pilihan { background: #e5e7eb; color: #374151; }
.status-badge.berhenti_paksa, .status-badge.tahan_kerja { background: #fee2e2; color: #991b1b; }
.status-badge.meninggal_dunia { background: #e5e7eb; color: #1f2937; }
:root[data-theme="dark"] .status-badge { filter: brightness(.92) saturate(1.3); }

/* ---------- Log masuk ---------- */

.laman-log-masuk {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--bg), var(--surface-alt));
  padding: 1rem; padding-bottom: 3rem;
}
.kad-log-masuk { width: 100%; max-width: 400px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }

/* ---------- Laman utama awam (index.php) - bingkai gambar penuh + kad kaca,
   sama corak dgn admin/login.php supaya identiti visual konsisten merentas
   apps adik-beradik JPJ Pahang. Mobile-first: susun menegak < 992px. ---------- */
.awam-topbar {
  background: rgba(8, 16, 38, .92); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1.25rem; font-weight: 600; font-size: .9rem;
  flex-wrap: wrap; gap: .5rem;
}
.awam-topbar-kanan { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.awam-topbar-kanan .brand-logo { height: 30px; width: 30px; }

.awam-hero {
  position: relative;
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 2rem;
  padding: 2.5rem 5vw;
  background-image:
    linear-gradient(120deg, rgba(9, 20, 56, .90) 0%, rgba(19, 54, 138, .74) 45%, rgba(30, 80, 190, .55) 100%),
    url('../img/latar-log-masuk.jpg');
  background-size: cover; background-position: center;
}
.awam-card-wrap { flex: 1 1 380px; width: 100%; max-width: 440px; }
.awam-card {
  background: rgba(255, 255, 255, .14);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  color: #fff;
}
.awam-card h1 { color: #fff; }
.awam-card .text-muted { color: rgba(255, 255, 255, .72) !important; }
.awam-card label { color: rgba(255, 255, 255, .92); }
.awam-card .form-control { background: rgba(255, 255, 255, .94); border: none; }
.awam-card .form-control:focus { box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .35); }

.awam-tagline { flex: 1 1 320px; color: #fff; position: relative; }
.awam-tagline h2 {
  font-size: 1.65rem; font-weight: 700; line-height: 1.35;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .45);
  max-width: 560px;
}
.awam-tagline p { color: rgba(255, 255, 255, .85); text-shadow: 0 2px 12px rgba(0, 0, 0, .4); max-width: 520px; }

@media (max-width: 991.98px) {
  .awam-tagline { order: -1; text-align: center; }
  .awam-tagline h2, .awam-tagline p { margin-left: auto; margin-right: auto; }
  .awam-card-wrap { margin: 0 auto; }
  .awam-hero { padding: 2rem 1.25rem; }
}

.app-footer--auth {
  background: rgba(8, 16, 38, .92); color: rgba(255, 255, 255, .75);
  border-top: 1px solid rgba(255, 255, 255, .12);
  left: 0;
}
.app-footer--auth a { color: #fff; }

/* .app-footer bersifat position:fixed - laman awam ni skrol panjang (hasil
   carian + aktiviti akan datang), jadi perlu ruang bawah supaya kandungan
   akhir tidak tertutup footer tetap. */
.laman-awam { padding-bottom: 3.5rem; }
@media (max-width: 575.98px) { .laman-awam { padding-bottom: 4.5rem; } }

/* ---------- Seksyen kandungan di bawah hero (index.php) ---------- */
.awam-seksyen { padding: 2rem 5vw 3rem; }
.awam-seksyen-tajuk { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; }
@media (max-width: 575.98px) { .awam-seksyen { padding: 1.5rem 1rem 2rem; } }

/* ---------- Slider kad Aktiviti/Kursus Akan Datang (index.php) ---------- */
.slider-aktiviti-bekas { position: relative; }
.slider-aktiviti {
  display: flex; gap: 1rem; overflow-x: auto; padding: .25rem .1rem 1rem;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.slider-aktiviti::-webkit-scrollbar { height: 6px; }
.slider-aktiviti::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.kad-slider-aktiviti {
  flex: 0 0 auto; width: 300px; scroll-snap-align: start;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.kad-slider-header { color: #fff; padding: .9rem 1rem; }
.kad-slider-kategori {
  display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: rgba(255, 255, 255, .22); border-radius: 999px; padding: .15rem .55rem; margin-bottom: .4rem;
}
.kad-slider-header h3 { font-size: .95rem; font-weight: 700; margin: 0; line-height: 1.35; }

.kad-warna-latihan .kad-slider-header { background: linear-gradient(135deg, #4361ee, #6f8dff); }
.kad-warna-sesi .kad-slider-header { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.kad-warna-kendiri .kad-slider-header { background: linear-gradient(135deg, #7c3aed, #a78bfa); }

.kad-slider-body { padding: 1rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.kad-slider-baris { display: flex; align-items: flex-start; gap: .5rem; font-size: .8rem; color: var(--text); }
.kad-slider-baris i { color: var(--text-muted); margin-top: .15rem; }
.kad-slider-deskripsi {
  font-size: .78rem; color: var(--text-muted); margin: .1rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.kad-slider-footer { margin-top: auto; padding-top: .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.lencana-slider {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600;
  background: var(--surface-alt); color: var(--text-muted); border-radius: 999px; padding: .25rem .6rem;
}

.slider-nav {
  position: absolute; top: 45%; transform: translateY(-50%); z-index: 2;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.slider-nav-kiri { left: -14px; }
.slider-nav-kanan { right: -14px; }
@media (max-width: 575.98px) {
  .slider-nav { display: none; }
  .kad-slider-aktiviti { width: 100%; }
}

/* Jadual moden padat utk senarai Aktiviti/Kursus Disertai (index.php) */
.jadual-rekod-moden {
  font-size: .8rem;
}
.jadual-rekod-moden thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); font-weight: 700; background: var(--surface-alt);
  position: sticky; top: 0; z-index: 1;
}
.jadual-rekod-moden td, .jadual-rekod-moden th { padding: .5rem .6rem; vertical-align: middle; }
.bekas-jadual-rekod { max-height: 360px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Kad header berwarna utk keputusan carian (index.php) */
.kad-senarai-header {
  background: linear-gradient(135deg, #4361ee, #6f8dff);
  color: #fff; padding: .9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem;
}
.kad-senarai-header-kiri { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .95rem; }
.kad-senarai-header #pilih-tahun-rekod { background: rgba(255, 255, 255, .94); border: none; }

.statistik-jam-kursus {
  background: var(--primary-soft); color: var(--primary); border-radius: var(--radius-sm);
  padding: .4rem .8rem; font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.statistik-jam-kursus--kurang { background: #fee2e2; color: #991b1b; }
.statistik-jam-kursus--cukup { background: #d1fae5; color: #065f46; }
:root[data-theme="dark"] .statistik-jam-kursus--kurang,
:root[data-theme="dark"] .statistik-jam-kursus--cukup { filter: brightness(.95) saturate(1.25); }
.brand-logo-lg { height: 64px; width: 64px; object-fit: contain; }
