/* =========================================
   FILE THEME: SPPG (COMPACT & BORDERED)
   ========================================= */

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

/* --- TEMA DEFAULT (STRIPE - LIGHT MODE) --- */
:root {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-light: #fffbeb;
  --border: #e2e8f0;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 8px;
  --transition: all 0.2s ease-in-out;
  --shadow: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-hover: 0 4px 6px -1px rgba(0,0,0,0.05);
}

/* --- TEMA LINEAR (DARK MODE) --- */
body.theme-linear {
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --bg-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #fbbf24;
  --primary-hover: #f59e0b;
  --primary-light: rgba(251, 191, 36, 0.1);
  --border: #334155;
  --danger: #f87171;
  --success: #34d399;
  --radius: 6px;
  --shadow: 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-hover: 0 0 0 1px rgba(255,255,255,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* =================== AUTH PAGES (LOGIN/REGISTER) =================== */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background-color: var(--bg-body); padding: 20px; position: relative;
}
.auth-card {
  width: 100%; max-width: 380px;
  background-color: var(--bg-card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 28px; border: 1px solid var(--border); position: relative;
}
.auth-title { text-align: center; margin-bottom: 20px; }
.auth-title h1 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 4px; }
.auth-title p { font-size: 0.8rem; color: var(--text-muted); }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.85rem; color: var(--text-muted); }
.auth-links a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* =================== KOMPONEN DASAR =================== */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow); margin-bottom: 16px; transition: var(--transition);
}
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-main); }
h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; color: var(--text-main); }

/* =================== FORM =================== */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
label { font-size: 11px; font-weight: 600; color: var(--text-muted); }
input, select, textarea {
  width: 100%; padding: 8px 12px; 
  height: 36px;
  font-family: inherit; font-size: 13px;
  color: var(--text-main); background-color: var(--bg-input);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition); outline: none;
}
textarea { height: auto; min-height: 70px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light);
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 14px; 
  height: 34px;
  font-size: 12px; font-weight: 600;
  border-radius: var(--radius); cursor: pointer; transition: var(--transition);
  text-decoration: none; font-family: inherit; outline: none; border: 1px solid transparent;
  letter-spacing: 0.2px; width: auto !important; white-space: nowrap; gap: 5px;
}
.btn-primary { background: var(--primary); color: #ffffff; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg-hover); border-color: var(--text-muted); }
.btn-danger { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-sm { padding: 0 10px; height: 28px; font-size: 11px; border-radius: 4px; }

/* =================== TABEL =================== */
.table-wrapper {
  overflow-x: auto; background: var(--bg-card);
  border-radius: var(--radius); border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; padding: 10px 12px; font-weight: 600; font-size: 11px;
  color: var(--text-muted); background-color: var(--bg-hover);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background-color: var(--bg-hover); }

/* =================== LAYOUT DASHBOARD & SIDEBAR =================== */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0; display: flex; flex-direction: column;
  z-index: 1000; transition: transform 0.3s ease;
}
.sidebar-header {
  height: 60px; padding: 0 20px; display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--text-main);
  border-bottom: 1px solid var(--border);
}
.sidebar-menu { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar-menu > a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 2px;
  color: var(--text-muted); text-decoration: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; transition: var(--transition);
}
.sidebar-menu > a:hover { background-color: var(--bg-hover); color: var(--text-main); }
.sidebar-menu > a.active { background-color: var(--primary-light); color: var(--primary); font-weight: 600; }

/* Dropdown Sidebar */
.menu-dropdown-wrapper { margin-bottom: 2px; }
.menu-dropdown-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 12px;
  border-radius: var(--radius); color: var(--text-muted); font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-align: left; background: transparent; border: none;
}
.menu-dropdown-btn:hover { background-color: var(--bg-hover); color: var(--text-main); }
.menu-dropdown-btn.open { color: var(--primary); font-weight: 600; background: var(--primary-light); }
.menu-dropdown-btn .left-content { display: flex; align-items: center; gap: 10px; }
.menu-dropdown-btn .arrow { font-size: 9px; transition: transform 0.2s ease; }
.menu-dropdown-btn.open .arrow { transform: rotate(180deg); }
.menu-dropdown-content { display: none; margin-top: 2px; padding-left: 10px; border-left: 2px solid var(--primary-light); margin-left: 16px; }
.menu-dropdown-content.show { display: block; }
.menu-dropdown-content a { display: block; padding: 6px 10px; margin-bottom: 2px; color: var(--text-muted); text-decoration: none; font-size: 12px; font-weight: 500; border-radius: 4px; transition: var(--transition); }
.menu-dropdown-content a:hover { background-color: var(--bg-hover); color: var(--text-main); }
.menu-dropdown-content a.active { color: var(--primary); background-color: var(--primary-light); font-weight: 600; }

