/* =========================================================
   SPLASH ADMIN — Employee Panel harmonization layer
   Loaded AFTER bootstrap(4).min.css, DataTables(bs4) css and splash.css
   to bridge the Splash (Bootstrap 5) markup with the existing
   Bootstrap 4 + jQuery + DataTables + modal stack.
   ========================================================= */

/* ---- Bootstrap 5 flex/spacing utilities used by Splash markup ---- */
.gap-1 { gap: .25rem !important; }
.gap-2 { gap: .5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.ms-auto { margin-left: auto !important; }
.me-auto { margin-right: auto !important; }
.ms-2 { margin-left: .5rem !important; }
.me-2 { margin-right: .5rem !important; }
.row.g-3 > [class*="col-"],
.row.g-4 > [class*="col-"] { margin-bottom: 1.5rem; }
.flex-column { flex-direction: column !important; }

/* ---- Page rhythm ---- */
.scard + .scard { margin-top: 1.5rem; }

/* ---- Filter form fields inside cards ---- */
.filter-form .form-control-splash { height: 46px; }
.filter-form label { font-family: var(--font-display); font-weight: 600; color: var(--navy); font-size: 13px; margin-bottom: 6px; display: block; }

/* =========================================================
   DataTables — theme the generated controls to match Splash
   ========================================================= */
.dataTables_wrapper { padding: 4px 2px 2px; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter { margin-bottom: 16px; font-family: var(--font-body); color: var(--text); }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 8px 14px;
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  outline: none;
  margin-left: 8px;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--gold);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.dataTables_wrapper .dt-buttons { margin-bottom: 16px; display: inline-flex; flex-wrap: wrap; gap: 8px; }
.dataTables_wrapper .dt-buttons .btn,
.dataTables_wrapper .dt-button {
  background: var(--cream) !important;
  color: var(--navy) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: 11px !important;
  font-family: var(--font-body) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 8px 16px !important;
  box-shadow: none !important;
  transition: var(--t);
}
.dataTables_wrapper .dt-buttons .btn:hover,
.dataTables_wrapper .dt-button:hover {
  background: var(--gold) !important;
  color: var(--on-gold) !important;
  border-color: var(--gold) !important;
}
.dataTables_wrapper .dataTables_info { color: var(--muted); font-size: 13.5px; padding-top: 14px; }
.dataTables_wrapper .dataTables_paginate { padding-top: 16px; }
/* Bootstrap-4 pagination (DataTables + Laravel paginator) — dark + gold */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding-left: 0; list-style: none; }
.pagination .page-item { margin: 0 !important; }
.pagination .page-link {
  min-width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 13px;
  border: 1px solid var(--border) !important;
  background: var(--cream) !important;
  color: var(--gold-light) !important;
  border-radius: 11px !important;
  font-family: var(--font-body);
  font-weight: 700; font-size: 14px;
  box-shadow: none !important;
  transition: var(--t);
}
.pagination .page-link:focus { outline: none; box-shadow: 0 0 0 4px var(--gold-glow) !important; }
.pagination .page-item:not(.active):not(.disabled) .page-link:hover {
  background: var(--surface-2) !important;
  border-color: var(--gold) !important;
  color: #fff !important;
  transform: translateY(-1px);
}
.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, var(--gold), var(--gold-light)) !important;
  border-color: var(--gold) !important;
  color: var(--on-gold) !important;
  box-shadow: 0 8px 18px -5px var(--gold-glow) !important;
}
.pagination .page-item.disabled .page-link {
  background: transparent !important;
  border-color: var(--border) !important;
  color: var(--muted) !important;
  opacity: .55;
  cursor: not-allowed;
}
/* DataTables sort markers shouldn't fight the uppercase head */
table.dataTable thead th { position: relative; }
table.dataTable.table-splash { border-collapse: separate !important; }

/* =========================================================
   MODALS — Splash look on Bootstrap 4 modals
   ========================================================= */
.modal-content {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--text);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  align-items: center;
}
.modal-header .modal-title { font-family: var(--font-display); color: var(--ink); font-weight: 600; font-size: 18px; }
.modal-header .close { color: var(--muted); opacity: 1; text-shadow: none; font-size: 26px; font-weight: 400; }
.modal-header .close:hover { color: var(--pink-hot); }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }
.modal-body label { font-family: var(--font-display); font-weight: 600; color: var(--navy); font-size: 14px; margin-bottom: 8px; display: block; }
/* Sit above the fixed sidebar (z-index 1040) */
.modal { z-index: 1060; }
.modal-backdrop { z-index: 1055; }

/* =========================================================
   SALE BUILDER (create / edit) — split view
   ========================================================= */
