/* ============================================================
   THERMOO — Main Premium Stylesheet
   Premium Dark UI with Glassmorphism & Modern Responsive Design
   ============================================================ */

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

/* ============================================================
   CSS Variables (Design Tokens)
   ============================================================ */
:root {
  --color-bg:            #0B1020;
  --color-surface:       #12182B;
  --color-surface-solid: #12182B;
  --color-surface2:      #1E293B;
  --color-border:        rgba(255, 255, 255, 0.08);
  --color-text:          #FFFFFF;
  --color-muted:         #AAB4D0;
  --color-primary:       #8B5CF6;
  --color-primary-h:     #A78BFA;
  --color-teal:          #10b981;
  --color-orange:        #f97316;
  --color-purple:        #8b5cf6;
  --color-success:       #22C55E;
  --color-warning:       #F59E0B;
  --color-danger:        #EF4444;
  --sidebar-w:           280px;
  --topbar-h:            64px;
  --radius:              12px;
  --radius-lg:           18px;
  --shadow:              0 4px 20px 0 rgba(0, 0, 0, 0.3);
  --shadow-lg:           0 8px 30px 0 rgba(0, 0, 0, 0.45);
  --transition:          0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Gradasi */
  --grad-primary:    linear-gradient(135deg, #8B5CF6 0%, #a78bfa 100%);
  --grad-teal:       linear-gradient(135deg, #22C55E 0%, #10b981 100%);
  --grad-accent:     linear-gradient(135deg, #a78bfa 0%, #06b6d4 100%);

  /* Theme tokens */
  --color-sidebar-bg: #12182B;
  --color-topbar-bg: rgba(11, 16, 32, 0.85);
  --color-title: #ffffff;
}

body.light-theme, html.light-theme {
  --color-bg:            #F8FAFC;
  --color-surface:       #FFFFFF;
  --color-surface-solid: #FFFFFF;
  --color-surface2:      #F1F5F9;
  --color-border:        rgba(15, 23, 42, 0.08);
  --color-text:          #0F172A;
  --color-muted:         #64748B;
  --color-primary:       #8B5CF6;
  --color-primary-h:     #7C3AED;
  --color-sidebar-bg: #ffffff;
  --color-topbar-bg: rgba(248, 250, 252, 0.85);
  --color-title: #0F172A;
  --shadow:              0 4px 20px 0 rgba(148, 163, 184, 0.08);
  --shadow-lg:           0 8px 30px 0 rgba(148, 163, 184, 0.15);
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary-h); text-decoration: none; transition: var(--transition); }
a:hover { color: #fff; }

/* Background Deco */
body::before {
  content: '';
  position: fixed;
  top: -10%; left: -10%;
  width: 50%; height: 50%;
  background: radial-gradient(circle, rgba(124,58,237,0.08) 0%, rgba(0,0,0,0) 70%);
  z-index: -2;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  bottom: -10%; right: -10%;
  width: 60%; height: 60%;
  background: radial-gradient(circle, rgba(6,182,212,0.05) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
}

/* ============================================================
   GLASSMORPHISM & GENERAL CARDS
   ============================================================ */
.glass-panel {
  background: var(--color-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-panel {
  background: var(--color-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.3px;
}
.panel-body { padding: 20px; }

/* ============================================================
   SIDEBAR (Premium Drawer Layout)
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform var(--transition);
}

/* Brand */
.sidebar-brand {
  padding: 24px;
  border-bottom: 1px solid var(--color-border);
}
.brand-name {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.5px;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub {
  font-size: 9px;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* User Info */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}
.user-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: #fff;
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
  flex-shrink: 0;
}
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--grad-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.user-name { font-size: 14px; font-weight: 600; color: #fff; margin-bottom: 2px; }

/* Role badges */
.badge-role {
  display: inline-flex;
  align-items: center;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-role.admin {
  background: rgba(124,58,237,0.15);
  color: var(--color-primary-h);
  border: 1px solid rgba(124,58,237,0.3);
}
.badge-role.agent {
  background: rgba(16,185,129,0.15);
  color: var(--color-teal);
  border: 1px solid rgba(16,185,129,0.3);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}
.nav-item i { font-size: 18px; width: 20px; text-align: center; }
.nav-item:hover {
  background: var(--color-surface2);
  color: var(--color-text);
}
.nav-item.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}
.nav-item.text-danger-soft:hover {
  background: rgba(239,68,68,0.1);
  color: var(--color-danger);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-muted);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
}

/* ============================================================
   MAIN WRAPPER & TOPBAR (Sticky Layout)
   ============================================================ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: var(--color-topbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.btn-menu {
  background: var(--color-surface2); border: 1px solid var(--color-border); color: var(--color-text);
  font-size: 20px; cursor: pointer; padding: 8px;
  border-radius: 10px;
  display: none;
  align-items: center; justify-content: center;
}
.btn-menu:hover { background: var(--color-surface); }
.topbar-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-title);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-content { padding: 28px; flex: 1; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.5px;
}
.page-desc {
  font-size: 13.5px;
  color: var(--color-muted);
  margin: 6px 0 0;
}

/* ============================================================
   STAT CARDS (Interactive Gradient Style)
   ============================================================ */
.stat-card {
  background: var(--color-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  height: 90px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
}
.stat-blue::before   { background: var(--grad-primary); }
.stat-teal::before   { background: var(--grad-teal); }
.stat-orange::before { background: linear-gradient(135deg, var(--color-orange), #fcd34d); }
.stat-purple::before { background: var(--grad-accent); }

.stat-card:hover { 
  transform: translateY(-3px); 
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-blue   .stat-icon { background: rgba(124,58,237,0.15);  color: var(--color-primary-h); }
.stat-teal   .stat-icon { background: rgba(16,185,129,0.15);   color: var(--color-teal); }
.stat-orange .stat-icon { background: rgba(249,115,22,0.15);  color: var(--color-orange); }
.stat-purple .stat-icon { background: rgba(6,182,212,0.15);   color: #06b6d4; }

.stat-value {
  font-size: 20px; font-weight: 800; color: var(--color-text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-label {
  font-size: 11px; color: var(--color-muted); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600;
}

/* ============================================================
   QUICK ACTION BUTTONS
   ============================================================ */
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 16px;
}
.btn-action-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  font-weight: 600;
  transition: all var(--transition);
  text-align: center;
  box-shadow: var(--shadow);
}
.btn-action-card i {
  font-size: 28px;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: transform var(--transition);
}
.btn-action-card:hover {
  transform: translateY(-3px);
  border-color: var(--color-primary-h);
  box-shadow: var(--shadow-lg);
  color: #fff;
}
.btn-action-card:hover i {
  transform: scale(1.15);
}

/* ============================================================
   RESPONSIVE CARD LIST & TABLES
   ============================================================ */
.table-receipt {
  color: var(--color-text);
  font-size: 14px;
  width: 100%;
  border-collapse: collapse;
}

/* Force override Bootstrap's white backgrounds */
.table-receipt thead th,
.table-receipt > thead > tr > th {
  background-color: var(--color-surface2) !important;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--color-border) !important;
  border-top: none !important;
  padding: 12px 16px;
  text-align: left;
}

.table-receipt tbody td,
.table-receipt > tbody > tr > td {
  background-color: var(--color-surface) !important;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border) !important;
  border-top: none !important;
  vertical-align: middle;
  padding: 10px 16px;
  height: 52px;
  font-size: 14px;
}

/* Zebra striping over the base surface */
.table-receipt > tbody > tr:nth-child(even) > td {
  background-color: color-mix(in srgb, var(--color-surface2) 40%, var(--color-surface) 60%) !important;
}

/* Hover - slightly lighter/darker than base */
.table-receipt > tbody > tr:hover > td {
  background-color: var(--color-surface2) !important;
  transition: background-color 0.15s ease;
}

/* Bootstrap table-hover override — kill the --bs-table-hover-bg */
.table-receipt.table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: transparent;
  --bs-table-hover-bg: transparent;
  background-color: var(--color-surface2) !important;
  color: var(--color-text);
}

/* Small icon button for compact table actions */
.btn-icon-sm {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
  font-size: 14px !important;
}

/* ============================================================
   OCR LOADING ANIMATION
   ============================================================ */
@keyframes ocrScanLine {
  0%   { top: 0%; opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes ocrPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.08); }
}
@keyframes ocrDotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1.2); opacity: 1; }
}
@keyframes ocrGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(139, 92, 246, 0.3); }
  50%       { box-shadow: 0 0 30px rgba(139, 92, 246, 0.8), 0 0 60px rgba(139, 92, 246, 0.3); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ocr-loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  animation: fadeSlideUp 0.4s ease;
}

.ocr-scan-box {
  position: relative;
  width: 200px;
  height: 140px;
  border: 2px solid rgba(139, 92, 246, 0.6);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(139, 92, 246, 0.06);
  animation: ocrGlow 2s ease-in-out infinite;
  margin-bottom: 24px;
}

.ocr-scan-box::before,
.ocr-scan-box::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--color-primary);
  border-style: solid;
}
.ocr-scan-box::before { top: -1px; left: -1px; border-width: 3px 0 0 3px; border-radius: 3px 0 0 0; }
.ocr-scan-box::after  { bottom: -1px; right: -1px; border-width: 0 3px 3px 0; border-radius: 0 0 3px 0; }

.ocr-scan-line {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.9);
  animation: ocrScanLine 1.8s ease-in-out infinite;
}

.ocr-scan-lines {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 6px,
    rgba(139, 92, 246, 0.04) 6px,
    rgba(139, 92, 246, 0.04) 7px
  );
}