/* =================== MAIN CONTENT & TOPBAR =================== */
.main-content { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }

/* ⚡ GARIS TEPI BODY HALAMAN ⚡ */
.content-area { 
  padding: 20px; 
  max-width: 1100px; 
  margin: 20px auto; /* Memberi jarak atas/bawah agar border terlihat */
  width: calc(100% - 40px); /* Lebar responsif */
  
  /* Garis tepi tipis dan jelas */
  border: 1px solid var(--border); 
  border-radius: var(--radius);
  background-color: var(--bg-body); /* Sedikit berbeda dari card agar kontras */
  box-shadow: 0 0 10px rgba(0,0,0,0.02); /* Bayangan sangat halus */
}

.topbar {
  background-color: var(--bg-card); height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px; position: sticky; top: 0; z-index: 10;
  transition: background-color 0.3s ease;
}
.user-info { font-size: 13px; font-weight: 600; color: var(--text-main); display: flex; align-items: center; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* =================== MODAL =================== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 99999; opacity: 0; visibility: hidden; transition: all 0.2s ease; }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-box { background: var(--bg-card); padding: 20px; border-radius: 10px; width: 90%; max-width: 380px; text-align: center; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1); transform: translateY(20px) scale(0.95); transition: all 0.2s ease; }
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-box h3 { margin-bottom: 10px; font-size: 16px; font-weight: 700; color: var(--text-main); }
.modal-box p { margin-bottom: 20px; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions button { flex: 1; padding: 8px; font-size: 12px; font-weight: 600; }

/* =================== NOTIFIKASI LONCENG =================== */
.notif-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.notif-wrapper:hover {
  background-color: var(--bg-hover);
}

.notif-icon {
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: #ff3b30; /* Merah terang */
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  display: none; /* Disembunyikan default */
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card); /* Efek memotong background */
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  z-index: 10;
}

.notif-badge.show {
  display: flex;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%) !important; }
  .sidebar.open { transform: translateX(0) !important; }
  .main-content { margin-left: 0 !important; }
  .topbar { height: 56px; padding: 0 12px; justify-content: space-between; }
  .menu-toggle { display: flex; align-items: center; justify-content: center; margin-right: auto; padding: 6px; background: transparent; border: none; font-size: 20px; color: var(--text-main); }
  .user-info { display: none !important; }
  .topbar-right { display: flex; align-items: center; gap: 6px; }
  
  /* Di HP, border pada content area dihilangkan agar layar penuh */
  .content-area { 
    padding: 12px; 
    margin: 0; 
    width: 100%; 
    border: none; 
    border-radius: 0; 
    box-shadow: none; 
  }

  form .btn, .modal-actions .btn { width: 100% !important; margin-top: 8px; height: 38px; }
  .card { padding: 14px; }
  input, select, textarea { font-size: 16px !important; height: 38px; padding: 8px 12px; }
  
  /* Tabel jadi Card */
  .table-wrapper { overflow-x: visible; border: none; background: transparent; border-radius: 0; }
  .table-wrapper table, .table-wrapper thead, .table-wrapper tbody, .table-wrapper th, .table-wrapper td, .table-wrapper tr { display: block; width: 100%; }
  .table-wrapper thead tr { position: absolute; top: -9999px; left: -9999px; }
  .table-wrapper tr { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; padding: 12px; box-shadow: var(--shadow); }
  .table-wrapper td { border: none; border-bottom: 1px solid var(--border); padding: 8px 0; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
  .table-wrapper td:last-child { border-bottom: none; }
  .table-wrapper td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: 10px; text-transform: uppercase; margin-bottom: 2px; letter-spacing: 0.5px; }
  .table-wrapper td.action-td { display: block; padding-top: 10px; border-bottom: none; }
  .table-wrapper td.action-td::before { display: none; }
  .table-wrapper td.action-td .action-cell, .table-wrapper td.action-td .action-btns { display: flex; flex-direction: row; gap: 6px; width: 100%; }
  .table-wrapper td.action-td .btn { flex: 1; width: 100% !important; padding: 8px; font-size: 12px; }
}
/* =========================================
   STYLE UNTUK SHOW/HIDE PASSWORD
   ========================================= */
.input-password-wrapper {
  position: relative;
  width: 100%;
}
.input-password-wrapper input {
  padding-right: 40px !important;
}
.toggle-password {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s;
}
.toggle-password:hover { color: var(--primary); }
.toggle-password svg { width: 18px; height: 18px; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: #ff3b30;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  z-index: 10;
}
.notif-badge.show { display: flex; }