/* ===================================================================
   SKMJ MOTOR — Stylesheet
   Struktur: Design tokens -> Reset -> Layout -> Components -> Pages
   =================================================================== */

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

/* ---------- 1. Design Tokens (edit warna di sini) ---------- */
:root {
  --background: 220 20% 10%;
  --foreground: 30 10% 92%;

  --card: 220 18% 14%;
  --card-foreground: 30 10% 92%;

  --primary: 25 95% 53%;
  --primary-foreground: 0 0% 100%;

  --secondary: 220 15% 20%;
  --secondary-foreground: 30 10% 92%;

  --muted: 220 15% 18%;
  --muted-foreground: 220 10% 65%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  --border: 220 15% 22%;
  --input: 220 15% 22%;
  --ring: 25 95% 53%;

  --radius: 0.75rem;

  --success: 142 76% 36%;
  --success-foreground: 0 0% 100%;
  --warning: 38 92% 50%;
  --warning-foreground: 0 0% 100%;
}

/* ---------- 2. Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

main { flex: 1; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---------- 3. Icons ---------- */
.icon-svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- 3b. Utilities ---------- */
.text-gradient {
  background: linear-gradient(to right, hsl(var(--primary)), #fb923c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.glass-card {
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: var(--radius);
}

.muted { color: hsl(var(--muted-foreground)); }

.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  line-height: 1;
  font-weight: 600;
  font-size: .875rem;
  border-radius: calc(var(--radius) - 0.25rem);
  padding: .6rem 1.25rem;
  border: 1px solid transparent;
  transition: background-color .15s, color .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.btn-primary:hover:not(:disabled) { background: hsl(var(--primary) / 0.9); }

.btn-outline {
  background: transparent;
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}
.btn-outline:hover:not(:disabled) {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
}
.btn-ghost:hover:not(:disabled) { background: hsl(var(--secondary)); }

.btn-success-outline {
  background: transparent;
  border-color: hsl(var(--success));
  color: hsl(var(--success));
}
.btn-success-outline:hover:not(:disabled) {
  background: hsl(var(--success));
  color: hsl(var(--success-foreground));
}

.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem; }

/* ---------- 5. Forms ---------- */
.field { margin-bottom: 1.25rem; }
.field label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .4rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: hsl(var(--input) / 0.4);
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
  border-radius: calc(var(--radius) - 0.25rem);
  padding: .6rem .75rem;
  font-size: .9rem;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
}
.field textarea { resize: vertical; }

/* ---------- 6. Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .6rem;
  border-radius: 999px;
}
.badge-warning { background: hsl(var(--warning)); color: hsl(var(--warning-foreground)); }
.badge-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.badge-success { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }

/* ---------- 7. Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(var(--card) / 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.navbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand { display: flex; align-items: center; gap: .5rem; }
.navbar-brand img { height: 40px; width: 40px; object-fit: contain; }
.navbar-brand span { font-weight: 800; font-size: 1.25rem; }

.navbar-links { display: flex; align-items: center; gap: .25rem; }
.navbar-links a {
  padding: .5rem 1rem;
  border-radius: calc(var(--radius) - 0.25rem);
  font-size: .875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.navbar-links a:hover { background: hsl(var(--secondary)); color: hsl(var(--foreground)); }
.navbar-links a.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }

.navbar-auth { display: flex; align-items: center; gap: .75rem; margin-left: .75rem; }
.navbar-admin-tag {
  display: flex; align-items: center; gap: .25rem;
  font-size: .75rem; font-weight: 600; color: hsl(var(--primary));
}

.navbar-toggle {
  display: none;
  background: none; border: none; color: hsl(var(--foreground));
  padding: .5rem;
}

.navbar-mobile { display: none; border-top: 1px solid hsl(var(--border)); padding: 1rem; }
.navbar-mobile a {
  display: block;
  padding: .75rem 1rem;
  border-radius: calc(var(--radius) - 0.25rem);
  font-size: .875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}
.navbar-mobile a.active { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }

@media (max-width: 768px) {
  .navbar-links, .navbar-auth { display: none; }
  .navbar-toggle { display: block; }
  .navbar-mobile.open { display: block; }
}

/* ---------- 8. Footer ---------- */
.footer {
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.5);
  margin-top: auto;
  padding: 2rem 0;
}
.footer h4 { color: hsl(var(--foreground)); font-weight: 600; margin-bottom: .5rem; }
.footer-brand { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; font-weight: 700; font-size: 1.125rem; color: hsl(var(--foreground)); }
.footer-bottom {
  border-top: 1px solid hsl(var(--border));
  margin-top: 1.5rem;
  padding-top: 1rem;
  text-align: center;
  font-size: .75rem;
  color: hsl(var(--muted-foreground));
}
.footer p, .footer div { font-size: .875rem; color: hsl(var(--muted-foreground)); margin-bottom: .25rem; }

/* ---------- 9. Hero (Beranda) ---------- */
.hero {
  position: relative;
  height: 70vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
.hero img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to right, hsl(var(--background)), hsl(var(--background) / 0.8), transparent);
}
.hero-content { position: relative; z-index: 10; }
.hero h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.15; max-width: 40rem; }
.hero p { margin-top: 1rem; font-size: 1.125rem; color: hsl(var(--muted-foreground)); max-width: 32rem; }
.hero-actions { margin-top: 2rem; display: flex; gap: 1rem; flex-wrap: wrap; }

@media (min-width: 768px) {
  .hero h1 { font-size: 3.75rem; }
}