.ocr-scan-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(139, 92, 246, 0.25);
}

.ocr-loading-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}
.ocr-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: ocrDotBounce 1.4s ease-in-out infinite;
}
.ocr-dot:nth-child(2) { animation-delay: 0.16s; }
.ocr-dot:nth-child(3) { animation-delay: 0.32s; }

.ocr-status-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 16px;
  margin-bottom: 4px;
  min-height: 24px;
  transition: all 0.3s ease;
}

.ocr-status-sub {
  font-size: 12px;
  color: var(--color-muted);
}

.ocr-progress-wrap {
  width: 220px;
  margin-top: 20px;
  background: var(--color-surface2);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.ocr-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--color-primary), #06b6d4);
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

/* Receipt Mobile Card */
.receipt-card {
  display: none; /* Desktop hidden */
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.receipt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.receipt-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.receipt-card-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.receipt-card-row .label { color: var(--color-muted); }
.receipt-card-row .value { color: var(--color-text); font-weight: 500; }
.receipt-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--color-border);
  padding-top: 12px;
}

.receipt-code {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #06b6d4;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Soft Badges */
.badge {
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 12px;
}
.badge-sm { font-size: 11px; padding: 4px 10px; }
.bg-success-soft   { background: rgba(16, 185, 129, 0.15) !important; color: #34d399 !important; border: 1px solid rgba(16, 185, 129, 0.2); }
.bg-warning-soft   { background: rgba(245, 158, 11, 0.15) !important; color: #fbbf24 !important; border: 1px solid rgba(245, 158, 11, 0.2); }
.bg-danger-soft    { background: rgba(239, 68, 68, 0.15) !important; color: #f87171 !important; border: 1px solid rgba(239, 68, 68, 0.2); }
.bg-primary-soft   { background: rgba(124, 58, 237, 0.15) !important; color: #c084fc !important; border: 1px solid rgba(124, 58, 237, 0.2); }
.bg-secondary-soft { background: rgba(100, 116, 139, 0.15) !important; color: #94a3b8 !important; border: 1px solid rgba(100, 116, 139, 0.2); }

/* ============================================================
   WIZARD FLOW & CHOOSE TEMPLATE
   ============================================================ */
.wizard-progress {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: 30px;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}
.wizard-progress::before {
  content: '';
  position: absolute;
  top: 15px; left: 0; right: 0;
  height: 2px;
  background: var(--color-border);
  z-index: 1;
}
.wizard-progress-bar {
  position: absolute;
  top: 15px; left: 0;
  height: 2px;
  background: var(--color-primary);
  z-index: 1;
  transition: width 0.4s ease;
}
.wizard-step {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wizard-node {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-surface2);
  border: 2px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--color-muted);
  transition: all var(--transition);
}
.wizard-step.active .wizard-node {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.3);
}
.wizard-step.complete .wizard-node {
  background: var(--color-teal);
  border-color: var(--color-teal);
  color: #fff;
}
.wizard-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wizard-step.active .wizard-label { color: #fff; }
.wizard-step.complete .wizard-label { color: var(--color-teal); }

.wizard-panel { display: none; }
.wizard-panel.active { display: block; animation: fadeIn 0.4s ease; }

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

/* Template Select Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}
.template-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  box-shadow: var(--shadow);
}
.template-card input[type="radio"] { display: none; }
.template-card:hover {
  border-color: var(--color-primary-h);
  background: rgba(124, 58, 237, 0.1);
  transform: translateY(-2px);
}
.template-card.selected {
  border-color: var(--color-primary);
  background: rgba(124, 58, 237, 0.15);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}
.tpl-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.tpl-name { font-size: 12px; font-weight: 700; color: var(--color-text); line-height: 1.4; }

/* ============================================================
   INPUT & FORM STYLING
   ============================================================ */
.form-control, .form-select {
  background: var(--color-surface2) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text) !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
  font-size: 14px !important;
}
.form-control::placeholder { color: var(--color-muted) !important; }
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary-h) !important;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  outline: none;
}
.form-label { font-size: 13.5px; font-weight: 600; color: var(--color-text); margin-bottom: 8px; }
.form-text  { font-size: 12px; color: var(--color-muted); margin-top: 6px; }

.input-group-text {
  background: var(--color-surface2) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-muted) !important;
  padding: 12px 16px !important;
  border-radius: 10px 0 0 10px !important;
}

.input-icon-group { position: relative; }
.input-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted); pointer-events: none; z-index: 10;
  font-size: 16px;
}
.input-with-icon { padding-left: 44px !important; }
.btn-toggle-pass {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; color: var(--color-muted);
  cursor: pointer; font-size: 16px; padding: 6px; z-index: 10;
}
.btn-toggle-pass:hover { color: var(--color-text); }

