/* ============================================================================
   Wajibati design system — portable CSS
   Drop this file into any project: <link rel="stylesheet" href="wajibati-design.css">
   Themes: set <html data-theme="light|gray|mocha|dark"> (default: light).
   Everything is driven by the CSS variables below, so a new brand color = change --brand.
   ============================================================================ */

/* ---------- 1. Color tokens: four themes ---------- */
:root, [data-theme="light"] {
  /* Steel: #10161C #1F2C38 #33475A #4E6A83 #8199AE #B7C6D3 #E7EDF2 */
  --bg: #e7edf2;        /* page background */
  --card: #f8fafc;      /* cards, sheets */
  --card-2: #dfe7ee;    /* inputs, secondary buttons, segmented control track */
  --text: #10161c;      /* main text */
  --muted: #6b7f92;     /* secondary text, labels */
  --line: #d3dde6;      /* hairlines, borders */
  --ink: #1f2c38;       /* primary button / selected tab background */
  --ink-text: #ffffff;  /* text on --ink */
  --glass: rgba(248,250,252,.86);
  --hero: linear-gradient(135deg, #1f2c38, #33475a);
  --shadow: 0 14px 34px -10px rgba(31,44,56,.18);
}
[data-theme="gray"] {
  /* Slate & sand: #10232A #3D4D55 #A79E9C #D3C3B9 #B58863 #161616 */
  --bg: #a79e9c; --card: #e6dcd5; --card-2: #d3c3b9; --text: #161616; --muted: #3d4d55; --line: #bfb2aa;
  --ink: #10232a; --ink-text: #f3ece7; --glass: rgba(230,220,213,.86);
  --hero: linear-gradient(135deg, #10232a, #3d4d55); --shadow: 0 14px 34px -10px rgba(16,35,42,.3);
}
[data-theme="mocha"] {
  /* Mocha: #291C0E #6E473B #A78D78 #BEB5A9 #E1D4C2 */
  --bg: #e1d4c2; --card: #f3ece2; --card-2: #d9cbb8; --text: #291c0e; --muted: #6e473b; --line: #cdbfae;
  --ink: #291c0e; --ink-text: #f3ece2; --glass: rgba(243,236,226,.86);
  --hero: linear-gradient(135deg, #291c0e, #6e473b); --shadow: 0 14px 34px -10px rgba(41,28,14,.25);
}
[data-theme="dark"] {
  --bg: #10161c; --card: #1f2c38; --card-2: #263646; --text: #e7edf2; --muted: #8199ae; --line: #2c3d4e;
  --ink: #b7c6d3; --ink-text: #10161c; --glass: rgba(31,44,56,.88);
  --hero: linear-gradient(135deg, #33475a, #4e6a83); --shadow: 0 14px 34px -10px rgba(0,0,0,.6);
}
/* shared by all themes */
:root {
  --brand: #2563eb;                                              /* accent: links, FAB, badges, focus */
  --brand-soft: color-mix(in srgb, var(--brand) 14%, var(--card));
  --danger: #e5484d; --ok: #30a46c; --warn: #d9822b;
  --violet: #a78bfa; --gold: #fbbf24;                            /* decorative (gradients, sparks) */
  /* liquid-glass edges */
  --glass-hi: rgba(255,255,255,.55); --glass-edge: rgba(255,255,255,.35);
  /* shape */
  --r-sm: 14px; --r: 20px; --r-lg: 26px; --r-xl: 34px; --pill: 999px;
  /* motion: iOS-like spring */
  --spring: cubic-bezier(.32,.72,0,1); --ease: cubic-bezier(.22,1,.36,1);
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
[data-theme="dark"] { --glass-hi: rgba(255,255,255,.14); --glass-edge: rgba(255,255,255,.12); }

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased;
  font: 15px/1.6 -apple-system, "SF Arabic", "SF Pro Text", system-ui, "Segoe UI", Tahoma, sans-serif;
  font-feature-settings: "tnum";
  background:
    radial-gradient(120% 60% at 100% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { letter-spacing: -.01em; }
.w-title { font-size: 34px; font-weight: 600; line-height: 1.2; margin: 6px 0 4px; }  /* large page title */
.w-muted { color: var(--muted); }
.w-label { color: var(--muted); font-size: 13px; font-weight: 600; margin: 18px 6px 8px; }

/* ---------- 3. Liquid glass surface (use on bars, docks, floating buttons, sheets) ---------- */
.w-glass {
  background: color-mix(in srgb, var(--card) 62%, transparent);
  backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px var(--glass-edge), 0 10px 30px -12px rgba(15,23,42,.28);
}
@media (prefers-reduced-transparency: reduce) { .w-glass { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card); } }

/* ---------- 4. Cards ---------- */
.w-card { background: color-mix(in srgb, var(--card) 84%, transparent); border-radius: var(--r-lg); padding: var(--s4);
  border: 1px solid color-mix(in srgb, var(--line) 55%, transparent); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 12px 30px -22px rgba(17,17,20,.35); }
.w-hero { background: var(--hero); color: #fff; border-radius: var(--r-lg); padding: 20px; }
.w-hero .w-muted { color: rgba(255,255,255,.75); }
.w-stat small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.w-stat b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.w-panel { border-radius: 28px; padding: 14px; background: color-mix(in srgb, var(--card) 45%, transparent); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- 5. Buttons ---------- */
.w-btn { border: 0; border-radius: var(--pill); padding: 14px 18px; background: var(--ink); color: var(--ink-text); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  transition: transform .35s var(--spring), filter .2s; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 20px -10px rgba(15,23,42,.45); }
.w-btn:active { transform: scale(.95); transition-duration: .12s; }
.w-btn:disabled { opacity: .5; }
.w-btn.ghost { background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.w-btn.brand { background: var(--brand); color: #fff; }
.w-btn.danger { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: var(--danger); }
.w-btn.sm { padding: 7px 13px; font-size: 13px; min-height: 0; }
.w-btn.block { width: 100%; }
.w-icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.w-fab { width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--ink); color: var(--ink-text); font-size: 26px; box-shadow: var(--shadow); cursor: pointer; }

/* ---------- 6. Inputs ---------- */
.w-input, .w-textarea { width: 100%; background: var(--card-2); border: 1px solid transparent; border-radius: var(--r-sm); padding: 12px 14px; outline: none; }
.w-input:focus, .w-textarea:focus { border-color: var(--brand); }
.w-field { display: grid; gap: 6px; margin-bottom: 12px; } .w-field > span { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- 7. Segmented control & chips ---------- */
.w-seg { display: flex; background: var(--card-2); border-radius: var(--pill); padding: 4px; }
.w-seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: var(--pill); color: var(--muted); font-weight: 600; cursor: pointer; transition: all .35s var(--spring); }
.w-seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.w-chip { display: inline-block; border-radius: var(--pill); padding: 3px 11px; font-size: 12px; font-weight: 600; background: var(--card-2); white-space: nowrap; }
.w-chip.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.w-chip.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.w-chip.danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.w-badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- 8. Floating glass dock (bottom tab bar) ---------- */
.w-dock { position: fixed; z-index: 30; inset-inline: 12px; bottom: calc(12px + var(--safe-b)); display: flex; padding: 6px; border-radius: 34px; }
.w-dock button { flex: 1; min-width: 0; border: 0; background: none; color: var(--muted); border-radius: 26px; padding: 7px 4px; display: grid; justify-items: center; gap: 2px;
  font-size: 11px; font-weight: 600; cursor: pointer; transition: background .5s var(--spring), color .5s var(--spring), transform .35s var(--spring); }
.w-dock button.on { background: color-mix(in srgb, var(--ink) 92%, transparent); color: var(--ink-text); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 6px 16px -8px rgba(15,23,42,.6); }
.w-dock button:active { transform: scale(.94); }

/* ---------- 9. Bottom sheet & dialog ---------- */
.w-sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: rgba(10,14,20,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.w-sheet-body { width: 100%; max-height: 90dvh; overflow-y: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 8px 16px calc(24px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  box-shadow: inset 0 1px 0 var(--glass-hi); animation: w-up .55s var(--spring); }
.w-sheet-body::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }

/* ---------- 10. Lists, skeleton, empty state ---------- */
.w-list { display: grid; gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; }
.w-list > * { background: var(--card); padding: 14px 16px; display: flex; align-items: center; gap: 12px; border: 0; text-align: start; width: 100%; }
.w-skeleton { height: 86px; border-radius: var(--r-lg); background: linear-gradient(100deg, var(--card-2) 30%, color-mix(in srgb, var(--card) 70%, #fff) 50%, var(--card-2) 70%) 0 0 / 250% 100%; animation: w-shimmer 1.3s linear infinite; }
.w-empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 12px; color: var(--muted); }
.w-empty .ico { width: 54px; height: 54px; border-radius: 22px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 24px; margin-bottom: 6px; }

/* ---------- 11. Motion ---------- */
.w-rise > * { animation: w-rise .6s var(--ease) both; }
.w-rise > *:nth-child(2) { animation-delay: .05s; } .w-rise > *:nth-child(3) { animation-delay: .1s; } .w-rise > *:nth-child(4) { animation-delay: .15s; } .w-rise > *:nth-child(n+5) { animation-delay: .2s; }
@keyframes w-rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes w-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes w-shimmer { to { background-position: -250% 0; } }
::view-transition-old(root) { animation: .28s var(--spring) both w-vt-out; }
::view-transition-new(root) { animation: .42s var(--spring) both w-vt-in; }
@keyframes w-vt-out { to { opacity: 0; transform: scale(.985); filter: blur(3px); } }
@keyframes w-vt-in { from { opacity: 0; transform: translateY(10px) scale(1.01); filter: blur(3px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
