/* SAS Pro Enterprise ERP & POS - Ultra-Premium Dynamic Theme Engine */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bg-surface: #090a0f;
  --bg-container: #12141c;
  --bg-container-high: #181b26;
  --bg-container-highest: #222636;
  --primary: #3b82f6;
  --primary-bright: #2563eb;
  --on-primary: #ffffff;
  --on-primary-container: #ffffff;
  --tertiary: #10b981;
  --tertiary-dim: #059669;
  --on-tertiary: #ffffff;
  --on-tertiary-container: #ffffff;
  --error: #f87171;
  --error-bg: #450a0a;
  --warning: #fbbf24;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --outline: rgba(255, 255, 255, 0.12);
  --outline-variant: rgba(255, 255, 255, 0.07);
}

/* Light Theme Luxury Mode Overrides */
html.light-theme {
  --bg-surface: #f8fafc;
  --bg-container: #ffffff;
  --bg-container-high: #f1f5f9;
  --bg-container-highest: #e2e8f0;
  --primary: #2563eb;
  --primary-bright: #1d4ed8;
  --on-primary: #ffffff;
  --on-primary-container: #ffffff;
  --tertiary: #059669;
  --tertiary-dim: #047857;
  --on-tertiary: #ffffff;
  --on-tertiary-container: #ffffff;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --warning: #d97706;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --outline: #cbd5e1;
  --outline-variant: #e2e8f0;
}