.pln-token-input {
  font-family: 'Courier New', monospace !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  letter-spacing: 3px !important;
  text-align: center !important;
  color: var(--color-warning) !important;
  background: rgba(245, 158, 11, 0.05) !important;
  border: 1px dashed var(--color-warning) !important;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 10px !important; font-weight: 600; font-size: 14px; padding: 12px 20px; transition: all var(--transition); }
.btn-sm { padding: 8px 16px !important; font-size: 12px !important; }
.btn-lg { padding: 14px 28px !important; font-size: 15px !important; }

.btn-primary {
  background: var(--grad-primary) !important;
  border: none !important;
  color: #fff !important;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4) !important;
  filter: brightness(1.1);
}
.btn-warning {
  background: var(--color-warning) !important;
  border-color: var(--color-warning) !important;
  color: #000 !important;
}
.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3) !important;
}
.btn-success {
  background: var(--grad-teal) !important;
  border: none !important;
  color: #fff !important;
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3) !important;
}
.btn-danger {
  background: var(--color-danger) !important;
  border-color: var(--color-danger) !important;
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3) !important;
}
.btn-outline-primary {
  border-color: var(--color-primary) !important;
  color: var(--color-primary-h) !important;
}
.btn-outline-primary:hover {
  background: var(--color-primary) !important;
  color: #fff !important;
}
.btn-outline-secondary {
  border-color: var(--color-border) !important;
  color: var(--color-muted) !important;
}
.btn-outline-secondary:hover {
  background: var(--color-surface2) !important;
  color: var(--color-text) !important;
}

