/* Yosonda Phone Accessories Web Admin Stylesheet */
:root {
  --primary-color: #0d47a1;
  --primary-dark: #082b66;
  --primary-light: #e3f2fd;
  --secondary-color: #00b0ff;
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --bg-color: #f1f5f9;
  --text-color: #1e293b;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #0f172a;
  color: #94a3b8;
  z-index: 1040;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

#sidebar .brand-header {
  padding: 16px 20px;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  gap: 12px;
}

#sidebar .brand-header .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

#sidebar .brand-title {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

#sidebar .brand-sub {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 600;
}

#sidebar .nav-list {
  list-style: none;
  padding: 12px 10px;
  margin: 0;
}

#sidebar .nav-item {
  margin-bottom: 3px;
}

#sidebar .nav-link {
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
}

#sidebar .nav-link i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

#sidebar .nav-link:hover {
  background-color: #1e293b;
  color: #fff;
}

#sidebar .nav-link.active {
  background-color: var(--primary-color);
  color: #fff;
  font-weight: 600;
}

/* Main Content Area */
#main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  width: calc(100% - var(--sidebar-width));
  max-width: 100%;
}

/* Top Navbar */
#topbar {
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 900;
}

.topbar-badge {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
}

/* Page Container */
.page-content {
  padding: 24px;
  flex: 1;
}

/* KPI Cards */
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.kpi-card .kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
}

.kpi-card .kpi-usd {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
}

.kpi-card .kpi-khr {
  font-size: 13px;
  font-weight: 600;
  color: #10b981;
}

.kpi-card .kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

/* Card Containers */
.admin-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.admin-card .card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-card .card-header .card-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.admin-card .card-body {
  padding: 20px;
}

/* POS Layout */
.pos-container {
  display: flex;
  gap: 20px;
  height: calc(100vh - var(--topbar-height) - 48px);
}

.pos-catalog {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 16px;
  overflow: hidden;
}

.pos-product-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  padding: 4px;
}

.pos-product-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 185px;
}

.pos-product-card:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(13, 71, 161, 0.15);
  transform: translateY(-2px);
}

.pos-product-card .img-placeholder {
  height: 70px;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.pos-product-card .prod-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pos-product-card .prod-sku {
  font-size: 11px;
  color: #64748b;
}

.pos-product-card .prod-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-color);
}

.pos-cart-panel {
  width: 400px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.cart-item-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.cart-qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: bold;
}

.cart-qty-btn:hover {
  background: #f1f5f9;
}

/* DataTables customization */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  margin-left: 8px;
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
}

table.dataTable {
  border-collapse: collapse !important;
  width: 100% !important;
}

table.dataTable thead th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border-color) !important;
}

table.dataTable tbody td {
  font-size: 13.5px;
  vertical-align: middle;
}

/* Thermal, Commercial & Dot Matrix Invoice Print Styles (Full A5 Support) */
@page {
  size: A5 portrait;
  margin: 4mm;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body * {
    visibility: hidden;
  }
  #printable-invoice, #printable-invoice *,
  #printable-dotmatrix-invoice, #printable-dotmatrix-invoice *,
  #printable-receipt, #printable-receipt * {
    visibility: visible;
  }
  #printable-invoice {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100% !important;
    max-width: 140mm !important;
    margin: 0 auto !important;
    padding: 4mm !important;
    box-sizing: border-box !important;
    border: 1.5px solid #0284c7 !important;
    box-shadow: none !important;
    background: #fff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  #printable-dotmatrix-invoice {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100% !important;
    max-width: 140mm !important;
    margin: 0 auto !important;
    padding: 3mm 4mm !important;
    box-sizing: border-box !important;
    border: 1px solid #1e3a8a !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  #printable-dotmatrix-invoice.sc-dm-pink {
    background-color: #fce7f3 !important;
  }
  #printable-dotmatrix-invoice.sc-dm-white {
    background-color: #ffffff !important;
  }
  #printable-receipt {
    position: absolute;
    left: 0;
    top: 0;
    width: 76mm !important;
    max-width: 76mm !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
    padding: 2mm !important;
    font-size: 10px !important;
    font-family: 'Battambang', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    border: none !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  #printable-receipt.sc-dm-pink {
    background-color: #fce7f3 !important;
  }
  #printable-receipt.sc-dm-white {
    background-color: #ffffff !important;
  }
  .no-print {
    display: none !important;
  }
}

