
/*
 * Beta 3.0 UI primitives — minimal liquid-glass (chrome surfaces only) + brand stat cards.
 * Layered ON TOP of beta-modern.css; never applied to print/numeric-flow areas.
 * Tokens mirror beta-modern.css (brand #241f21 / yellow #ffe512).
 */
@layer components {
  /* glass surface — subtle, single-composite, AA-safe (text stays on solid white) */
  .aa-glass {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(36, 31, 33, 0.08);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    -webkit-backdrop-filter: blur(10px) saturate(1.08);
    backdrop-filter: blur(10px) saturate(1.08);
  }

  /* branded page-header band (Tailwind-era sibling of beta-modern's .beta-page-head) */
  .aa-pagehead {
    display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
    background: #241f21; border-bottom: 3px solid #ffe512; border-radius: 16px;
    padding: 16px 20px; margin: 0 0 20px; color: #fff;
  }
  .aa-pagehead h1, .aa-pagehead h2, .aa-pagehead h3 { margin: 0; font-weight: 800; line-height: 1.15; color: #fff !important; }
  .aa-pagehead .aa-sub { color: #ffe512; font-size: 13px; font-weight: 600; margin-top: 2px; }

  /* KPI stat card */
  .aa-stat {
    display: flex; align-items: center; gap: 14px; padding: 18px 20px;
    text-decoration: none; color: inherit; transition: box-shadow .15s ease, transform .15s ease;
  }
  .aa-stat:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.10); transform: translateY(-1px); text-decoration: none; color: inherit; }
  .aa-stat__icon {
    width: 52px; height: 52px; border-radius: 14px; flex: none;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    background: #fff8cc; color: #241f21;
  }
  .aa-stat--hot .aa-stat__icon { background: #ffe512; }
  .aa-stat__value { font-size: 30px; font-weight: 800; line-height: 1; color: #241f21; }
  .aa-stat__label { font-size: 13px; font-weight: 600; color: #6b6b6b; margin-top: 5px; }
  .aa-stat__more { font-size: 12px; font-weight: 700; color: #241f21; margin-top: 6px; display: inline-block; }
  .aa-stat__more:after { content: " \2192"; }

  /* 4-column responsive stat card grid: 2 cols on mobile, 4 on ≥768px */
  .aa-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
  }

  /* monogram avatar (replaces external gstatic placeholder) */
  .aa-monogram {
    width: 96px; height: 96px; border-radius: 9999px; margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: #241f21; color: #ffe512; font-size: 36px; font-weight: 800; letter-spacing: .02em;
  }

  /* status / ageing chip */
  .aa-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 9999px;
    font-size: 12px; font-weight: 700; line-height: 18px;
  }
  .aa-chip--ok { background: #e9f7ef; color: #1e7e34; }
  .aa-chip--warn { background: #fff4d6; color: #8a6d00; }
  .aa-chip--bad { background: #fde8e8; color: #b00020; }
}

/*
 * EB-UI-16 — contrast guardrails + accessible glass. UNLAYERED on purpose: an unlayered rule wins
 * over @layer components, so these reliably override .aa-glass without depending on source order.
 * Brand yellow #ffe512 is ~1.27:1 on white (invisible) — never use it as text on a light surface.
 * Use .aa-on-brand (yellow text only on its own dark band) or .aa-fill-accent (yellow fill, dark ink).
 */
.aa-on-brand {           /* brand-yellow text is ONLY legible on this enforced dark background */
  background: #241f21;
  color: #ffe512;
  padding: 2px 8px;
  border-radius: 8px;
}
.aa-fill-accent {        /* yellow fill with FORCED dark ink (AA-safe ~14:1) — for accent buttons/badges */
  background: #ffe512 !important;
  color: #241f21 !important;
  border-color: #e6cf00 !important;
}
.aa-fill-accent a, .aa-fill-accent .aa-fill-accent__text { color: #241f21 !important; }

/*
 * Kunal decision #1: glass is a DESKTOP-only flourish. On touch devices (Android WebView field use)
 * the blur janks low-end GPUs and the 72% translucency loses contrast in glare — so go fully opaque.
 */
@media (pointer: coarse) {
  .aa-glass {
    background: #ffffff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
/* Respect user reduced-transparency / reduced-motion (a11y) — opaque, no animated lift. */
@media (prefers-reduced-transparency: reduce) {
  .aa-glass { background: #ffffff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .aa-stat { transition: none; }
  .aa-stat:hover { transform: none; }
}
@media (min-width: 768px) {
  .aa-stat-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

/*
 * EB-UI-18 — phone/godown-friendly tables. Additive: enhances existing .table with NO markup change.
 * (Sticky header deferred — the fixed navbar needs a measured top-offset; tracked separately.)
 */
.aa-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive { -webkit-overflow-scrolling: touch; }   /* momentum scroll inside BS3 wrappers too */

@media (pointer: coarse) {
  /* ~44px row tap targets — tables are the busiest godown lookup + QC surfaces */
  .table > tbody > tr > td,
  .table > tbody > tr > th,
  .table > thead > tr > th { padding-top: 12px; padding-bottom: 12px; }

  /* EB-UI-23 — finger-friendly controls on phones (panel: btn-xs 4x9px, ~30px pagination, 13px checkbox).
     Coarse-pointer only, so desktop density is untouched. */
  .btn, .btn-xs, .btn-sm { min-height: 40px; padding-top: 9px; padding-bottom: 9px; }
  .pagination > li > a, .pagination > li > span { padding: 10px 15px; }
  .form-control { min-height: 42px; }
  input[type="checkbox"], input[type="radio"] { transform: scale(1.4); margin: 0 6px; }
}

/*
 * EB-UI-24 (a11y) — a VISIBLE keyboard/barcode-scanner focus ring (WCAG 2.4.7). Field users tab through
 * forms and trigger rows with Enter-emitting scanners; the default browser outline is faint/none on many
 * BS3-styled controls. Brand-yellow, high-contrast, :focus-visible so mouse clicks don't show it.
 */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid #ffe512;
  outline-offset: 2px;
  border-radius: 3px;
}

/* EB-UI-22 — branded empty state (a blank table reads as broken; this reads as intentional). */
.aa-empty { text-align: center; padding: 28px 20px; }
.aa-empty__icon { font-size: 38px; color: #c9c9c9; margin-bottom: 10px; }
.aa-empty__title { font-weight: 700; color: #241f21; font-size: 16px; }
.aa-empty__msg { color: #6b6b6b; font-size: 13px; margin-top: 4px; }
.aa-empty__action { margin-top: 12px; }

/*
 * EB-UI-25 — Tailwind `tw-` utilities (compiled-equivalent, hand-authored).
 * The documented build step (`npx tailwindcss@3 -c tailwind.config.js -i resources/css/beta3-tw.css
 * -o public/css/beta3-tw.css`) was never run, so `@tailwind utilities` produced nothing and every
 * `tw-*` class in the Blade views resolved to zero rules — grids/flex silently collapsed to block flow.
 * These are the exact utilities Tailwind v3 emits for the classes actually used across the 17 views
 * (prefix tw-, preflight off). Re-running the compile regenerates the same output and may replace this block.
 */
.tw-grid { display: grid; }
.tw-flex { display: flex; }
.tw-flex-wrap { flex-wrap: wrap; }
.tw-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.tw-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tw-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tw-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tw-gap-2 { gap: 0.5rem; }
.tw-gap-3 { gap: 0.75rem; }
.tw-gap-4 { gap: 1rem; }
.tw-m-0 { margin: 0; }
.tw-mb-0 { margin-bottom: 0; }
.tw-mb-3 { margin-bottom: 0.75rem; }
.tw-mb-4 { margin-bottom: 1rem; }
.tw-mb-6 { margin-bottom: 1.5rem; }
.tw-mt-3 { margin-top: 0.75rem; }
.tw-mt-6 { margin-top: 1.5rem; }

/* responsive variants (Tailwind default breakpoints: sm=640px, lg=1024px) */
@media (min-width: 640px) {
  .sm\:tw-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:tw-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
