/* =============================================
   assets/css/style.css
   Gaya utama sistem - Modern & Bersih
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS VARIABLES ─── */
:root {
  --clr-bg:       #0f1117;
  --clr-surface:  #1a1d27;
  --clr-surface2: #222536;
  --clr-border:   #2e3348;
  --clr-primary:  #4f7dff;
  --clr-primary2: #3a6aee;
  --clr-accent:   #00d4a1;
  --clr-danger:   #ff4f6b;
  --clr-warn:     #ffb830;
  --clr-text:     #e8eaf0;
  --clr-text2:    #9096b0;
  --clr-text3:    #5a6080;

  --radius-sm:    6px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.25);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.35);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.5);
  --font-main:    'Plus Jakarta Sans', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;
  --transition:   all 0.2s ease;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--clr-primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--clr-accent); }

/* ─── LAYOUT ─── */
.layout { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 260px;
  background: var(--clr-surface);
  border-right: 1px solid var(--clr-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--clr-border);
}

.sidebar-logo h1 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--clr-text2);
  margin-bottom: 4px;
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--clr-text);
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-text3);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--clr-text2);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--clr-surface2);
  color: var(--clr-text);
}

.nav-item.aktif {
  background: rgba(79,125,255,0.15);
  color: var(--clr-primary);
  font-weight: 600;
}

.nav-item .nav-icon { font-size: 17px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--clr-border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--clr-surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-nama { font-size: 13px; font-weight: 600; color: var(--clr-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--clr-text3); text-transform: capitalize; }

/* ─── MAIN CONTENT ─── */
.main {
  flex: 1;
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-title { font-size: 18px; font-weight: 700; }
.page-sub   { font-size: 13px; color: var(--clr-text2); margin-top: 2px; }

.content { padding: 32px; flex: 1; }

/* ─── CARDS ─── */
.card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--clr-text2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── STATS GRID ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover { border-color: var(--clr-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-label  { font-size: 12px; font-weight: 600; color: var(--clr-text2); text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value  { font-size: 36px; font-weight: 800; margin: 8px 0 4px; font-family: var(--font-mono); }
.stat-ikon   { position: absolute; right: 16px; top: 16px; font-size: 26px; opacity: 0.3; }
.stat-c1 .stat-value { color: var(--clr-primary); }
.stat-c2 .stat-value { color: var(--clr-accent); }
.stat-c3 .stat-value { color: var(--clr-warn); }
.stat-c4 .stat-value { color: var(--clr-danger); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--clr-primary2); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,125,255,0.4); }

.btn-accent  { background: var(--clr-accent); color: #0f1117; }
.btn-accent:hover  { background: #00b888; color: #0f1117; transform: translateY(-1px); }

.btn-danger  { background: rgba(255,79,107,0.15); color: var(--clr-danger); border: 1px solid rgba(255,79,107,0.3); }
.btn-danger:hover  { background: var(--clr-danger); color: #fff; }

.btn-ghost   { background: var(--clr-surface2); color: var(--clr-text2); border: 1px solid var(--clr-border); }
.btn-ghost:hover   { background: var(--clr-border); color: var(--clr-text); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead tr { border-bottom: 2px solid var(--clr-border); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--clr-text3);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--clr-border);
  transition: var(--transition);
}

tbody tr:hover { background: var(--clr-surface2); }
tbody td { padding: 14px 16px; color: var(--clr-text); vertical-align: middle; }

.td-nama { font-weight: 600; color: var(--clr-text); }
.td-meta { font-size: 12px; color: var(--clr-text2); margin-top: 3px; }

/* ─── BADGE / STATUS ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge::before { content: '●'; font-size: 8px; }
.badge-akan    { background: rgba(79,125,255,0.15); color: var(--clr-primary); }
.badge-aktif   { background: rgba(0,212,161,0.15);  color: var(--clr-accent); }
.badge-selesai { background: rgba(90,96,128,0.25);  color: var(--clr-text2); }
.badge-batal   { background: rgba(255,79,107,0.15); color: var(--clr-danger); }

/* ─── FORMS ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 13px; font-weight: 600; color: var(--clr-text2); }
label span.wajib { color: var(--clr-danger); margin-left: 3px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--clr-text);
  font-family: var(--font-main);
  font-size: 14px;
  transition: var(--transition);
  width: 100%;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(79,125,255,0.15);
}

input::placeholder, textarea::placeholder { color: var(--clr-text3); }
textarea { resize: vertical; min-height: 100px; }
select option { background: var(--clr-surface); }

.form-error { font-size: 12px; color: var(--clr-danger); margin-top: 2px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--clr-text3); text-transform: uppercase; }
.filter-group input, .filter-group select { width: auto; padding: 8px 12px; font-size: 13px; }

/* ─── ALERTS ─── */
.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
}

.alert-ikon { font-size: 18px; font-weight: 800; }
.alert-berjaya { background: rgba(0,212,161,0.12); border: 1px solid rgba(0,212,161,0.3); color: var(--clr-accent); }
.alert-ralat   { background: rgba(255,79,107,0.12); border: 1px solid rgba(255,79,107,0.3); color: var(--clr-danger); }
.alert-info    { background: rgba(79,125,255,0.12); border: 1px solid rgba(79,125,255,0.3); color: var(--clr-primary); }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(79,125,255,0.12) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,212,161,0.08) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  pointer-events: none;
}

.login-box {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon-big {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.login-logo h1 { font-size: 22px; font-weight: 800; }
.login-logo p  { font-size: 14px; color: var(--clr-text2); margin-top: 4px; }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--clr-text3);
}
.empty-state .ikon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3    { font-size: 16px; color: var(--clr-text2); margin-bottom: 8px; }
.empty-state p     { font-size: 14px; }

/* ─── MODAL ─── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.tunjuk { display: flex; }

.modal {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalMasuk 0.2s ease;
}

@keyframes modalMasuk {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal-sub   { font-size: 14px; color: var(--clr-text2); margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ─── RESPONSIVE ─── */
/* utility classes — see end of file */

/* ─── LIGHTBOX ─── */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(8px);
}
.lightbox-overlay.tunjuk { display: flex; }
.lightbox-overlay img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 60px rgba(0,0,0,0.8);
  object-fit: contain;
  animation: lbMasuk 0.2s ease;
}
@keyframes lbMasuk {
  from { opacity:0; transform: scale(0.9); }
  to   { opacity:1; transform: scale(1); }
}
.lightbox-tutup {
  position: fixed;
  top: 20px; right: 24px;
  font-size: 32px;
  color: #fff;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 1001;
  line-height: 1;
}
.lightbox-tutup:hover { opacity: 1; }
.img-boleh-klik { cursor: zoom-in; }