.receipt-box {
  width: 100%;
  max-width: 350px;
  box-sizing: border-box;
  background: #fff;
  padding: 10px 8px;
  font-size: 10.5px;
  font-family: 'Battambang', 'Kantumruy Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 auto;
  border: 1px solid #1e3a8a;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.08);
  overflow: hidden;
  color: #1e3a8a;
}

.receipt-box.sc-dm-pink {
  background-color: #fce7f3;
  border: 1px solid #f472b6;
  box-shadow: 0 4px 18px rgba(219, 39, 119, 0.12);
}

.receipt-box.sc-dm-white {
  background-color: #ffffff;
  border: 1px solid #1e3a8a;
}

/* =====================================================================
   S.C WHOLESALE & RETAIL INVOICE STYLES (Matching Physical Pre-printed Slip)
   ===================================================================== */
.sc-invoice-container {
  width: 100%;
  max-width: 760px;
  background: #ffffff;
  border: 2px solid #0284c7;
  border-radius: 4px;
  padding: 16px 20px;
  box-sizing: border-box;
  font-family: 'Kantumruy Pro', 'Battambang', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  margin: 0 auto;
}

.sc-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.sc-bank-card {
  flex: 0 0 200px;
  font-size: 11px;
}

.sc-bank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.sc-badge-aba {
  background: #004b87;
  color: #fff;
  font-weight: 800;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.sc-badge-wing {
  background: #0072ce;
  color: #fff;
  font-weight: 800;
  font-size: 9px;
  padding: 2px 4px;
  border-radius: 3px;
}

.sc-bank-acc {
  font-weight: 800;
  font-family: monospace;
  font-size: 13px;
  color: #0369a1;
  display: block;
  line-height: 1.1;
}

.sc-bank-holder {
  font-size: 10px;
  color: #334155;
  font-weight: 600;
  text-transform: uppercase;
}

.sc-header-center {
  flex: 1;
  text-align: center;
}

.sc-logo-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sc-logo-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #0284c7;
  color: #0284c7;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Arial Black', sans-serif;
  letter-spacing: -1px;
}

.sc-shop-name {
  font-size: 26px;
  font-weight: 900;
  color: #0369a1;
  letter-spacing: 1px;
  line-height: 1.1;
}

.sc-shop-tagline {
  font-size: 13px;
  color: #1e293b;
  font-weight: 700;
  margin-top: 3px;
}

