/* ============================================================
   TAICHANDU KASIR — Global Stylesheet (Revamped)
   Tema: Dark Minimal · Clean · Functional
   ============================================================ */

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

/* --- Reset & CSS Variables --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0a0a;
  --surface:    #141414;
  --surface-2:  #1c1c1c;
  --border:     #252525;
  --border-2:   #2e2e2e;
  --text:       #f0f0f0;
  --text-2:     #a0a0a0;
  --text-3:     #555;
  --accent:     #f5f5f5;
  --green:      #22c55e;
  --green-bg:   rgba(34,197,94,0.08);
  --red:        #ef4444;
  --red-bg:     rgba(239,68,68,0.08);
  --yellow:     #f59e0b;
  --yellow-bg:  rgba(245,158,11,0.08);
  --blue:       #60a5fa;
  --blue-bg:    rgba(96,165,250,0.08);
  --font:       'DM Sans', system-ui, sans-serif;
  --font-mono:  'DM Mono', monospace;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --sidebar-w:  224px;
  --topbar-h:   56px;
  --shadow:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
}

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--text); }

/* --- Typography --- */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

.text-muted  { color: var(--text-2); }
.text-small  { font-size: 0.8rem; }
.text-mono   { font-family: var(--font-mono); }
.text-center { text-align: center; }

/* ============================================================
   LAYOUT: APP SHELL
   ============================================================ */

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

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.2s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.sidebar-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-logo .logo-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin-bottom: 1px;
  transition: background 0.12s, color 0.12s;
}

.sidebar-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar-nav a.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.sidebar-nav .nav-icon {
  width: 16px;
  text-align: center;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 16px 16px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer .user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.sidebar-footer .logout-link {
  font-size: 0.78rem;
  color: var(--text-3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.sidebar-footer .logout-link:hover {
  color: var(--red);
  background: var(--red-bg);
}

/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.topbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.topbar-user {
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.page-content {
  padding: 20px 24px;
  flex: 1;
}

/* Page header utility */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

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

/* ============================================================
   HAMBURGER (Mobile)
   ============================================================ */

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 4px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}

.hamburger:hover { background: var(--surface); }

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
}

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

.sidebar-overlay.visible { display: block; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card-sm { padding: 14px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.card-value {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.card-sub {
  font-size: 0.78rem;
  color: var(--text-2);
  margin-top: 4px;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  min-height: 38px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity 0.12s, background 0.12s, border-color 0.12s, transform 0.05s;
  letter-spacing: 0.01em;
  line-height: 1;
}

.btn:hover  { opacity: 0.9; }
.btn:active { transform: translateY(1px); opacity: 0.75; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-secondary{ background: var(--surface-2); color: var(--text-2); border-color: var(--border-2); }
.btn-secondary:hover { color: var(--text); border-color: var(--text-3); }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border-2); }
.btn-outline:hover { border-color: var(--text-3); background: var(--surface-2); }
.btn-danger   { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success  { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--green); color: #000; }

.btn-sm   { min-height: 30px; padding: 0 10px; font-size: 0.78rem; }
.btn-lg   { min-height: 46px; padding: 0 24px; font-size: 0.95rem; }
.btn-full { width: 100%; }

/* Action button group — keeps Edit/Hapus side-by-side */
.btn-group {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 14px; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

.form-control {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 9px 12px;
  min-height: 38px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--text-3);
  box-shadow: 0 0 0 3px rgba(240,240,240,0.06);
}

.form-control::placeholder { color: var(--text-3); }
.form-control:disabled { opacity: 0.4; cursor: not-allowed; }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 90px; resize: vertical; padding-top: 10px; }

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 130px; }

/* ============================================================
   TABLES
   ============================================================ */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

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

thead tr {
  background: var(--surface-2);
}

th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-open,
.badge-lunas,
.badge-diantar   { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.15); }
.badge-closed,
.badge-belum     { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }
.badge-belum-lunas { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.15); }
.badge-setoran   { background: var(--blue-bg); color: var(--blue); border-color: rgba(96,165,250,0.15); }
.badge-warning   { background: var(--yellow-bg); color: var(--yellow); border-color: rgba(245,158,11,0.15); }

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.855rem;
  border: 1px solid transparent;
  line-height: 1.5;
}

.alert-success { background: var(--green-bg); border-color: rgba(34,197,94,0.2); color: var(--green); }
.alert-error   { background: var(--red-bg); border-color: rgba(239,68,68,0.2); color: var(--red); }
.alert-info    { background: var(--surface-2); border-color: var(--border-2); color: var(--text-2); }
.alert-warning { background: var(--yellow-bg); border-color: rgba(245,158,11,0.2); color: var(--yellow); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 360px;
}

