/* =========================================================================
   FATAHNA DIGITAL LABS — THEME.CSS
   =========================================================================
   INI ADALAH SATU-SATUNYA FILE YANG PERLU DIEDIT UNTUK MENGUBAH TAMPILAN.
   Semua halaman (login, index, dashboard, dan CRUD lain di masa depan)
   memuat file ini melalui includes/header.php.

   Struktur file ini:
   1. Font & Reset
   2. Design Tokens (variabel warna, spacing, radius)
   3. Layout (sidebar, topbar, content)
   4. Komponen (tombol, tabel, form, badge, paging, card)
   5. Halaman Login
   6. Utilities & Responsive
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. FONT & RESET
   ------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root{
  /* ---------------------------------------------------------------------
     2. DESIGN TOKENS — ubah nilai di bawah ini untuk mengubah seluruh tema
     --------------------------------------------------------------------- */

  /* Warna brand (sesuai logo) */
  --c-blue:        #2F80ED;
  --c-tosca:       #00C2A8;
  --c-purple:      #A855F7;

  /* Warna teks */
  --c-text:        #111827; /* teks utama */
  --c-text-muted:  #6B7280; /* teks "Digital Labs" & teks sekunder */
  --c-text-faint:  #9CA3AF;

  /* Warna latar & permukaan */
  --c-bg:          #FFFFFF;
  --c-surface:     #F9FAFB; /* latar sidebar / hover / stripe tabel */
  --c-surface-2:   #F3F4F6; /* latar header tabel / input disabled */
  --c-border:      #E5E7EB;
  --c-border-strong:#D1D5DB;

  /* Warna status (tetap flat, dipakai secukupnya) */
  --c-success:     #00C2A8; /* pakai tosca sebagai "success" brand */
  --c-success-bg:  #E6FAF7;
  --c-danger:      #E11D48;
  --c-danger-bg:   #FDE8ED;
  --c-warning:     #D97706;
  --c-warning-bg:  #FEF3E2;
  --c-info:        #2F80ED;
  --c-info-bg:     #EAF2FE;

  /* Tipografi */
  --font-brand:  'Sora', sans-serif;
  --font-ui:     'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --fs-xs:   11px;
  --fs-sm:   12.5px;
  --fs-base: 13.5px;
  --fs-md:   15px;
  --fs-lg:   18px;
  --fs-xl:   22px;

  /* Spacing (kompak) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* Radius — kecil & flat, HINDARI bentuk balon/pill */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* Bayangan — tipis saja, desain ini mengandalkan garis (border), bukan shadow */
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 2px 6px rgba(17, 24, 39, 0.06);

  /* Ukuran layout */
  --sidebar-w: 232px;
  --topbar-h: 56px;
}

*, *::before, *::after{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4{
  margin: 0 0 var(--sp-2) 0;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.3;
}
h1{ font-size: var(--fs-xl); }
h2{ font-size: var(--fs-lg); }
h3{ font-size: var(--fs-md); }

a{ color: var(--c-blue); text-decoration: none; }
a:hover{ text-decoration: underline; }

p{ margin: 0 0 var(--sp-3) 0; color: var(--c-text-muted); }

::-webkit-scrollbar{ width: 8px; height: 8px; }
::-webkit-scrollbar-track{ background: transparent; }
::-webkit-scrollbar-thumb{ background: var(--c-border-strong); border-radius: var(--radius-sm); }

/* -------------------------------------------------------------------------
   BRAND / LOGO — dipakai di sidebar & halaman login
   ------------------------------------------------------------------------- */
.ftn-brand{
  display: flex;
  align-items: center;
  text-decoration: none;
}
.ftn-brand:hover{ text-decoration: none; }
.ftn-brand-logo{
  display: block;
  height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
/* Ukuran besar untuk halaman login */
.ftn-brand--lg .ftn-brand-logo{
  height: 56px;
}

/* -------------------------------------------------------------------------
   3. LAYOUT — APP SHELL (sidebar + topbar + content)
   ------------------------------------------------------------------------- */
.app-shell{ display: flex; min-height: 100vh; }

.app-sidebar{
  width: var(--sidebar-w);
  flex: none;
  background: var(--c-bg);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
}
.app-sidebar-head{
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  flex: none;
}
.app-sidebar-nav{
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-2);
}
.nav-section-label{
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
}
.nav-item{
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--c-text-muted);
  font-size: var(--fs-base);
  font-weight: 500;
  margin-bottom: 1px;
}
.nav-item:hover{
  background: var(--c-surface);
  color: var(--c-text);
  text-decoration: none;
}
.nav-item.is-active{
  background: var(--c-info-bg);
  color: var(--c-blue);
}
.nav-item .ico{
  width: 16px; height: 16px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: currentColor;
}
.app-sidebar-foot{
  border-top: 1px solid var(--c-border);
  padding: var(--sp-3);
  flex: none;
}

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

