/*
 * Admin Dashboard — Stylesheet
 * © 2026 lautandigital.id — All rights reserved
 * https://lautandigital.id
 */

/* ============================
   1. CSS CUSTOM PROPERTIES
   ============================ */
:root {
  --sidebar-w: 260px;

  /* Colors — Light */
  --bg-base:       #f1f5f9;
  --bg-surface:    #ffffff;
  --bg-hover:      #f8fafc;
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active:#6366f1;

  --text-primary:   #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --border-color:   #e2e8f0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);

  --accent:         #6366f1;
  --accent-light:   #eef2ff;
  --accent-hover:   #4f46e5;
  --green:          #10b981;
  --green-light:    #d1fae5;
  --orange:         #f59e0b;
  --orange-light:   #fef3c7;
  --red:            #ef4444;
  --red-light:      #fee2e2;
  --purple:         #8b5cf6;
  --purple-light:   #ede9fe;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --transition: 0.2s ease;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-base:       #0f172a;
  --bg-surface:    #1e293b;
  --bg-hover:      #273449;
  --sidebar-bg:    #020617;
  --sidebar-hover: #0f172a;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --border-color:   #1e293b;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.3);
  --shadow-md:      0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.5);

  --accent-light:  #1e1b4b;
  --green-light:   #064e3b;
  --orange-light:  #451a03;
  --red-light:     #450a0a;
  --purple-light:  #2e1065;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }
svg { display: block; flex-shrink: 0; }
canvas { display: block; }

/* ============================
   3. SIDEBAR
   ============================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  color: #fff;
  letter-spacing: .5px;
  flex-shrink: 0;
}

.logo-text {
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}

.sidebar-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--sidebar-text);
  border-radius: 2px;
  transition: var(--transition);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(148,163,184,.4);
  padding: 12px 20px 6px;
  white-space: nowrap;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  position: relative;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link span:not(.badge) { flex: 1; }

.nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link.active {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: rgba(255,255,255,.12);
  color: var(--sidebar-text);
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
}

.badge--danger {
  background: var(--red);
  color: #fff;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-info { flex: 1; min-width: 0; }

.user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: var(--sidebar-text);
  font-size: 11px;
}

.user-logout {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  transition: background var(--transition), color var(--transition);
}

.user-logout svg { width: 15px; height: 15px; }

.user-logout:hover {
  background: rgba(239,68,68,.15);
  color: var(--red);
}

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

/* ============================
   5. TOPBAR
   ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 62px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  transition: background var(--transition);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.menu-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.menu-btn svg { width: 20px; height: 20px; }
.menu-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 14px;
  max-width: 360px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}

.search-box svg {
  width: 16px; height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
}

.search-box input::placeholder { color: var(--text-muted); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.topbar-btn svg { width: 18px; height: 18px; }
.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.topbar-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  cursor: pointer;
  margin-left: 4px;
}

/* ============================
   6. CONTENT & PAGES
   ============================ */
.content {
  flex: 1;
  padding: 28px 28px 20px;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================
   7. BUTTONS
   ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(99,102,241,.35);
  transform: translateY(-1px);
}

/* ============================
   8. CARDS
   ============================ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), border-color var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
  gap: 12px;
}

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition);
}

.card-link:hover { color: var(--accent-hover); }

/* ============================
   9. STATS GRID
   ============================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: box-shadow var(--transition), transform var(--transition), background var(--transition);
}

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

.stat-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-card[data-color="blue"]   .stat-icon { background: var(--accent-light);  color: var(--accent); }
.stat-card[data-color="green"]  .stat-icon { background: var(--green-light);   color: var(--green); }
.stat-card[data-color="orange"] .stat-icon { background: var(--orange-light);  color: var(--orange); }
.stat-card[data-color="purple"] .stat-icon { background: var(--purple-light);  color: var(--purple); }

.stat-body { flex: 1; min-width: 0; }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -.5px;
}

.stat-change {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
}

.stat-change svg { width: 13px; height: 13px; }
.stat-change.positive { color: var(--green); }
.stat-change.negative { color: var(--red); }

/* ============================
   10. CHARTS ROW
   ============================ */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 18px;
  margin-bottom: 24px;
}

.chart-card { }

.chart-legend {
  display: flex;
  gap: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.chart-container {
  padding: 16px 20px 20px;
  height: 260px;
  position: relative;
}

/* Activity List */
.activity-list {
  padding: 12px 20px 20px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  animation: slideIn .3s ease backwards;
}

.activity-item:last-child { border-bottom: none; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
}

.activity-text p {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.4;
}

.activity-text p strong { font-weight: 600; }

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================
   11. BOTTOM ROW
   ============================ */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 18px;
}

/* Table */
.table-card { overflow: hidden; }

.table-actions {
  display: flex;
  gap: 8px;
}

.select-sm {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-primary);
  background: var(--bg-base);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.select-sm:focus { border-color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  padding: 0 0 4px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 20px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.status-badge--paid     { background: var(--green-light);  color: var(--green); }
.status-badge--pending  { background: var(--orange-light); color: var(--orange); }
.status-badge--cancelled{ background: var(--red-light);    color: var(--red); }

/* Action button */
.action-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  transition: all var(--transition);
}

.action-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* Donut Chart */
.donut-card { overflow: hidden; }

.donut-container {
  padding: 16px 20px 8px;
  height: 200px;
  position: relative;
}

.donut-legend {
  padding: 0 20px 20px;
}

.donut-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-color);
}

.donut-legend li:last-child { border-bottom: none; }

.donut-swatch {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.donut-name {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
}

.donut-pct {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============================
   12. EMPTY STATE
   ============================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 32px;
  gap: 12px;
}

.empty-state svg {
  width: 52px; height: 52px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.empty-state p {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 280px;
}

/* ============================
   13. FOOTER
   ============================ */
.footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent);
  font-weight: 500;
}

.footer a:hover { text-decoration: underline; }

/* ============================
   14. OVERLAY
   ============================ */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.overlay.active { display: block; }

/* ============================
   15. SIDEBAR COLLAPSED
   ============================ */
body.sidebar-collapsed .sidebar {
  width: 66px;
}

body.sidebar-collapsed .sidebar .logo-text,
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .nav-link span:not(.badge),
body.sidebar-collapsed .sidebar .badge,
body.sidebar-collapsed .sidebar .user-info,
body.sidebar-collapsed .sidebar .user-name,
body.sidebar-collapsed .sidebar .user-role {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: 66px;
}

body.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 9px 0;
}

body.sidebar-collapsed .nav-link svg { margin: 0 auto; }

body.sidebar-collapsed .user-card {
  justify-content: center;
}

body.sidebar-collapsed .user-logout {
  margin: 0;
}

/* ============================
   16. RESPONSIVE
   ============================ */
@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row  { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-wrapper { margin-left: 0 !important; }
  .sidebar-toggle { display: flex; }
  .content { padding: 20px 16px; }
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-box { display: none; }
  .page-header { flex-direction: column; }
}

/* ============================
   17. SCROLLBAR
   ============================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================
   18. SELECTION
   ============================ */
::selection {
  background: rgba(99,102,241,.2);
  color: var(--text-primary);
}
