/* =============================================
   DigiPog Admin Panel — CSS
   ============================================= */

:root {
  --bg: #0d0f14;
  --bg2: #13161f;
  --bg3: #1a1e2a;
  --border: #252a38;
  --text: #e8eaf0;
  --text-muted: #6b7280;
  --primary: #6c63ff;
  --primary-dark: #5750d9;
  --green: #22c55e;
  --blue: #3b82f6;
  --orange: #f97316;
  --red: #ef4444;
  --purple: #a855f7;
  --yellow: #eab308;
  --sidebar-w: 230px;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

html { font-size: 15px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 40%, #1a1040 0%, var(--bg) 70%);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 360px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 60px rgba(108,99,255,0.15);
  animation: fadeInUp 0.5s ease;
}

.login-logo {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 16px rgba(108,99,255,0.8));
}

.login-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }
.login-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

.input-group { margin-bottom: 1rem; }
.input-group input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.input-group input:focus { border-color: var(--primary); }

.login-error { color: var(--red); font-size: 0.85rem; margin-top: 0.75rem; min-height: 1.2em; }

/* ===== APP LAYOUT ===== */
.app {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.8rem;
  filter: drop-shadow(0 0 8px rgba(108,99,255,0.7));
}

.sidebar-title { font-size: 1rem; font-weight: 700; line-height: 1; }
.sidebar-subtitle { font-size: 0.7rem; color: var(--text-muted); }
.sidebar-title-wrap { display: flex; flex-direction: column; gap: 0.15rem; }

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(108,99,255,0.2), rgba(108,99,255,0.08));
  color: var(--primary);
  border: 1px solid rgba(108,99,255,0.25);
}

.nav-icon { font-size: 1.1rem; flex-shrink: 0; }
.nav-label { flex: 1; }

.badge {
  background: var(--red);
  color: #fff;
  border-radius: 99px;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.badge:empty { display: none; }

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

.btn-logout {
  width: 100%;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--red);
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TOPBAR ===== */
.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 1rem; }
.supplier-balance { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }
.sup-item b { color: var(--green); }

/* ===== PAGE CONTENT ===== */
.page-content { flex: 1; padding: 1.5rem; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

/* ===== CARDS ===== */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; }

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-body { padding: 1.25rem; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-card.accent-green { border-left: 3px solid var(--green); }
.stat-card.accent-blue  { border-left: 3px solid var(--blue); }
.stat-card.accent-purple{ border-left: 3px solid var(--purple); }
.stat-card.accent-orange{ border-left: 3px solid var(--orange); }
.stat-card.accent-red   { border-left: 3px solid var(--red); }

.stat-icon { font-size: 1.8rem; opacity: 0.9; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.stat-value { font-size: 1.2rem; font-weight: 700; }

/* ===== CHART ===== */
.chart-row { margin-bottom: 1rem; }
.chart-card .card-body { padding: 1rem; }

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

.table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ===== STATUS BADGES ===== */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-sukses { background: rgba(34,197,94,0.15); color: var(--green); }
.status-pending { background: rgba(234,179,8,0.15); color: var(--yellow); }
.status-gagal   { background: rgba(239,68,68,0.15); color: var(--red); }
.status-refunded{ background: rgba(59,130,246,0.15); color: var(--blue); }
.status-approved{ background: rgba(34,197,94,0.15); color: var(--green); }
.status-rejected{ background: rgba(239,68,68,0.15); color: var(--red); }
.status-banned  { background: rgba(239,68,68,0.15); color: var(--red); }
.status-active  { background: rgba(34,197,94,0.15); color: var(--green); }
.status-inactive{ background: rgba(107,114,128,0.15); color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.825rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary{ background: var(--bg3); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-success  { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.btn-success:hover { background: rgba(34,197,94,0.25); }
.btn-danger   { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.25); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.75rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* ===== INPUTS ===== */
.input-text, .input-textarea, .input-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.input-text:focus, .input-textarea:focus, .input-select:focus { border-color: var(--primary); }
.input-text { width: 100%; }
.input-textarea { width: 100%; resize: vertical; }
.input-search { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.75rem; color: var(--text); font-size: 0.825rem; font-family: inherit; outline: none; width: 200px; transition: border-color 0.2s; }
.input-search:focus { border-color: var(--primary); width: 260px; }
.input-date { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.75rem; color: var(--text); font-size: 0.825rem; font-family: inherit; outline: none; }
.input-select option { background: var(--bg2); }

/* ===== FORM GROUPS ===== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.4rem; }
.settings-form { max-width: 600px; }

/* ===== TOGGLE ===== */
.toggle-row { display: flex; align-items: center; gap: 0.75rem; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  left: 3px; top: 3px;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(108,99,255,0.2); border-color: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: var(--primary); }

/* ===== TWO-COL ===== */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 0.4rem; padding-top: 1rem; flex-wrap: wrap; align-items: center; }
.page-btn {
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-info { font-size: 0.8rem; color: var(--text-muted); margin-left: 0.5rem; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow), 0 0 40px rgba(108,99,255,0.1);
  animation: fadeInUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 0.95rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: 0.2rem; border-radius: 4px; transition: color 0.2s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0 1.25rem 1.25rem; display: flex; gap: 0.5rem; justify-content: flex-end; }

/* ===== SYNC PROGRESS ===== */
.sync-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(108,99,255,0.08);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 10px;
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 0.875rem;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(108,99,255,0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ===== BROADCAST ===== */
.broadcast-preview {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  white-space: pre-wrap;
  min-height: 40px;
  color: var(--text-muted);
}
.broadcast-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.825rem;
}
.broadcast-item:last-child { border-bottom: none; }
.broadcast-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; font-size: 0.875rem; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  bottom: 1.5rem; right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  animation: slideInRight 0.3s ease;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .input-search { width: 140px; }
  .input-search:focus { width: 180px; }
  .supplier-balance { display: none; }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
  .card-header { flex-direction: column; align-items: flex-start; }
}