.app-topbar{
  height: var(--topbar-h);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  position: sticky;
  top: 0;
  background: var(--c-bg);
  z-index: 10;
}
.app-topbar .breadcrumb{
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.app-topbar .breadcrumb b{ color: var(--c-text); font-weight: 600; }
.topbar-user{
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.topbar-user .avatar{
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: var(--fs-xs); color: var(--c-text);
}

.app-content{
  padding: var(--sp-5);
  flex: 1;
}

.page-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.page-head h1{ margin-bottom: 2px; }
.page-head .desc{ font-size: var(--fs-sm); color: var(--c-text-muted); margin: 0; }
.page-head .actions{ display: flex; gap: var(--sp-2); flex: none; }

/* -------------------------------------------------------------------------
   4a. CARD / PANEL
   ------------------------------------------------------------------------- */
.card{
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
}
.card-head h3{ margin: 0; }
.card-body{ padding: var(--sp-4); }

.stat-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.stat-card{
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}
.stat-card .label{
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: var(--sp-1);
}
.stat-card .value{
  font-size: 24px;
  font-weight: 700;
  color: var(--c-text);
}
.stat-card .delta{ font-size: var(--fs-xs); margin-top: 2px; }
.stat-card .delta.up{ color: var(--c-tosca); }
.stat-card .delta.down{ color: var(--c-danger); }
.stat-card .accent{ width: 28px; height: 3px; border-radius: 2px; margin-bottom: var(--sp-2); }
.stat-card .accent.blue{ background: var(--c-blue); }
.stat-card .accent.tosca{ background: var(--c-tosca); }
.stat-card .accent.purple{ background: var(--c-purple); }
.stat-card .accent.gray{ background: var(--c-border-strong); }

/* -------------------------------------------------------------------------
   4b. TOMBOL (BUTTONS) — flat, sudut kecil, tanpa efek balon
   ------------------------------------------------------------------------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.btn:hover{ text-decoration: none; }
.btn:focus-visible{ outline: 2px solid var(--c-blue); outline-offset: 1px; }

.btn-sm{ height: 28px; padding: 0 10px; font-size: var(--fs-xs); }

.btn-primary{ background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.btn-primary:hover{ background: #2568c9; border-color: #2568c9; }

.btn-tosca{ background: var(--c-tosca); border-color: var(--c-tosca); color: #fff; }
.btn-tosca:hover{ background: #00a892; border-color: #00a892; }

.btn-purple{ background: var(--c-purple); border-color: var(--c-purple); color: #fff; }
.btn-purple:hover{ background: #9333ea; border-color: #9333ea; }

.btn-outline{ background: var(--c-bg); border-color: var(--c-border-strong); color: var(--c-text); }
.btn-outline:hover{ background: var(--c-surface); border-color: var(--c-text-faint); }

.btn-ghost{ background: transparent; border-color: transparent; color: var(--c-text-muted); }
.btn-ghost:hover{ background: var(--c-surface); color: var(--c-text); }

.btn-danger{ background: var(--c-bg); border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover{ background: var(--c-danger-bg); }

.btn-block{ width: 100%; }
.btn[disabled]{ opacity: .5; cursor: not-allowed; }

.icon-btn{
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-muted);
  cursor: pointer;
}
.icon-btn:hover{ background: var(--c-surface); color: var(--c-text); }

/* -------------------------------------------------------------------------
   4c. FORM
   ------------------------------------------------------------------------- */
.form-group{ margin-bottom: var(--sp-3); }
.form-label{
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 6px;
}
.form-control, select.form-control, textarea.form-control{
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea.form-control{ height: auto; padding: var(--sp-2) var(--sp-3); min-height: 88px; resize: vertical; }
.form-control:focus{
  outline: none;
  border-color: var(--c-blue);
  box-shadow: 0 0 0 3px rgba(47,128,237,0.12);
}
.form-control::placeholder{ color: var(--c-text-faint); }
.form-hint{ font-size: var(--fs-xs); color: var(--c-text-muted); margin-top: 4px; }
.form-error{ font-size: var(--fs-xs); color: var(--c-danger); margin-top: 4px; }
.form-row{ display: flex; gap: var(--sp-3); }
.form-row .form-group{ flex: 1; }

.input-check{ display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--c-text-muted); }
.input-check input{ width: 15px; height: 15px; accent-color: var(--c-blue); }

.search-box{ position: relative; max-width: 260px; }
.search-box .form-control{ padding-left: 32px; }
.search-box .ico{
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--c-text-faint);
}

/* -------------------------------------------------------------------------
   4d. TABEL — compact, garis tipis, TANPA sudut bulat berlebihan
   ------------------------------------------------------------------------- */
.table-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.table-toolbar .left, .table-toolbar .right{ display: flex; align-items: center; gap: var(--sp-2); }

.table-wrap{ overflow-x: auto; }
table.data-table{
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.data-table thead th{
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  background: var(--c-surface);
  padding: 9px var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
.data-table thead th.col-center, .data-table td.col-center{ text-align: center; }
.data-table thead th.col-right, .data-table td.col-right{ text-align: right; }
.data-table tbody td{
  padding: 9px var(--sp-3);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  vertical-align: middle;
}
.data-table tbody tr:hover td{ background: var(--c-surface); }
.data-table tbody tr:last-child td{ border-bottom: none; }
.data-table .cell-muted{ color: var(--c-text-muted); }
.data-table .cell-actions{ display: flex; gap: 6px; justify-content: flex-end; }
.data-table .row-num{ color: var(--c-text-faint); width: 36px; }

.table-empty{
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}

/* Badge status — flat berlabel, bukan pill besar */
.badge{
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
}
.badge::before{ content: ""; width: 6px; height: 6px; border-radius: 2px; background: currentColor; }
.badge-success{ background: var(--c-success-bg); color: #00806f; }
.badge-danger{ background: var(--c-danger-bg); color: var(--c-danger); }
.badge-warning{ background: var(--c-warning-bg); color: var(--c-warning); }
.badge-info{ background: var(--c-info-bg); color: var(--c-blue); }
.badge-neutral{ background: var(--c-surface-2); color: var(--c-text-muted); }

/* -------------------------------------------------------------------------
   4e. PAGINATION
   ------------------------------------------------------------------------- */
.pagination-bar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.pagination-info{ font-size: var(--fs-xs); color: var(--c-text-muted); }
.pagination{ display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pagination li a, .pagination li span{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-text-muted);
}
.pagination li a:hover{ background: var(--c-surface); text-decoration: none; color: var(--c-text); }
.pagination li.active span{ background: var(--c-blue); border-color: var(--c-blue); color: #fff; }
.pagination li.disabled span{ color: var(--c-text-faint); background: var(--c-surface-2); cursor: not-allowed; }

/* -------------------------------------------------------------------------
   5. HALAMAN LOGIN
   ------------------------------------------------------------------------- */
.login-page{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  padding: var(--sp-4);
}
.login-box{
  width: 100%;
  max-width: 380px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-6) var(--sp-5);
}
.login-box .ftn-brand{ justify-content: center; margin-bottom: var(--sp-5); }
.login-box h1{ font-size: var(--fs-md); text-align: center; margin-bottom: 2px; }
.login-box .login-desc{ text-align: center; font-size: var(--fs-sm); margin-bottom: var(--sp-5); }
.login-box .btn-primary{ margin-top: var(--sp-2); }
.login-foot{
  text-align: center;
  margin-top: var(--sp-4);
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}
.alert{
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-3);
  border: 1px solid transparent;
}
.alert-danger{ background: var(--c-danger-bg); color: var(--c-danger); border-color: #f7c9d4; }
.alert-success{ background: var(--c-success-bg); color: #00806f; border-color: #b9ebe4; }

/* -------------------------------------------------------------------------
   6. UTILITIES & RESPONSIVE
   ------------------------------------------------------------------------- */
.text-muted{ color: var(--c-text-muted); }
.text-faint{ color: var(--c-text-faint); }
.mb-0{ margin-bottom: 0 !important; }
.d-flex{ display: flex; }
.gap-2{ gap: var(--sp-2); }
.gap-3{ gap: var(--sp-3); }

@media (max-width: 960px){
  .stat-grid{ grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px){
  .app-sidebar{ transform: translateX(-100%); transition: transform .18s ease; }
  .app-sidebar.is-open{ transform: translateX(0); }
  .app-main{ margin-left: 0; }
  .stat-grid{ grid-template-columns: 1fr; }
}