.sale-builder-card .scard-body { padding-bottom: 18px; }
.sale-split {
  display: grid;
  grid-template-columns: minmax(220px, 4fr) minmax(360px, 8fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 220px);
}
.sale-split-left,
.sale-split-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sale-split-right {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.sale-cart-scroll {
  flex: 1 1 auto;
  max-height: 38vh;
  overflow: auto;
  margin-bottom: 8px;
}
.sale-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0 4px;
  border-top: 1px solid var(--border);
}
.sale-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.sale-summary-row > span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.sale-summary-row > strong {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 600;
}
.sale-summary-row.grand > span,
.sale-summary-row.grand > strong {
  font-size: 16px;
  color: var(--blue);
}
.sale-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.sale-table thead th {
  background: transparent; color: var(--gold-light);
  font-weight: 800; font-size: 12.5px; letter-spacing: .5px; text-transform: uppercase;
  padding: 12px 18px; border: none; border-bottom: 2px solid rgba(200,152,63,.28); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.sale-table td { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 14.5px; color: var(--text); vertical-align: middle; }
.sale-table tbody tr:hover { background: rgba(200,152,63,.05); box-shadow: inset 3px 0 0 var(--gold); }
.sale-table .sum-row td { font-family: var(--font-display); color: var(--ink); font-weight: 600; background: var(--surface); }
.sale-table .sum-row td.text-right { color: var(--muted); font-family: var(--font-body); font-weight: 700; }
.sale-table .grand td { font-size: 16px; color: var(--blue); }
.sale-type-options { display: inline-flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sale-type-options label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 11px; background: var(--cream);
  border: 1.5px solid var(--border); font-weight: 600; cursor: pointer; margin: 0;
}
.sale-type-options input { accent-color: var(--blue); }
.inline-amount { width: 140px !important; display: inline-block; }
.btn-row-del {
  width: 34px; height: 34px; border-radius: 10px; border: none;
  display: inline-grid; place-items: center;
  background: var(--pink-bg); color: var(--pink-hot);
  font-size: 15px; cursor: pointer; transition: var(--t); text-decoration: none;
}
.btn-row-del:hover { background: var(--pink); color: #fff; }

/* Small helper text colors used inline */
.text-error { color: var(--pink-hot); font-weight: 600; }
.text-ok { color: var(--mint); font-weight: 600; }

/* =========================================================
   PRODUCT PICKER PANEL (inline browse on sale create/edit)
   ========================================================= */
.product-picker-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 420px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pp-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pp-panel-title {
  margin: 0;
  font-size: 16px;
  font-family: var(--font-display);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pp-panel-body {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 8px;
  min-height: 0;
}
.pp-step {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.pp-step[hidden] { display: none !important; }
#picker_categories.product-grid,
#product_grid.product-grid {
  flex: 1 1 auto;
}
.pp-panel-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(200,152,63,.04);
  flex-shrink: 0;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 12px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px;
  min-height: 0;
  max-height: none;
}
.product-tile {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: var(--t);
  background: var(--surface-2, var(--surface));
  text-align: center;
}
.product-tile:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); transform: translateY(-3px); }
.product-tile.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,152,63,.20); background: rgba(200,152,63,.06); }
.product-tile .pt-img {
  width: 100%; height: 72px; border-radius: 10px; overflow: hidden;
  background: var(--cream); display: grid; place-items: center; margin-bottom: 8px;
}
.product-tile .pt-img img { width: 100%; height: 100%; object-fit: cover; }
.product-tile .pt-noimg { font-size: 28px; color: var(--muted); }
.product-tile .pt-name { font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: 13px; line-height: 1.25; }
.product-tile .pt-meta { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.product-tile .pt-price { font-weight: 800; color: var(--blue); font-size: 12.5px; }
.product-tile .pt-code { font-size: 11px; color: var(--muted); background: var(--cream); padding: 1px 7px; border-radius: 20px; }
.product-picker-foot .pp-selected { font-weight: 700; color: var(--text); font-size: 13.5px; flex: 1 1 140px; min-width: 0; }
/* category-first navigation */
.category-tile .pt-img { background: linear-gradient(150deg, var(--mint-soft), var(--pink-bg)); }
.category-tile .pt-noimg { color: var(--blue); }
.btn-pp-back {
  border: none; background: var(--cream); color: var(--navy);
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-grid; place-items: center; margin-right: 4px;
  cursor: pointer; vertical-align: middle; transition: var(--t);
  flex-shrink: 0;
}
.btn-pp-back:hover { background: var(--blue); color: #fff; }
.pp-panel-title .btn-pp-back i { font-size: 16px; }

@media (max-width: 991px) {
  .sale-split {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .product-picker-panel { min-height: 360px; max-height: 55vh; }
  .sale-cart-scroll { max-height: 280px; }
}

/* Make plain bootstrap badges fall back to pills when present */
.badge { font-family: var(--font-body); font-weight: 700; border-radius: 30px; padding: 5px 12px; }

/* =========================================================
   LEGACY BOOTSTRAP FORM CONTROLS — dark theme safety net
   ========================================================= */
.form-control, .custom-select {
  background: var(--cream);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 12px;
}
.form-control:focus, .custom-select:focus {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.form-control::placeholder { color: var(--muted); }
.form-control:disabled, .form-control[readonly] { background: var(--surface); color: var(--muted); }
.input-group-text { border: 1.5px solid var(--border); background: var(--cream); color: var(--muted); }
label { color: var(--text); }
.text-muted { color: var(--muted) !important; }
hr { border-top-color: var(--border); }
