/* ==========================================================================
   BENGKELAPP - Modern Workshop Management Design System
   Aesthetic: Automotive Dark Navy / Slate with Vibrant Safety Orange & Emerald
   ========================================================================== */

:root {
  --bg-main: #0b1120;
  --bg-surface: #131d31;
  --bg-surface-elevated: #1e293b;
  --bg-surface-hover: #27354f;
  
  --border-subtle: #1e293b;
  --border-normal: #334155;
  --border-highlight: #475569;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --brand-orange: #f97316;
  --brand-orange-hover: #ea580c;
  --brand-orange-light: rgba(249, 115, 22, 0.15);

  --accent-blue: #3b82f6;
  --accent-blue-light: rgba(59, 130, 246, 0.15);

  --status-emerald: #10b981;
  --status-emerald-light: rgba(16, 185, 129, 0.15);
  --status-amber: #f59e0b;
  --status-amber-light: rgba(245, 158, 11, 0.15);
  --status-rose: #ef4444;
  --status-rose-light: rgba(239, 68, 68, 0.15);

  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px -1px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);

  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-normal);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-highlight);
}

/* App Layout */
#app-layout {
  display: flex;
  width: 100vw;
  min-height: 100vh;
  background-color: var(--bg-main);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-normal);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 20;
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--brand-orange), #ea580c);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--brand-orange-light);
  color: var(--brand-orange);
  border-color: rgba(249, 115, 22, 0.3);
  font-weight: 600;
}

.nav-item-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Network Status Pill */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot.online {
  background-color: var(--status-emerald);
  box-shadow: 0 0 8px var(--status-emerald);
}
.status-dot.offline {
  background-color: var(--status-amber);
  box-shadow: 0 0 8px var(--status-amber);
}

/* Main Content Area */
.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
}

/* Top Navigation Bar */
.topbar {
  height: 64px;
  background-color: rgba(19, 29, 49, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-normal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-normal);
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  transition: all 0.15s ease;
}

.topbar-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
}

.topbar-btn.primary {
  background: linear-gradient(135deg, var(--brand-orange), #ea580c);
  border: none;
  color: white;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.35);
}
.topbar-btn.primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Page Views Container */
.content-body {
  padding: 24px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.view-section {
  display: none;
  animation: fadeIn 0.2s ease-out;
}
.view-section.active {
  display: block;
}

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

/* Cards & Surfaces */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Metric / Stat Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
}
.stat-card.orange::after { background: var(--brand-orange); }
.stat-card.blue::after { background: var(--accent-blue); }
.stat-card.emerald::after { background: var(--status-emerald); }
.stat-card.amber::after { background: var(--status-amber); }

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
}

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  transition: all 0.15s ease;
}

.form-control:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--brand-orange-light);
}

.form-control::placeholder {
  color: var(--text-faint);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.data-table th {
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-normal);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: rgba(30, 41, 59, 0.4);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.success {
  background: var(--status-emerald-light);
  color: var(--status-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.warning {
  background: var(--status-amber-light);
  color: var(--status-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge.danger {
  background: var(--status-rose-light);
  color: var(--status-rose);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.info {
  background: var(--accent-blue-light);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border-normal);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-orange), #ea580c);
  color: white;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}
.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-normal);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-highlight);
}

.btn-success {
  background: linear-gradient(135deg, var(--status-emerald), #059669);
  color: white;
}
.btn-success:hover {
  opacity: 0.95;
}

.btn-danger {
  background: var(--status-rose-light);
  color: var(--status-rose);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
  background: var(--status-rose);
  color: white;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.775rem;
}

/* Modal Popup */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-backdrop.open .modal-box {
  transform: scale(1);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 16px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* POS Screen Split */
.pos-container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .pos-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 70px;
  }
  .brand-title, .brand-subtitle, .nav-item span, .status-pill span, .sidebar-footer small {
    display: none;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
}

/* Quick item picker in POS */
.pos-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.pos-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-item-card:hover {
  border-color: var(--brand-orange);
  background: var(--bg-surface-hover);
}

/* POS Summary Box */
.pos-summary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pos-summary-row.total {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  padding-top: 10px;
  border-top: 1px dashed var(--border-highlight);
}

/* Thermal receipt modal preview */
.thermal-preview-container {
  background: #f1f5f9;
  color: #0f172a;
  padding: 20px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: center;
  max-height: 500px;
  overflow-y: auto;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.15);
}

.receipt-paper {
  background: white;
  color: black;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  padding: 16px 12px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  width: 58mm;
  box-sizing: border-box;
}

.receipt-paper.paper-80mm {
  width: 80mm;
}

.receipt-center { text-align: center; }
.receipt-bold { font-weight: bold; }
.receipt-divider {
  border-top: 1px dashed #000;
  margin: 8px 0;
}
.receipt-row {
  display: flex;
  justify-content: space-between;
}

/* ==========================================================================
   KANBAN WORKSHOP PIPELINE (Job Card Stages Ala Garage Master)
   ========================================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

@media (max-width: 1100px) {
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kanban-board {
    grid-template-columns: 1fr;
  }
}

.kanban-col {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 400px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 700;
}

.kanban-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  position: relative;
}

.kanban-card:hover {
  border-color: var(--brand-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kanban-empty {
  text-align: center;
  padding: 28px 10px;
  font-size: 0.8rem;
  color: var(--text-faint);
  font-style: italic;
}

/* ==========================================================================
   MOBILE-FIRST BOTTOM NAVIGATION BAR (Untuk Smartphone Kasir / Mekanik / Owner)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(19, 29, 49, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-normal);
  z-index: 99;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex: 1;
  text-align: center;
  transition: color 0.15s ease;
}

.bottom-nav-item.active {
  color: var(--brand-orange);
}

.bottom-nav-icon {
  font-size: 19px;
  line-height: 1;
}

@media (max-width: 768px) {
  body {
    padding-bottom: 66px; /* Space for bottom nav */
  }
  .sidebar {
    display: none !important;
  }
  .mobile-bottom-nav {
    display: flex;
  }
  .topbar {
    padding: 0 14px;
  }
  .content-body {
    padding: 14px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-card {
    padding: 12px;
  }
  .stat-value {
    font-size: 1.25rem;
  }
}