.sc-invoice-heading {
  font-size: 15px;
  font-weight: 800;
  color: #0284c7;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

.sc-invoice-number-box {
  display: inline-block;
  margin-top: 4px;
  color: #dc2626;
  font-size: 16px;
  font-weight: 800;
  font-family: monospace;
  padding: 1px 12px;
  border: 1.5px dotted #dc2626;
  border-radius: 4px;
  background: #fef2f2;
}

.sc-contact-card {
  flex: 0 0 170px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.sc-phone-line {
  color: #1e293b;
  font-family: monospace;
  margin-bottom: 2px;
}

.sc-mode-pill {
  display: inline-block;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 800;
  margin-top: 4px;
  text-transform: uppercase;
}
.sc-pill-ws {
  background: #f3e8ff;
  color: #7c3aed;
  border: 1px solid #d8b4fe;
}
.sc-pill-rt {
  background: #e0f2fe;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

/* Meta Section */
.sc-meta-container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  padding: 2px;
}
.sc-meta-col-left {
  flex: 1.1;
}
.sc-meta-col-right {
  flex: 0.9;
  text-align: right;
}
.sc-meta-field {
  display: flex;
  align-items: baseline;
  margin-bottom: 4px;
}
.sc-meta-title {
  color: #1e293b;
  font-weight: 700;
  white-space: nowrap;
  margin-right: 6px;
}
.sc-dotted-line {
  border-bottom: 1.5px dotted #94a3b8;
  flex: 1;
  padding-bottom: 1px;
  color: #0f172a;
  min-height: 18px;
}
.sc-dotted-day, .sc-dotted-month, .sc-dotted-year {
  border-bottom: 1.5px dotted #94a3b8;
  min-width: 28px;
  display: inline-block;
  margin: 0 4px;
  padding-bottom: 1px;
}

/* Items Table */
.sc-invoice-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #0284c7;
  font-size: 13px;
  margin-bottom: 10px;
}
.sc-invoice-table thead tr {
  background-color: #f0f9ff;
  border-bottom: 1.5px solid #0284c7;
}
.sc-invoice-table th {
  border: 1px solid #0284c7;
  padding: 6px 4px;
  font-weight: 800;
  color: #0369a1;
  text-align: center;
  line-height: 1.2;
}
.sc-en-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.sc-invoice-table td {
  border: 1px solid #0284c7;
  padding: 5px 8px;
  height: 27px;
  vertical-align: middle;
}
.sc-col-no { width: 44px; text-align: center; font-weight: 700; color: #64748b; }
.sc-col-desc { text-align: left; }
.sc-col-qty { width: 75px; text-align: center; font-weight: 600; }
.sc-col-price { width: 85px; text-align: right; color: #334155; }
.sc-col-amt { width: 100px; text-align: right; font-weight: 700; }

.sc-free-tag {
  color: #0284c7;
  font-weight: 700;
  font-style: italic;
  text-align: center;
  display: block;
}
.sc-paid-row {
  color: #dc2626;
  font-weight: 700;
  background-color: #fffaf0;
}

/* Footer Section */
.sc-bottom-section {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 4px;
}
.sc-bottom-left {
  flex: 1;
}
.sc-warning-text {
  color: #dc2626;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 14px;
}
.sc-sig-row {
  display: flex;
  justify-content: space-between;
  padding-right: 20px;
}
.sc-sig-col {
  text-align: center;
  width: 140px;
}
.sc-sig-label {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}
.sc-sig-person {
  font-size: 13px;
  font-weight: 800;
  color: #0369a1;
  min-height: 22px;
  margin-top: 8px;
}
.sc-sig-dots {
  color: #94a3b8;
  font-size: 12px;
  margin-top: -6px;
}

/* Summary Grid Box */
.sc-bottom-right {
  flex: 0 0 240px;
}
.sc-summary-box {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #0284c7;
  font-size: 13px;
}
.sc-summary-box td {
  border: 1px solid #0284c7;
  padding: 6px 10px;
}
.sc-sum-hdr {
  font-weight: 800;
  color: #0f172a;
  width: 95px;
  background-color: #f8fafc;
}
.sc-sum-val {
  text-align: right;
  font-family: monospace;
  font-size: 14px;
}
.sc-due-bg {
  background-color: #fef2f2;
}

/* =====================================================================
   DOT MATRIX / CONTINUOUS FORM INVOICE (Matching Physical Photo Style)
   ===================================================================== */
.sc-dm-invoice-container {
  width: 100%;
  max-width: 580px; /* A5 standard proportional width */
  margin: 0 auto;
  padding: 14px 16px;
  box-sizing: border-box;
  font-family: 'Battambang', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e3a8a;
  position: relative;
  border-radius: 4px;
}

.sc-dm-invoice-container.sc-dm-pink {
  background-color: #fce7f3;
  border: 1px solid #f472b6;
  box-shadow: 0 4px 18px rgba(219, 39, 119, 0.12);
}

.sc-dm-invoice-container.sc-dm-white {
  background-color: #ffffff;
  border: 1px solid #94a3b8;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.sc-dm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.sc-dm-logo-box {
  border: 2px solid #1e3a8a;
  min-width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 22px;
  color: #1e3a8a;
  letter-spacing: -1px;
  font-family: 'Arial Black', sans-serif;
  background: rgba(30, 58, 138, 0.05);
  border-radius: 3px;
  flex-shrink: 0;
}

.sc-dm-meta-box {
  border-top: 1px solid #1e3a8a;
  padding-top: 5px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #1e3a8a;
  line-height: 1.5;
}

.sc-dm-meta-row {
  display: flex;
  align-items: baseline;
}

.sc-dm-meta-label {
  width: 125px;
  font-weight: 700;
  white-space: nowrap;
}

.sc-dm-meta-val {
  color: #0f172a;
}

.sc-dm-table {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #1e3a8a;
  font-size: 12px;
  margin: 6px 0 12px 0;
  color: #0f2b5c;
}

.sc-dm-table th {
  border: 1px solid #1e3a8a;
  padding: 5px 4px;
  font-weight: 800;
  text-align: center;
  background-color: rgba(30, 58, 138, 0.08);
  color: #1e3a8a;
  font-size: 11.5px;
}

.sc-dm-table td {
  border: 1px solid #1e3a8a;
  padding: 4px 6px;
  height: 25px;
  vertical-align: middle;
}

.sc-dm-total-row td {
  border: 1px solid #1e3a8a;
  border-top: 2px solid #1e3a8a;
  font-weight: 800;
  background-color: rgba(30, 58, 138, 0.06);
}

.sc-dm-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding: 0 15px;
  font-size: 11.5px;
  color: #1e3a8a;
}

#collectPaymentModal,
#supplierEditModal,
#paySupplierModal,
#stockInProductSelectModal,
#selectCustomerModal,
#selectTeamCarModal {
  z-index: 1070 !important;
}

#teamCarEditModal {
  z-index: 1080 !important;
}

