/* ============================================================================
 * EPAL GROUP ERP  ·  css/elevation.css
 * ----------------------------------------------------------------------------
 * WORLD-CLASS ELEVATION PASS — styles added in the elevation sprint:
 * data-table chrome, form validation states, drill-down affordances, premium
 * 404, POS layout, print/report styles and deeper responsive polish.
 * (Loaded after components.css; see CHANGELOG.md for what changed and why.)
 * ==========================================================================*/

/* ------------------------------------------------------------ Data table */
.dt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; }
.dt-search-wrap { position: relative; min-width: 220px; flex: 0 1 300px; }
.dt-search-wrap .dt-search { padding-left: 34px; }
.dt-search-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); font-size: 14px; }
.dt-filter { width: auto; min-width: 130px; max-width: 190px; padding-top: 9px; padding-bottom: 9px; }
.dt-count { font-size: var(--fs-tiny); color: var(--text-mute); font-weight: 600; white-space: nowrap; }
.dt-th.sortable:hover { color: var(--text); }
.dt-sort-ico { font-size: 9px; color: var(--accent); }
.dt-actions { white-space: nowrap; text-align: left; width: 1%; }

/* half-width search when quick chips / filter panel are in use */
.dt-search-wrap.half { flex: 0 1 360px; min-width: 200px; }
/* quick-filter chips (a column's values as toggle buttons) */
.dt-chips { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.dt-chip { padding: 6px 13px; border-radius: 999px; font-size: var(--fs-small); font-weight: 600; cursor: pointer;
  color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); transition: all var(--t-fast); white-space: nowrap; }
.dt-chip:hover { border-color: var(--border-strong); color: var(--text); }
.dt-chip.active { background: var(--accent); color: #fff; border-color: transparent; }
/* Filter button active state + count pill */
.dt-filter-btn.has { border-color: var(--border-accent); color: var(--accent); }
.dt-filter-n { display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; margin-left: 2px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: var(--fs-micro); font-weight: 700; }
/* the Filter card — opens on the left, medium width */
.dt-filter-card { display: none; max-width: 440px; margin: 0 0 14px auto; padding: 16px 18px;   /* margin-left auto → opens on the RIGHT, under the Filter button */
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-card); }
.dt-filter-card.open { display: block; animation: dt-fc-in .18s var(--e-out, ease); }
@keyframes dt-fc-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.dt-fc-label { font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-mute); margin: 12px 0 7px; }
.dt-fc-label:first-child { margin-top: 0; }
.dt-fc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dt-fc-row .dt-filter { min-width: 150px; }
.dt-fc-custom .dt-date { width: 150px; padding: 8px 10px; }
.dt-fc-sub { font-size: var(--fs-tiny); color: var(--text-mute); font-weight: 600; }
.dt-preset { padding: 7px 13px; border-radius: var(--r-sm); font-size: var(--fs-small); font-weight: 600; cursor: pointer;
  color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); transition: all var(--t-fast); }
.dt-preset:hover { border-color: var(--accent); color: var(--accent); }
.dt-fc-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }
/* toolbar for the manual tableCard lists (air-ticketing / visa) — search + export */
.tc-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; }
.dt-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; }
.dt-pager { display: flex; gap: 4px; }
.dt-page-btn { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; display: inline-grid; place-items: center;
  font-size: var(--fs-small); font-weight: 600; color: var(--text-dim); border: 1px solid var(--border); transition: all var(--t-fast); }
.dt-page-btn:hover { border-color: var(--border-strong); color: var(--text); }
.dt-page-btn.active { background: var(--accent); color: #fff; border-color: transparent; }

/* ------------------------------------------------------- Form validation */
.input.invalid, .select.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 15%, transparent); }
.field-error { color: var(--bad); font-size: var(--fs-micro); font-weight: 600; min-height: 0; }
.field-error:empty { display: none; }

/* ------------------------------------------------------------ Drill-down */
.kpi-card.drill { cursor: pointer; }
.kpi-card.drill:hover { border-color: var(--accent); }
.kpi-card.drill:hover .kpi-label::after { content: ' →'; color: var(--accent); }

/* ------------------------------------------------------------- 404 page */
.err-404 { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 62vh; text-align: center; }
.err-code { font-family: var(--font-display); font-size: 96px; font-weight: 800; line-height: 1; letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--accent), var(--gold-soft)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.err-404 h2 { margin: 10px 0 6px; }
.err-404 p { color: var(--text-dim); max-width: 380px; margin-bottom: 22px; }

/* ------------------------------------------------------------ POS layout */
.pos-layout { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
.pos-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pos-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 13px;
  cursor: pointer; transition: all var(--t-fast); text-align: left; }
.pos-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.pos-item.out { opacity: .45; pointer-events: none; }
.pos-item .pos-name { font-weight: 600; font-size: var(--fs-small); line-height: 1.3; min-height: 33px; }
.pos-item .pos-price { font-family: var(--font-mono); font-weight: 700; color: var(--accent); margin-top: 6px; }
.pos-cart { position: sticky; top: 10px; }
.pos-line { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-small); }
.pos-qty { display: flex; align-items: center; gap: 6px; }
.pos-qty button { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); font-weight: 700; }
.pos-total { display: flex; justify-content: space-between; padding: 6px 0; font-size: var(--fs-body); }
.pos-total.grand { font-size: var(--fs-lead); font-weight: 800; border-top: 1px solid var(--border-strong); padding-top: 12px; margin-top: 6px; }

/* --------------------------------------------------------- Health pills */
.health { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-tiny); font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.health::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.health.g { color: var(--good); background: var(--good-soft); }
.health.y { color: var(--warn); background: var(--warn-soft); }
.health.r { color: var(--bad);  background: var(--bad-soft); }

/* ---------------------------------------------------------- Mini modules */
.subnav-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 20px; }

/* ------------------------------------------------------------- Print (reports) */
@media print {
  .rail, .sidebar, .topbar, .page-actions, .dt-toolbar, .dt-foot, .toast-host, .pos-cart button { display: none !important; }
  body, .app { background: #fff !important; overflow: visible !important; height: auto !important; }
  .main { display: block; }
  .content { overflow: visible; padding: 0; }
  .card, .kpi-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .tbl thead th { background: #f3f3f3 !important; color: #333 !important; }
  * { color: #111 !important; }
}

/* -------------------------------------------------- Deeper responsive polish */
@media (max-width: 900px) {
  /* narrow: relax the five-abreast cap to three and let the auto-fit minimum do
     the rest — overriding grid-template-columns here would drop the cap entirely */
  .kpi-grid { --kpi-cols: 3; --kpi-gap: 10px; }
  .kpi-value { font-size: var(--fs-h3); }
  .pos-layout { grid-template-columns: 1fr; }
  .page-title { font-size: var(--fs-h3); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2 { grid-column: span 1; }
  .modal-lg, .modal-xl { width: 100%; }
}
@media (max-width: 560px) {
  .kanban { grid-auto-columns: 85vw; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-actions { justify-content: stretch; }
  .page-actions .btn { flex: 1; }
  .dt-toolbar { gap: 8px; }
  .dt-search-wrap { flex: 1 1 100%; }
}