.login-logo-wrap {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 10px;
}

.login-brand  { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.04em; }
.login-sub    { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}

.login-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ============================================================
   DIVIDER
   ============================================================ */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.empty-state p { font-size: 0.875rem; }

/* ============================================================
   POS SPECIFIC
   ============================================================ */

/* Form area */
.pos-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.pos-form-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

/* Cart items */
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.855rem;
}

.cart-item:last-child { border-bottom: none; }
.cart-item-name  { flex: 1; color: var(--text); }
.cart-item-qty   { color: var(--text-2); font-size: 0.8rem; min-width: 30px; text-align: center; }
.cart-item-price { color: var(--text-2); font-family: var(--font-mono); font-size: 0.8rem; min-width: 90px; text-align: right; }
.cart-item-remove {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: color 0.12s, background 0.12s;
}
.cart-item-remove:hover { color: var(--red); background: var(--red-bg); }

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 4px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.cart-total-amount {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

/* Locked banner */
.shift-locked-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--red);
  font-size: 0.84rem;
  margin-bottom: 16px;
}

/* Order cards */
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.order-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.order-card-ident {
  font-weight: 600;
  font-size: 0.875rem;
}

.order-card-time {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.order-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.order-detail-row:last-child { border-bottom: none; }

.odr-name { flex: 1; min-width: 120px; font-size: 0.875rem; }
.odr-rel  { font-size: 0.72rem; color: var(--text-3); margin-top: 1px; }
.odr-qty  { font-size: 0.78rem; color: var(--text-2); white-space: nowrap; }
.odr-price {
  font-size: 0.8rem;
  color: var(--text-2);
  font-family: var(--font-mono);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

.odr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 100%;
  margin-top: 6px;
}

/* Status toggle btn */
.btn-status {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.12s;
}

.btn-status:hover { color: var(--text); border-color: var(--text-3); }

.btn-bayar {
  background: var(--text);
  border: 1px solid var(--text);
  color: var(--bg);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font);
  transition: opacity 0.12s;
}

.btn-bayar:hover { opacity: 0.85; }
.btn-bayar:disabled { opacity: 0.3; cursor: not-allowed; }

/* No orders */
.no-orders {
  text-align: center;
  color: var(--text-3);
  padding: 40px 20px;
  font-size: 0.875rem;
}

/* ============================================================
   TOAST (global)
   ============================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.855rem;
  color: var(--text);
  box-shadow: var(--shadow-md);
  max-width: 300px;
  animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }

/* ============================================================
   SHIFT STATUS DISPLAY
   ============================================================ */

.shift-status-box {
  text-align: center;
  padding: 40px 20px;
}

.shift-status-label {
  font-size: 0.75rem;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.shift-status-text {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.shift-status-text.open  { color: var(--green); }
.shift-status-text.closed{ color: var(--text-3); }

/* ============================================================
   INLINE STATUS INFO ROW
   ============================================================ */

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-2);
  margin-bottom: 14px;
}

.info-row .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-green  { background: var(--green); }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-gray   { background: var(--text-3); }

/* ============================================================
   TEXTAREA REPORT (Laporan)
   ============================================================ */

.report-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  padding: 14px;
  resize: vertical;
  outline: none;
  min-height: 400px;
}

/* ============================================================
   UTILITY
   ============================================================ */

.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap     { display: flex; gap: 10px; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.gap-4        { gap: 4px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.mb-4         { margin-bottom: 4px; }
.mb-8         { margin-bottom: 8px; }
.mb-12        { margin-bottom: 12px; }
.mb-16        { margin-bottom: 16px; }
.mb-20        { margin-bottom: 20px; }
.mt-8         { margin-top: 8px; }
.mt-12        { margin-top: 12px; }
.mt-16        { margin-top: 16px; }
.w-full       { width: 100%; }

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */

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

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

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .topbar { padding: 0 14px; }

  .page-content { padding: 14px 14px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .card { padding: 14px; }

  .btn-full-mobile { width: 100%; }

  table { font-size: 0.8rem; }
  th, td { padding: 9px 10px; }

  .login-card { padding: 22px 18px; }

  .order-detail-row { flex-direction: column; gap: 6px; }
  .odr-price { text-align: left; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .card-value { font-size: 1.4rem; }
  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: unset; }
}