/* Ensure SweetAlert2 always displays above all Bootstrap modals and backdrops */
.swal2-container {
  z-index: 99999 !important;
}

/* =========================================================
   SECURE SIGN-IN SCREEN (100% OPAQUE - ZERO TRANSPARENCY)
   ========================================================= */
body.not-logged-in {
  background: #0b1120 !important;
  overflow: hidden !important;
}

body.not-logged-in #sidebar,
body.not-logged-in #main-wrapper {
  display: none !important;
}

body.logged-in #login-screen {
  display: none !important;
}

#login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0b1120 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.login-header-ip {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-header-ip .ip-text {
  font-size: 15px;
  font-weight: 700;
  color: #1d4ed8;
  letter-spacing: 0.2px;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #2563eb, #3b82f6, #60a5fa);
}

/* =========================================================
   RESPONSIVE NAVIGATION: PC COLLAPSED & MOBILE DRAWER
   ========================================================= */

/* Backdrop overlay on mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  z-index: 1050;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* PC Collapsed Sidebar (Screens >= 992px) */
@media (min-width: 992px) {
  body.sidebar-collapsed #sidebar {
    width: 68px !important;
  }

  body.sidebar-collapsed #main-wrapper {
    margin-left: 68px !important;
    width: calc(100% - 68px) !important;
  }

  body.sidebar-collapsed #sidebar .brand-header {
    padding: 14px 6px;
    justify-content: center !important;
  }

  body.sidebar-collapsed #sidebar .brand-text-wrapper,
  body.sidebar-collapsed #sidebar .nav-link span,
  body.sidebar-collapsed #sidebar .sidebar-user-text {
    display: none !important;
  }

  body.sidebar-collapsed #sidebar .nav-list {
    padding: 12px 6px;
  }

  body.sidebar-collapsed #sidebar .nav-link {
    justify-content: center;
    padding: 12px 0;
    position: relative;
    border-radius: 10px;
  }

  body.sidebar-collapsed #sidebar .nav-link i {
    margin: 0;
    font-size: 20px;
    width: auto;
  }

  body.sidebar-collapsed #sidebar .sidebar-user-wrapper {
    padding: 12px 6px !important;
  }

  body.sidebar-collapsed #sidebar .sidebar-user-content {
    flex-direction: column;
    gap: 8px;
    align-items: center !important;
    justify-content: center !important;
  }

  body.sidebar-collapsed #sidebar .sidebar-user-info {
    justify-content: center;
  }

  body.sidebar-collapsed #sidebar .sidebar-logout-btn {
    padding: 4px 6px;
    font-size: 11px;
  }

  /* Tooltip on icon hover when collapsed */
  body.sidebar-collapsed #sidebar .nav-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 72px;
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 1090;
    box-shadow: 0 4px 16px rgba(0,0,0,0.45);
    pointer-events: none;
    border: 1px solid #334155;
  }
}

/* Mobile Drawer Sidebar (Screens < 992px) */
@media (max-width: 991.98px) {
  #sidebar {
    width: 270px !important;
    transform: translateX(-100%);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
    z-index: 1060;
  }

  body.mobile-sidebar-open #sidebar {
    transform: translateX(0) !important;
  }

  #main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body.mobile-sidebar-open .sidebar-backdrop {
    display: block !important;
    opacity: 1 !important;
  }

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

  #topbar {
    padding: 0 12px;
  }
}

/* Responsive polish for DataTables & Sale Orders on Mobile */
@media (max-width: 767.98px) {
  .dataTables_wrapper .dt-buttons {
    margin-bottom: 8px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .dataTables_wrapper .dt-buttons .btn {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }
  .dataTables_wrapper .dataTables_filter {
    float: none !important;
    text-align: left !important;
    margin-top: 6px !important;
    margin-bottom: 10px !important;
  }
  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    margin-left: 0 !important;
    display: block !important;
  }
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: center !important;
    margin-top: 10px !important;
  }
  .dataTables_wrapper .dataTables_paginate .pagination {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
}