html.light-theme,
html.light-theme body,
html.light-theme .bg-surface {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.light-theme header {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light-theme aside {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

html.light-theme main,
html.light-theme #app-viewport {
  background-color: #f8fafc !important;
}

html.light-theme .bg-surface-container {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04) !important;
}

html.light-theme .bg-surface-container-high {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

html.light-theme .bg-surface-container-highest {
  background-color: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

html.light-theme .text-on-surface {
  color: #0f172a !important;
}

html.light-theme .text-on-surface-variant {
  color: #64748b !important;
}

html.light-theme .border-outline-variant,
html.light-theme .border-outline-variant\/60,
html.light-theme .border-outline-variant\/40 {
  border-color: #e2e8f0 !important;
}

html.light-theme .pos-product-card {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

html.light-theme .pos-product-card:hover {
  border-color: #2563eb !important;
  box-shadow: 0 6px 16px 0 rgba(37, 99, 235, 0.12);
}

html.light-theme .prod-img-box {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
}

body {
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-family);
  overflow-x: hidden;
  user-select: text;
  -webkit-user-select: text;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Elegant Text Selection Highlight */
::selection {
  background-color: rgba(59, 130, 246, 0.35);
  color: inherit;
}

/* Custom Smooth Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.45);
}

/* Code & Numbers */
.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Glassmorphism & Panels */
.glass-panel {
  background: rgba(18, 20, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

html.light-theme .glass-panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

/* Subtle View Transition */
.view-transition {
  animation: fadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Sidebar Navigation Link Active State */
.nav-link.active {
  background-color: rgba(59, 130, 246, 0.14) !important;
  color: var(--primary) !important;
  font-weight: 700 !important;
  border-left: 3px solid var(--primary);
  border-radius: 0 12px 12px 0;
}

html.light-theme .nav-link.active {
  background-color: rgba(37, 99, 235, 0.09) !important;
  color: #2563eb !important;
  border-left: 3px solid #2563eb;
}

.nav-link {
  border-left: 3px solid transparent;
  transition: all 0.15s ease-in-out;
}

/* POS Product Card */
.pos-product-card {
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pos-product-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.3);
}

/* Product Image Box */
.prod-img-box {
  width: 100%;
  aspect-ratio: 16/10;
  border-radius: 0.75rem;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--outline-variant);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.prod-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pos-product-card:hover .prod-img-box img {
  transform: scale(1.04);
}

/* Modal Backdrop Blur */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Mobile Bottom Navigation & Safe Area */
.safe-bottom {
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.mobile-nav-link {
  color: var(--text-muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.mobile-nav-link:active {
  transform: scale(0.94);
}

.mobile-nav-link.active {
  color: var(--primary) !important;
  font-weight: 700;
}

.mobile-nav-link.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

html.light-theme #mobile-bottom-nav {
  background-color: rgba(255, 255, 255, 0.96) !important;
  border-color: #e2e8f0 !important;
  box-shadow: 0 -4px 12px 0 rgba(0, 0, 0, 0.05) !important;
}

html.light-theme #mobile-bottom-nav .mobile-nav-link {
  color: #64748b;
}

html.light-theme #mobile-bottom-nav .mobile-nav-link.active {
  color: #2563eb !important;
}

/* Multi-Format Print Styles (Thermal POS 80mm/58mm & Standard A4/A5) */
@media print {
  body * {
    visibility: hidden;
  }
  #print-receipt-container,
  #print-receipt-container * {
    visibility: visible;
  }
  #print-receipt-container {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0 auto;
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  /* Thermal 80mm Mode */
  #print-receipt-container.thermal-80 {
    width: 80mm;
    max-width: 80mm;
    padding: 2mm;
    font-size: 11px;
  }

  /* Thermal 58mm Mode */
  #print-receipt-container.thermal-58 {
    width: 58mm;
    max-width: 58mm;
    padding: 1.5mm;
    font-size: 9.5px;
  }

  /* Standard A4 Corporate Invoice & Multi-Page HR Reports */
  #print-receipt-container.standard-a4 {
    width: 100%;
    max-width: 210mm;
    padding: 10mm 12mm;
    font-size: 11px;
    background: white !important;
    color: black !important;
  }

  /* Standard A4 Landscape Master Attendance Matrix Sheet */
  #print-receipt-container.standard-a4-landscape {
    width: 100%;
    max-width: 297mm;
    padding: 6mm 8mm;
    font-size: 10px;
    background: white !important;
    color: black !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  #print-receipt-container.standard-a4 table,
  #print-receipt-container.standard-a4-landscape table {
    width: 100%;
    border-collapse: collapse;
    page-break-inside: auto;
  }

  #print-receipt-container.standard-a4 tr,
  #print-receipt-container.standard-a4-landscape tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  #print-receipt-container.standard-a4 thead,
  #print-receipt-container.standard-a4-landscape thead {
    display: table-header-group;
  }

  #print-receipt-container.standard-a4 tfoot,
  #print-receipt-container.standard-a4-landscape tfoot {
    display: table-footer-group;
  }

  /* A4 Landscape matrix cells: force background colors in print */
  #print-receipt-container.standard-a4-landscape td,
  #print-receipt-container.standard-a4-landscape th {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Standard A5 Corporate Invoice */
  #print-receipt-container.standard-a5 {
    width: 100%;
    max-width: 148mm;
    padding: 8mm 10mm;
    font-size: 10.5px;
  }

  .no-print {
    display: none !important;
  }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Premium Service Ticket Modal Styles
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* Premium Input Style */
.srv-premium-input {
  background: var(--bg-container);
  border: 1.5px solid var(--outline-variant);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.srv-premium-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 1px 3px rgba(0, 0, 0, 0.1);
  background: var(--bg-container-high);
}

.srv-premium-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Device Card Hover */
.srv-device-card {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.srv-device-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Checklist Chip Hover */
.srv-checklist-chip {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.srv-checklist-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Submit Button Shimmer */
@keyframes srv-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Modal Container Override for rounded corners */
.srv-ticket-modal {
  border-radius: inherit;
}

/* Light Theme Overrides for Service Modal */
html.light-theme .srv-premium-input {
  background: #ffffff;
  border-color: #e2e8f0;
}

html.light-theme .srv-premium-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
  background: #f8fafc;
}

html.light-theme .srv-device-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html.light-theme .srv-checklist-chip:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* WhatsApp Template Chip */
.wa-template-chip {
  transition: all 0.15s ease-in-out;
}
.wa-template-chip:hover {
  transform: translateY(-1px);
}
.wa-template-chip:active {
  transform: scale(0.96);
}

/* Light Theme overrides for WhatsApp modal */
html.light-theme .wa-template-chip {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #475569;
}
html.light-theme .wa-template-chip:hover {
  border-color: #10b981;
  color: #047857;
}
