/* ============================================================================
   PREMIUM THEME  ·  app-wide refinement layer (loaded LAST)
   ----------------------------------------------------------------------------
   Elevates the existing indigo design system into a smooth, high-end finish:
   a refined canvas, soft layered elevation, custom scrollbars, a glass topbar,
   premium buttons/inputs, and gentle micro-interactions — consistently across
   every screen.

   VISUAL ONLY. No markup, no behaviour, no backend/formula changes. It rides on
   top of the app's own CSS, so it deliberately keeps to surfaces, colour,
   shadow, radius and motion — never layout maths or content.
   ============================================================================ */

:root {
  /* Soft, layered elevation scale */
  --pt-sh-xs: 0 1px 2px rgba(16,24,40,.05);
  --pt-sh-sm: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --pt-sh-md: 0 6px 16px rgba(16,24,40,.09), 0 2px 5px rgba(16,24,40,.05);
  --pt-sh-lg: 0 16px 34px rgba(16,24,40,.13), 0 5px 12px rgba(16,24,40,.07);
  --pt-ring:  0 0 0 3px rgba(79,70,229,.18);
  --pt-ease:  cubic-bezier(.4, 0, .2, 1);
  /* Refined neutral surfaces */
  --pt-canvas: #f5f7fb;
  --pt-border: #e7eaf3;
  --pt-ink:    #0f172a;
  --pt-muted:  #64748b;
}

/* ── Canvas & typography ─────────────────────────────────────────────────── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.006em;
  text-rendering: optimizeLegibility;
}
body.bg-light { background: var(--pt-canvas); }
/* A whisper-soft indigo glow up top so the page reads crafted, not flat. */
#main-content {
  background:
    radial-gradient(1100px 300px at 82% -6%, rgba(99,102,241,.06), transparent 60%),
    var(--pt-canvas);
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -.015em; color: var(--pt-ink); }
::selection { background: rgba(99,102,241,.20); }

/* ── Custom scrollbars — slim & premium ──────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: #c4cad9 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c4cad9; border-radius: 999px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #a7afc6; background-clip: content-box; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); background-clip: content-box; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); background-clip: content-box; }
.sidebar { scrollbar-color: rgba(255,255,255,.18) transparent; }

/* ── Topbar — subtle frosted glass ───────────────────────────────────────── */
.topbar {
  background: rgba(255,255,255,.82) !important;
  backdrop-filter: saturate(1.35) blur(10px);
  -webkit-backdrop-filter: saturate(1.35) blur(10px);
  border-bottom: 1px solid rgba(16,24,40,.06) !important;
}

/* ── Cards — refined surface + gentle lift (skips gradient KPI tiles) ─────── */
.list-page .card:not(.border-0),
.form-page .card {
  box-shadow: var(--pt-sh-sm);
  transition: box-shadow .22s var(--pt-ease), border-color .22s var(--pt-ease), transform .22s var(--pt-ease);
}
.list-page .card:not(.border-0):hover { box-shadow: var(--pt-sh-md); }

/* ── Buttons — premium depth, smooth press, crisp focus ──────────────────── */
.btn { transition: transform .12s var(--pt-ease), box-shadow .2s var(--pt-ease),
                    background .2s var(--pt-ease), border-color .2s var(--pt-ease), color .2s var(--pt-ease); }
.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-info, .btn-dark,
.btn-secondary { box-shadow: 0 1px 2px rgba(16,24,40,.10); }
.btn-primary:hover, .btn-success:hover, .btn-danger:hover, .btn-warning:hover,
.btn-info:hover, .btn-dark:hover, .btn-secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16,24,40,.18);
}
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.btn:focus-visible { box-shadow: var(--pt-ring) !important; outline: none; }
.btn-sm { border-radius: 9px; }

/* ── Inputs — premium focus ring ─────────────────────────────────────────── */
.form-control, .form-select {
  transition: border-color .15s var(--pt-ease), box-shadow .15s var(--pt-ease);
}
.form-control:focus, .form-select:focus { box-shadow: var(--pt-ring) !important; }

/* ── Tables — calm refined header, soft hover ────────────────────────────── */
.table thead th { letter-spacing: .045em; }
.table-hover tbody tr { transition: background .12s var(--pt-ease); }
.table-hover tbody tr:hover { background: #f5f7ff; }

/* ── Badges / status pills — soft premium ────────────────────────────────── */
.badge { border-radius: 7px; font-weight: 600; letter-spacing: .01em; }

/* ── Alerts — soft tinted, rounded ───────────────────────────────────────── */
.alert { border: 1px solid transparent; border-radius: 12px; box-shadow: var(--pt-sh-xs); }
.alert-success { background: #ecfdf5 !important; border-color: #a7f3d0 !important; color: #065f46 !important; }
.alert-danger  { background: #fef2f2 !important; border-color: #fecaca !important; color: #9f1239 !important; }
.alert-warning { background: #fffbeb !important; border-color: #fde68a !important; color: #92400e !important; }
.alert-info    { background: #eff6ff !important; border-color: #bfdbfe !important; color: #1e40af !important; }
.alert-light   { background: #fbfcfe !important; border-color: var(--pt-border) !important; }

/* ── Dropdowns & modals — refined elevation ──────────────────────────────── */
.dropdown-menu { border: 1px solid var(--pt-border); border-radius: 12px; box-shadow: var(--pt-sh-lg); }
.dropdown-item { border-radius: 8px; }
.modal-content { border: 0; border-radius: 16px; box-shadow: var(--pt-sh-lg); }
.modal-header, .modal-footer { border-color: var(--pt-border); }
.offcanvas { border: 0 !important; }

/* ── Tinted section headers — a richer, colour-led hierarchy ─────────────── */
.list-page .card:not(.border-0) > .card-header,
.form-page .card > .card-header {
  background: linear-gradient(180deg, #f3f5ff 0%, #eaeefb 100%) !important;
  border-bottom: 1px solid #e1e7f8 !important;
  color: #1e2452 !important;
  font-weight: 700;
}
/* A slim indigo accent bar on the left of every section header. */
.list-page .card:not(.border-0) > .card-header { box-shadow: inset 3px 0 0 var(--primary); }
.list-page .card:not(.border-0) > .card-header .bi,
.form-page .card > .card-header .bi { color: var(--primary); }

/* ── Richer accent — deeper indigo energy on primary elements ────────────── */
.btn-primary:hover, .btn-primary:focus {
  box-shadow: 0 8px 20px rgba(79, 70, 229, .34) !important;
}
.list-page .table thead th { color: #4b5573; }
.nav-pills .nav-link.active, .badge.bg-primary { box-shadow: 0 2px 8px rgba(79,70,229,.28); }
/* Section title accents used on dashboards & reports. */
.section-title, .rep-cat-title, .po-section-title { color: var(--primary-dark, #4338CA) !important; }

/* ── Links ───────────────────────────────────────────────────────────────── */
a { transition: color .15s var(--pt-ease); }

/* ── Motion respect ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; animation: none !important; }
}

/* ── Print: strip the premium canvas so documents stay clean ─────────────── */
@media print {
  body.bg-light, #main-content { background: #fff !important; }
  .topbar { display: none !important; }
}
