/* ============================================================
   SMART CANTEEN — Design Tokens
   Palet terinspirasi dari nampan kantin & struk pesanan:
   hijau tua (segar & terpercaya) + amber (selera makan)
   ============================================================ */
:root {
  --color-primary:       #1B4B43;
  --color-primary-dark:  #123832;
  --color-primary-light: #2E6B5E;
  --color-accent:        #E8871E;
  --color-accent-light:  #FDECD8;
  --color-bg:            #F6F8F6;
  --color-surface:       #FFFFFF;
  --color-text:          #1A1F1D;
  --color-text-muted:    #6B7280;
  --color-success:       #2F9E44;
  --color-danger:        #D64545;
  --color-warning:       #E8871E;
  --color-border:        #E4E8E5;

  --font-display: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-soft: 0 4px 16px rgba(27, 75, 67, 0.07);
  --shadow-card: 0 2px 8px rgba(27, 75, 67, 0.06);
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .font-display {
  font-family: var(--font-display);
  color: var(--color-primary-dark);
  font-weight: 600;
}

.text-mono { font-family: var(--font-mono); letter-spacing: 0.02em; }
.text-muted-c { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent) !important; }

a { color: var(--color-primary); }

/* ---------- Layout shell ---------- */
.app-shell { min-height: 100vh; display: flex; }

.app-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-primary-dark);
  color: #fff;
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 1.5rem 1.1rem;
}
.app-sidebar .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  margin-bottom: 2rem;
  padding: 0 0.4rem;
}
.app-sidebar .brand .brand-icon {
  width: 38px; height: 38px;
  background: var(--color-accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
}
.app-sidebar .nav-link {
  color: rgba(255,255,255,0.75);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.app-sidebar .nav-link.active {
  background: var(--color-accent);
  color: #fff;
}
.app-sidebar .nav-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin: 1.1rem 0.9rem 0.4rem;
}

.app-main { flex: 1; min-width: 0; }
.app-topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-content { padding: 1.5rem; }

/* Mobile offcanvas sidebar toggle */
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; left: -280px; z-index: 1050; transition: left 0.25s ease; box-shadow: var(--shadow-soft); }
  .app-sidebar.show { left: 0; }
  .sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1040; }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.stat-card {
  border-radius: var(--radius-md);
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}
.stat-card .stat-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 0.75rem;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--color-primary-dark); }
.stat-card .stat-label { font-size: 0.82rem; color: var(--color-text-muted); }

/* ---------- Buttons ---------- */
.btn-canteen {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-canteen:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; }
.btn-accent {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: #cc7315; border-color: #cc7315; color: #fff; }
.btn-outline-canteen { border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline-canteen:hover { background: var(--color-primary); color: #fff; }

/* ---------- Menu item card (siswa) ---------- */
.menu-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  height: 100%;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.menu-card .menu-thumb {
  height: 140px;
  background: var(--color-accent-light);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.menu-card .menu-thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-card .menu-thumb .placeholder-icon { font-size: 2.2rem; color: var(--color-accent); }
.menu-card .menu-body { padding: 0.9rem; }
.menu-card .menu-price { font-family: var(--font-display); font-weight: 700; color: var(--color-primary); }
.menu-card .stock-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  background: var(--color-bg);
  color: var(--color-text-muted);
}
.menu-card .stock-pill.low { background: #FDECEC; color: var(--color-danger); }
.menu-card .qty-control { display: flex; align-items: center; gap: 0.4rem; }
.menu-card .qty-control button {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--color-border);
  background: #fff; font-weight: 700; color: var(--color-primary);
}
.menu-card .qty-control input {
  width: 40px; text-align: center; border: none; font-weight: 600;
}

/* ---------- Saldo card (kiosk-style, receipt look) ---------- */
.saldo-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.saldo-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 140px; height: 140px;
  background: rgba(232,135,30,0.18);
  border-radius: 50%;
}
.saldo-card .saldo-label { font-size: 0.8rem; opacity: 0.75; }
.saldo-card .saldo-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; }

/* ---------- Receipt-style order card (signature element) ---------- */
.receipt-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  position: relative;
  border: 1px solid var(--color-border);
  overflow: hidden;
}
.receipt-card .receipt-notch {
  position: absolute;
  bottom: -9px;
  left: 0; right: 0;
  height: 18px;
  background: radial-gradient(circle 9px, transparent 9px, var(--color-bg) 10px) repeat-x;
  background-size: 22px 18px;
  background-position: -5px 0;
}
.receipt-card .receipt-header {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px dashed var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
}
.receipt-card .receipt-body { padding: 0.9rem 1.1rem; }
.receipt-card .receipt-code { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-text-muted); }

/* ---------- Scan box ---------- */
.scan-box {
  border: 2px dashed var(--color-primary-light);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 2rem;
  text-align: center;
}
.scan-box input {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-align: center;
}
.scan-pulse {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--color-accent-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  color: var(--color-accent);
  font-size: 1.6rem;
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,135,30,0.25); }
  50% { box-shadow: 0 0 0 12px rgba(232,135,30,0); }
}

/* ---------- Cart ---------- */
.cart-panel {
  position: sticky;
  top: 84px;
}
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }

/* ---------- Table refinements ---------- */
.table-canteen thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
}
.table-canteen td { vertical-align: middle; }

/* Realtime pulse dot */
.live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-success);
  display: inline-block;
  animation: pulse-dot 1.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Login screens */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #1F5B51 0%, var(--color-primary-dark) 60%);
  padding: 1.5rem;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scan-pulse, .live-dot { animation: none; }
}

@media (max-width: 575.98px) {
  .app-content { padding: 1rem; }
  .saldo-card .saldo-value { font-size: 1.5rem; }
}