/* =========================================================
   DARK THEME SUPPORT ([data-bs-theme="dark"])
   ========================================================= */
[data-bs-theme="dark"] {
  --bg-color: #0b1120;
  --text-color: #e2e8f0;
  --border-color: #334155;
  --primary-light: #1e3a8a;
  color-scheme: dark;
}

[data-bs-theme="dark"] body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

[data-bs-theme="dark"] #topbar {
  background: #0f172a;
  border-bottom-color: #1e293b;
}

[data-bs-theme="dark"] .topbar-badge {
  background-color: #064e3b !important;
  color: #a7f3d0 !important;
  border-color: #047857 !important;
}

[data-bs-theme="dark"] .kpi-card,
[data-bs-theme="dark"] .admin-card,
[data-bs-theme="dark"] .pos-catalog,
[data-bs-theme="dark"] .pos-product-card,
[data-bs-theme="dark"] .pos-cart-panel {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .kpi-card .kpi-title,
[data-bs-theme="dark"] .pos-product-card .prod-sku {
  color: #94a3b8;
}

[data-bs-theme="dark"] .kpi-card .kpi-usd,
[data-bs-theme="dark"] .admin-card .card-header .card-title {
  color: #f8fafc;
}

[data-bs-theme="dark"] .pos-product-card:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

[data-bs-theme="dark"] .pos-product-card .img-placeholder {
  background: #0f172a;
  color: #60a5fa;
}

[data-bs-theme="dark"] .pos-product-card .prod-price {
  color: #60a5fa;
}

[data-bs-theme="dark"] .cart-item-row {
  border-bottom-color: #334155;
}

[data-bs-theme="dark"] .cart-qty-btn {
  background: #0f172a;
  border-color: #475569;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .cart-qty-btn:hover {
  background: #334155;
}

[data-bs-theme="dark"] table.dataTable thead th {
  background-color: #0f172a;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] .table > :not(caption) > * > * {
  color: #e2e8f0;
  border-color: #334155;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #1e293b;
  --bs-table-color: #e2e8f0;
  --bs-table-border-color: #334155;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
  background-color: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

[data-bs-theme="dark"] .login-card {
  background: #1e293b;
  color: #f1f5f9;
}

[data-bs-theme="dark"] .login-header-ip {
  background: #0f172a;
  border-bottom-color: #334155;
}

[data-bs-theme="dark"] .login-header-ip .ip-text {
  color: #60a5fa;
}

/* Override hardcoded light utilities inside Dark theme */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
  background-color: #1e293b !important;
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .text-dark {
  color: #f1f5f9 !important;
}

[data-bs-theme="dark"] .btn-light {
  background-color: #1e293b;
  border-color: #475569;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .btn-light:hover {
  background-color: #334155;
  border-color: #64748b;
  color: #ffffff;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-top {
  border-color: #334155 !important;
}

[data-bs-theme="dark"] #root-active-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%) !important;
  color: #e0f2fe !important;
}

[data-bs-theme="dark"] .modal-content {
  background-color: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
  border-color: #334155;
}

[data-bs-theme="dark"] .swal2-popup {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .swal2-title,
[data-bs-theme="dark"] .swal2-html-container {
  color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .swal2-input,
[data-bs-theme="dark"] .swal2-select,
[data-bs-theme="dark"] .swal2-textarea {
  background-color: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

/* =========================================================
   THEME SEGMENTED CONTROL PILL (Light / Dark / System)
   ========================================================= */
.theme-segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background-color: #f1f5f9;
  border: 1px solid #cbd5e1;
}

.theme-segmented-control.theme-segmented-compact {
  border-radius: 999px;
  padding: 2px;
}

.theme-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-segmented-compact .theme-seg-btn {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.theme-seg-btn:hover {
  color: #0f172a;
}

.theme-seg-btn.active {
  background-color: #ffffff;
  color: #0284c7;
  border-color: #cbd5e1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.theme-icon-light {
  color: #f59e0b;
}

.theme-icon-dark {
  color: #818cf8;
}

.theme-icon-system {
  color: #0ea5e9;
}

[data-bs-theme="dark"] .theme-segmented-control {
  background-color: #0f172a;
  border-color: #334155;
}

[data-bs-theme="dark"] .theme-seg-btn {
  color: #94a3b8;
}

[data-bs-theme="dark"] .theme-seg-btn:hover {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .theme-seg-btn.active {
  background-color: #1e293b;
  color: #38bdf8;
  border-color: #475569;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