/* ============================================================
   RECEIPT PREVIEW & DOTED BG
   ============================================================ */
.dotted-bg {
  background-color: #090a0f;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
}

body.light-theme .dotted-bg {
  background-color: #e2e8f0;
  background-image: radial-gradient(rgba(15, 23, 42, 0.12) 1.5px, transparent 1.5px);
}

.receipt-paper {
  background: #fff;
  color: #000;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  font-family: 'Courier New', Courier, monospace;
  padding: 24px;
  position: relative;
  transition: width 0.3s ease;
  min-height: 400px;
}

body.light-theme .receipt-paper {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
}

/* Size toggle controls in receipt panel */
.size-toggle-container {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  padding: 3px;
  border-radius: 8px;
}

body.light-theme .size-toggle-container {
  background: var(--color-surface2);
}

.size-toggle-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--color-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.size-toggle-btn.active {
  background: var(--color-primary);
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.size-toggle-btn:hover:not(.active) {
  color: var(--color-title);
  background: rgba(255, 255, 255, 0.08);
}

body.light-theme .size-toggle-btn:hover:not(.active) {
  background: rgba(15, 23, 42, 0.04);
}
.receipt-paper::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 6px;
  background-image: linear-gradient(-45deg, transparent 4px, #fff 4px), linear-gradient(45deg, transparent 4px, #fff 4px);
  background-size: 12px 12px;
  background-repeat: repeat-x;
  transform: translateY(100%);
  z-index: 10;
}

/* Horizontal Template Select list */
.template-horizontal-select {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding: 8px 4px 16px;
  scrollbar-width: thin;
}
.tpl-select-btn {
  white-space: nowrap;
  padding: 10px 18px;
  background: var(--color-surface2);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.tpl-select-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* Inline Editable in Preview */
.editable-field {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border 0.2s ease;
}
.editable-field:hover {
  background: rgba(124, 58, 237, 0.1);
  border-bottom-color: var(--color-primary);
}

/* ============================================================
   BLUETOOTH PRINTER UI
   ============================================================ */
.printer-card {
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface2);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.printer-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.printer-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.15);
  color: var(--color-primary-h);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.printer-status-indicator {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-connected { background: var(--color-success); box-shadow: 0 0 10px var(--color-success); }
.status-disconnected { background: var(--color-danger); }
.status-searching { background: var(--color-warning); animation: pulse 1s infinite alternate; }

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Spinner */
.spinner-scan {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-muted);
}
.empty-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 20px;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.6;
}
.empty-state h5 { color: #fff; margin-bottom: 12px; font-weight: 700; }
.empty-state p { font-size: 14px; max-width: 300px; margin: 0 auto 24px; }

/* ============================================================
   AUTH SCREEN (Login Redesign)
   ============================================================ */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  background: #06070a;
}
.auth-card-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 10;
}
.auth-card {
  background: rgba(21, 23, 37, 0.65);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   SCROLLBAR & FORMS RESET
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-surface2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ============================================================
   RESPONSIVE DESIGN (Media Queries)
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0,0,0,0.8);
  }
  .sidebar-overlay.show { display: block; }
  .main-wrapper { margin-left: 0; }
  .btn-menu { display: flex; }
  .topbar-title { font-size: 15px; font-weight: 700; }

  /* Mobile Grid changes */
  .detail-grid { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .action-grid { grid-template-columns: repeat(2, 1fr); }
  
  /* Show mobile card for receipts and hide table */
  .receipt-table-desktop { display: none; }
  .receipt-card { display: block; }
}