/* Kad gambar boleh klik */
.kad-boleh-klik::after {
  content: '🔍';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 0;
}
.kad-boleh-klik:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════
   OVERLAY & SIDEBAR MOBILE
   ═══════════════════════════════════════════════════ */

/* Overlay gelap di belakang sidebar */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 150;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#overlay.aktif { display: block; }

/* Butang X dalam sidebar */
.sidebar-tutup {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: var(--clr-surface2);
  border: 1px solid var(--clr-border);
  border-radius: 50%;
  color: var(--clr-text2);
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.2s;
  z-index: 10;
}
.sidebar-tutup:hover { background: var(--clr-danger); color: #fff; border-color: var(--clr-danger); }

/* Butang hamburger ☰ */
.btn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: var(--clr-surface2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.btn-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--clr-text);
  border-radius: 2px;
  transition: all 0.25s;
}

/* Prevent body scroll bila sidebar buka */
body.no-scroll { overflow: hidden; }

/* Topbar date — sembunyi bila kecil */
.topbar-date { font-size: 13px; color: var(--clr-text2); white-space: nowrap; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE — TABLET (max 900px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 900px) {

  /* Sidebar — slide dari kiri, atas semua elemen */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }
  .sidebar.buka {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0,0,0,0.5);
  }

  /* Tunjuk butang tutup dalam sidebar */
  .sidebar-tutup { display: flex; }

  /* Tunjuk hamburger dalam topbar */
  .btn-hamburger { display: flex; }

  /* Main content — penuh lebar */
  .main { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 12px 16px; gap: 12px; }
  .page-title { font-size: 16px; }
  .page-sub { font-size: 12px; }
  .topbar-date { display: none; }

  /* Content */
  .content { padding: 16px; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 30px; }

  /* Form */
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* Filter bar scroll */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .filter-bar::-webkit-scrollbar { height: 3px; }
  .filter-bar::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 3px; }

  /* Table scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 560px; }

  /* Card */
  .card { padding: 16px; }
  .card-title { font-size: 13px; }

  /* Modal */
  .modal { padding: 24px 18px; max-width: calc(100vw - 24px); margin: 0 12px; }

  /* Upload zone */
  .upload-zone { padding: 24px 16px; }

  /* Aktiviti kad grid */
  .aktiviti-grid { grid-template-columns: 1fr !important; }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — TELEFON (max 480px)
   ═══════════════════════════════════════════════════ */
@media (max-width: 480px) {

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 26px; }
  .stat-label { font-size: 10px; }
  .stat-ikon { font-size: 20px; }

  /* Topbar */
  .topbar { padding: 10px 12px; }
  .page-title { font-size: 15px; }

  /* Content */
  .content { padding: 12px; }

  /* Kad gambar */
  .kad-gambar { height: 150px; }

  /* Butang */
  .btn { padding: 12px 16px; }
  .btn-sm { padding: 9px 14px; font-size: 13px; }

  /* Login */
  .login-box { padding: 28px 20px; }

  /* Table — lebih kecil */
  thead th, tbody td { padding: 9px 10px; font-size: 13px; }
}

/* ═══════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════ */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mb-28  { margin-bottom: 28px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--clr-text2); }
.text-right { text-align: right; }
.fw-600 { font-weight: 600; }
