/* ============================================================
   DESIGN SYSTEM: Papan Antrean Servis (Red Accent Dark Mode)
   ============================================================ */

:root {
  --font: 'Inter', -apple-system, sans-serif;
  
  /* Color Palette - Premium Dark */
  --bg: #0f1115;               /* Very dark background */
  --bg-secondary: #1a1d24;     /* Card background */
  --border: #2d333b;           /* Card borders */
  --text: #f8fafc;             /* Bright white */
  --text-secondary: #94a3b8;   /* Muted text */
  
  /* Accents */
  --danger: #ef4444;           /* Primary Red Accent */
  --danger-hover: #dc2626;
  --primary: #3b82f6;          /* Secondary Blue for info */
  --success: #10b981;          /* Green for finished */
  --warning: #eab308;          /* Yellow for fallback */
  
  --surface-hover: #262b36;
  
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── App Layout & Header ─── */
.app-layout { display: flex; flex-direction: column; min-height: 100vh; }

.app-header {
  background: #15181d;
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
}
.header-main {
  display: flex; justify-content: space-between; align-items: center; max-width: 1600px; margin: 0 auto; width: 100%;
}
.logo { display: flex; align-items: center; gap: 16px; }
.logo i { font-size: 2rem; }
.logo-title { font-size: 1.25rem; font-weight: 800; color: var(--text); letter-spacing: 0.5px; }
.logo-subtitle { font-size: 0.7rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.header-actions { display: flex; gap: 12px; align-items: center; }

/* ─── Sub-Header ─── */
.sub-header {
  background: var(--bg);
  padding: 16px 32px;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1600px; margin: 0 auto; width: 100%;
}
.board-nav {
  display: flex; gap: 4px; background: var(--bg-secondary); padding: 4px; border-radius: 30px; border: 1px solid var(--border);
}
.board-tab-btn {
  background: transparent; border: none; color: var(--text-secondary); padding: 8px 24px; border-radius: 20px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.board-tab-btn.active {
  background: var(--danger); color: white;
}

.board-actions { display: flex; gap: 12px; align-items: center; }
.admin-tools-group { display: flex; gap: 8px; }

/* ─── Main Content & Grid ─── */
.main-content {
  flex: 1; padding: 0 32px 40px; max-width: 1600px; width: 100%; margin: 0 auto;
}
.board-view { display: none; }
.board-view.active { display: block; animation: fadeIn 0.3s ease; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

/* ─── Queue Card ─── */
.queue-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  display: flex; flex-direction: column; gap: 16px;
  border-left: 4px solid var(--danger);
  transition: transform 0.2s, box-shadow 0.2s;
}
.queue-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.card-kode { font-family: 'Courier New', monospace; font-size: 0.85rem; font-weight: 800; color: var(--danger); background: rgba(239,68,68,0.1); padding: 4px 8px; border-radius: 4px; }
.card-status { font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); }

/* The prominent red badge */
.queue-number-badge {
  position: absolute;
  top: -12px; left: -12px;
  background: var(--danger);
  color: white;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
  box-shadow: 0 4px 10px rgba(239,68,68,0.5);
  border: 3px solid var(--bg);
}

.card-client h3 { font-size: 1.25rem; font-weight: 800; text-transform: uppercase; margin-bottom: 2px; }
.card-client p { font-size: 0.85rem; color: var(--text-secondary); }

.card-details {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 0.85rem; margin-top: 4px;
}
.detail-label { color: var(--text-secondary); font-size: 0.75rem; text-transform: uppercase; margin-bottom: 2px; }
.detail-value { font-weight: 600; color: var(--text); }

.card-costs {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 12px; font-size: 0.85rem;
}
.cost-row { display: flex; justify-content: space-between; }
.cost-row strong { color: var(--success); }

.card-footer { margin-top: 8px; }
.btn-edit-card {
  width: 100%; background: var(--danger); color: white; border: none; padding: 10px;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: background 0.2s;
}
.btn-edit-card:hover { background: var(--danger-hover); }

/* ─── Forms & Inputs ─── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.col-2 { grid-column: span 2; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } .form-group.col-2 { grid-column: span 1; } }

label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
input, textarea, select {
  font-family: var(--font); background: var(--bg); border: 1px solid var(--border);
  color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm);
  outline: none; font-size: 0.95rem; transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--danger); }
textarea { min-height: 80px; resize: vertical; }

.search-box {
  display: flex; align-items: center; gap: 10px; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 20px; padding: 0 16px; min-width: 260px;
}
.search-box input { background: transparent; border: none; padding: 8px 0; width: 100%; font-size: 0.85rem; }

/* ─── Buttons ─── */
.btn {
  font-family: var(--font); font-weight: 600; padding: 8px 16px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 8px; transition: all 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ─── Modals ─── */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.modal-content {
  position: relative; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 100%; max-width: 700px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow); animation: slideUp 0.2s ease-out;
}
.modal-sm { max-width: 400px; }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 12px; }

/* Wizard Sub-nav */
.modal-subnav {
  display: flex; background: var(--bg); border-bottom: 1px solid var(--border); padding: 0 24px;
}
.wizard-tab {
  background: transparent; border: none; color: var(--text-secondary); padding: 14px 20px;
  font-weight: 600; font-size: 0.9rem; cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.wizard-tab.active { color: var(--text); border-bottom-color: var(--danger); }
.wizard-section { display: none; }
.wizard-section.active { display: block; animation: fadeIn 0.3s ease; }

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center;
  cursor: pointer; position: relative; color: var(--text-secondary); transition: all 0.2s;
}
.upload-area:hover { border-color: var(--danger); background: var(--surface-hover); }
.upload-area input { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-preview { margin-top: 10px; height: 120px; border-radius: var(--radius-sm); background-size: contain; background-repeat: no-repeat; background-position: center; border: 1px solid var(--border); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th, .table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th { font-weight: 700; color: var(--text-secondary); text-transform: uppercase; font-size: 0.75rem; }

/* Utils */
.text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* Toast */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }

/* Print Setup for 10x15cm Thermal Label - Force Single Page */
@media print {
  @page {
    size: 100mm 150mm;
    margin: 0;
  }
  html, body {
    width: 100mm;
    height: 150mm;
    background: #fff;
    color: #000;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }
  body * { visibility: hidden; }
  
  /* Reset modal flex centering just for print */
  .modal, .modal-content, .modal-body {
    position: static !important;
    display: block !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  #nota-print-area, #nota-print-area * { visibility: visible; }
  #nota-print-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 6mm !important;
    box-sizing: border-box !important;
    font-size: 12px !important;
    page-break-inside: avoid;
    overflow: hidden;
  }
}