@media (max-width: 575.98px) {
  .page-content { padding: 20px 16px; }
  .page-title { font-size: 22px; }
  .stat-card { padding: 16px; gap: 14px; }
  .stat-value { font-size: 20px; }
  .auth-card { padding: 30px 20px; }
  .wizard-progress { margin-bottom: 24px; }
  .wizard-label { display: none; } /* hide labels to save space */
  .btn:not(.btn-sm):not(.btn-icon-sm):not(.dropdown-toggle):not(.btn-close) { width: 100%; margin-bottom: 8px; } /* stack main buttons */
  .btn:not(.btn-sm):not(.btn-icon-sm):not(.dropdown-toggle):not(.btn-close):last-child { margin-bottom: 0; }
}

/* Modals Theme Styling */
.modal-content {
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text) !important;
  border-radius: var(--radius-lg) !important;
}
.modal-header, .modal-footer {
  border-color: var(--color-border) !important;
}
.modal-title {
  color: var(--color-text) !important;
}
.modal-header .btn-close {
  filter: var(--color-text) === '#FFFFFF' ? invert(1) : none;
}
body.light-theme .modal-header .btn-close {
  filter: none;
}
html:not(.light-theme) .modal-header .btn-close,
body:not(.light-theme) .modal-header .btn-close {
  filter: invert(1);
}

/* Redefine text-muted to use theme variables */
.text-muted {
  color: var(--color-muted) !important;
}