/* ---------- 10. Section blocks ---------- */
.section { padding: 5rem 0; }
.section-alt { background: hsl(var(--secondary) / 0.3); }
.section h2 { font-size: 1.875rem; font-weight: 700; text-align: center; margin-bottom: 3rem; }

.card-feature {
  padding: 1.5rem;
  transition: border-color .15s, transform .15s;
}
.card-feature:hover { border-color: hsl(var(--primary) / 0.5); }
.card-feature.linkable:hover { transform: translateY(-4px); }
.card-feature .icon { color: hsl(var(--primary)); margin-bottom: 1rem; }
.card-feature h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: .5rem; }
.card-feature p { font-size: .875rem; color: hsl(var(--muted-foreground)); }

/* ---------- 11. Generic page wrap ---------- */
.page { padding: 3rem 0; min-height: 60vh; }
.page-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 2rem; }
.page-header h1 { font-size: 1.875rem; font-weight: 700; }
.page-header .icon { color: hsl(var(--primary)); width: 2rem; height: 2rem; }

.narrow { max-width: 42rem; margin: 0 auto; }

.center-box {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.center-box .glass-card { padding: 2rem; text-align: center; }
.center-box .glass-card p { margin-bottom: 1rem; color: hsl(var(--muted-foreground)); }

/* ---------- 12. Antrean / list cards ---------- */
.filter-bar { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; align-items: center; }
.filter-bar .btn-ghost { margin-left: auto; }

.queue-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}
@media (min-width: 768px) {
  .queue-card { flex-direction: row; align-items: center; }
}
.queue-card .info { flex: 1; }
.queue-card .info .title-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .25rem; }
.queue-card .info .title-row strong { font-size: 1.125rem; }
.queue-card .info small { display: block; font-size: .75rem; color: hsl(var(--muted-foreground)); }
.queue-card .actions { display: flex; gap: .5rem; }

/* ---------- 13. Invoice page ---------- */
.invoice-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .invoice-grid { grid-template-columns: 1fr 2fr; } }

.invoice-list-item {
  display: block; width: 100%; text-align: left;
  padding: 1rem; margin-bottom: .75rem;
  transition: border-color .15s;
}
.invoice-list-item:hover { border-color: hsl(var(--primary) / 0.5); }
.invoice-list-item.selected { border-color: hsl(var(--primary)); box-shadow: 0 0 0 1px hsl(var(--primary)); }
.invoice-list-item .row { display: flex; justify-content: space-between; margin-bottom: .25rem; }
.invoice-list-item .id { font-weight: 700; font-size: .875rem; }
.invoice-list-item .customer { font-size: .875rem; color: hsl(var(--muted-foreground)); }
.invoice-list-item .total { font-size: .875rem; font-weight: 600; color: hsl(var(--primary)); margin-top: .25rem; }

.invoice-detail { padding: 1.5rem; }
.invoice-detail-header { display: flex; justify-content: space-between; margin-bottom: 1.5rem; }
.invoice-detail-header h2 { font-size: 1.5rem; font-weight: 800; }
.invoice-detail-header .meta { font-size: .75rem; color: hsl(var(--muted-foreground)); }
.invoice-detail-header .right { text-align: right; }

.invoice-meta { border-top: 1px solid hsl(var(--border)); padding-top: 1rem; margin-bottom: 1rem; font-size: .875rem; }
.invoice-meta p { margin-bottom: .25rem; }

table.invoice-table { width: 100%; font-size: .875rem; border-collapse: collapse; }
table.invoice-table th { text-align: left; padding: .5rem 0; border-bottom: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); font-weight: 500; }
table.invoice-table td { padding: .5rem 0; border-bottom: 1px solid hsl(var(--border) / 0.5); }
table.invoice-table th:nth-child(2), table.invoice-table td:nth-child(2) { text-align: center; }
table.invoice-table th:nth-child(3), table.invoice-table td:nth-child(3),
table.invoice-table th:nth-child(4), table.invoice-table td:nth-child(4) { text-align: right; }

.invoice-total-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border));
}
.invoice-total-row .label { font-size: 1.125rem; font-weight: 700; }
.invoice-total-row .value { font-size: 1.5rem; font-weight: 800; color: hsl(var(--primary)); }

.edit-item-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.edit-item-row input:nth-child(2) { width: 4.5rem; flex: none; }
.edit-item-row input:nth-child(3) { width: 7rem; flex: none; }

.empty-state { text-align: center; padding: 3rem 0; color: hsl(var(--muted-foreground)); }

/* ---------- 14. 404 ---------- */
.page-404 {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: hsl(var(--muted));
  text-align: center;
}
.page-404 h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: 1rem; }
.page-404 p { font-size: 1.25rem; color: hsl(var(--muted-foreground)); margin-bottom: 1rem; }
.page-404 a { color: hsl(var(--primary)); text-decoration: underline; }

/* ---------- 15. Toast (notifikasi) ---------- */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 999;
}
.toast {
  min-width: 260px; max-width: 360px;
  padding: .85rem 1rem;
  border-radius: calc(var(--radius) - 0.25rem);
  font-size: .875rem; font-weight: 500;
  box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.3);
  animation: toast-in .2s ease-out;
}
.toast-success { background: hsl(var(--success)); color: hsl(var(--success-foreground)); }
.toast-error { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 16. Print (invoice) ---------- */
@media print {
  .navbar, .footer, .invoice-list-item, .invoice-grid > *:first-child, .no-print { display: none !important; }
  .invoice-grid { grid-template-columns: 1fr; }
  body { background: white; color: black; }
}
