/* Abdul Traders price tool — light theme with dark-mode tokens */
:root {
  --bg-1: #f5f7fb;
  --bg-2: #e4eaf4;
  --card: rgba(255, 255, 255, 0.78);
  --ink: #1b2333;
  --muted: #6b7385;
  --line: #e2e7f0;
  --field: #ffffff;
  --accent: #2b6e8c;
  --accent-soft: rgba(43, 110, 140, 0.16);
  --navy-1: #3a5577;
  --navy-2: #1c3150;
  --red: #c4343e;
  --red-soft: #fde9eb;
  --row-hover: #f3f7fb;
  --row-sel: #e6f2f9;
  --total-bg: #f2f5fa;
  --shadow: 0 18px 50px rgba(31, 45, 70, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-1: #0f1420; --bg-2: #161d2c;
    --card: rgba(24, 31, 46, 0.82);
    --ink: #e8edf6; --muted: #98a2b8; --line: #2a3347;
    --field: #1d2538; --accent: #6fb8d6; --accent-soft: rgba(111, 184, 214, 0.18);
    --row-hover: #1f2739; --row-sel: #203247; --total-bg: #1b2334;
    --red: #ff7b84; --red-soft: #3a1f25;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  --bg-1: #0f1420; --bg-2: #161d2c;
  --card: rgba(24, 31, 46, 0.82);
  --ink: #e8edf6; --muted: #98a2b8; --line: #2a3347;
  --field: #1d2538; --accent: #6fb8d6; --accent-soft: rgba(111, 184, 214, 0.18);
  --row-hover: #1f2739; --row-sel: #203247; --total-bg: #1b2334;
  --red: #ff7b84; --red-soft: #3a1f25;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: radial-gradient(900px 500px at 8% -8%, rgba(255,255,255,.9), transparent 60%),
              linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}
main {
  max-width: 980px; margin: 36px auto; padding: 30px 30px 26px;
  background: var(--card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.6); border-radius: 24px; box-shadow: var(--shadow);
}
h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 15px; letter-spacing: .02em; margin: 26px 0 12px; color: var(--ink); }
.sub, .muted { color: var(--muted); font-size: 14px; }

/* Inputs */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
input, select {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink);
  padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line);
  background-color: var(--field); box-shadow: inset 0 1px 2px rgba(20,30,50,.05);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%236b7385' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 16px center;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder { color: #a3aabb; }
.center input, .center select { text-align: left; font-weight: 600; }
.length-row { display: grid; grid-template-columns: 1fr 130px; gap: 10px; }

/* Summary + expression */
.info { margin: 22px 0 14px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.info b { color: var(--ink); font-weight: 650; }
.info .rate { display: inline-block; margin-left: 10px; padding: 3px 12px; border-radius: 999px; background: var(--total-bg); color: var(--ink); font-size: 14px; }
.info .holes { display: inline-block; margin-left: 10px; padding: 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.expr {
  position: relative; padding: 20px 24px; border-radius: 20px; text-align: center;
  font-size: 17px; letter-spacing: .01em; color: #e9eef7;
  background: linear-gradient(135deg, var(--navy-1), var(--navy-2));
  box-shadow: 0 14px 34px rgba(28, 49, 80, .35), inset 0 1px 0 rgba(255,255,255,.12);
  overflow: hidden;
}
.expr::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.12) 50%, transparent 70%);
  transform: translateX(-100%); animation: expr-sheen 4s ease-in-out 1s infinite;
}
@keyframes expr-sheen { 0%,55% { transform: translateX(-100%);} 100% { transform: translateX(100%);} }
.expr .amt { color: #ffd1d5; font-weight: 750; }
.copy-row { display: flex; justify-content: flex-end; margin-top: 10px; }
.copy {
  font: inherit; font-size: 13px; color: var(--muted); cursor: pointer;
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--field);
  transition: color .2s, border-color .2s;
}
.copy:hover { color: var(--accent); border-color: var(--accent); }

/* Compatible products table */
.table-wrap { border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--field); box-shadow: 0 8px 26px rgba(31,45,70,.07); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { padding: 14px 14px; text-align: center; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th.head {
  padding: 14px; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, #5a6b84, #3f5069);
}
th.head + th.head { border-left: 1px solid rgba(255,255,255,.18); }
th.brand-pick { cursor: pointer; transition: filter .2s, box-shadow .2s; }
th.brand-pick:hover { filter: brightness(1.12); }
th.brand-pick.active { box-shadow: inset 0 -4px 0 #9fd8ef; }
td.dotcell { width: 56px; }
td { color: var(--ink); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
tr.clickable { cursor: pointer; transition: background .18s; }
tr.clickable:hover td { background: var(--row-hover); }
tr.sel td { background: var(--row-sel); }
tr.rail td { font-weight: 700; }
tr.rail td.rail-price { font-size: 20px; color: var(--accent); background: var(--accent-soft); }
tr.rail.sel td.rail-price { background: var(--accent-soft); }
.rail-tag {
  display: inline-block; margin-top: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: var(--accent); color: #fff;
}
tr.total td { background: var(--total-bg); font-weight: 750; font-size: 18px; }
.warn { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 600; }

/* Selection bubble: empty ring by default, glossy pulsing ball when selected */
.dot {
  position: relative; display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  background: var(--field); border: 1.5px solid #c3cad8; transition: border-color .2s;
}
.dot.on {
  border-color: #1b4a5e;
  background: radial-gradient(circle at 32% 30%, #ffffff 0 10%, #7cc3e0 26%, #2b6e8c 66%, #173f52 100%);
  animation: bubble-pulse 1.6s ease-out infinite;
}
.dot.on::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.85) 50%, transparent 65%);
  background-size: 250% 100%; animation: bubble-shine 2.4s linear infinite;
}
@keyframes bubble-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(43,110,140,.55); transform: scale(1); }
  60%  { box-shadow: 0 0 0 9px rgba(43,110,140,0); transform: scale(1.12); }
  100% { box-shadow: 0 0 0 0 rgba(43,110,140,0); transform: scale(1); }
}
@keyframes bubble-shine { 0% { background-position: 150% 0; } 100% { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .dot.on, .dot.on::after, .expr::after { animation: none; } }

/* Links and buttons */
.setup-link {
  display: inline-block; margin-top: 26px; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg-1); text-decoration: none; font-size: 14px; font-weight: 600;
}
.setup-link:hover { opacity: .88; }
button.primary {
  font: inherit; font-weight: 600; color: #fff; border: 0; cursor: pointer;
  padding: 12px 22px; border-radius: 14px; background: linear-gradient(135deg, #3a7d9c, #1f4f7a);
  box-shadow: 0 10px 22px rgba(31,79,122,.3); transition: transform .15s, box-shadow .2s;
}
button.primary:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(31,79,122,.35); }
button.small { font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer; }

/* Setup page panels */
.panel { background: var(--field); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 18px; box-shadow: 0 6px 20px rgba(31,45,70,.06); }
.row { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.row.three { grid-template-columns: 2fr 1fr 2fr auto; }
.chips span { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 12px; margin: 3px; font-size: 14px; font-weight: 600; }
.chips button { border: 0; background: none; color: var(--red); cursor: pointer; font-weight: 700; margin-left: 6px; }
.status { margin-left: 12px; font-size: 14px; color: var(--muted); }

@media (max-width: 640px) {
  main { margin: 0; min-height: 100vh; border-radius: 0; padding: 20px 16px; }
  .grid { grid-template-columns: 1fr; }
  .length-row { grid-template-columns: 1fr 110px; }
  h1 { font-size: 22px; }
  th, td { padding: 10px 6px; font-size: 14px; }
  th.head { font-size: 11px; }
  tr.total td { font-size: 15px; }
  .expr { font-size: 15px; padding: 16px; }
  .row, .row.three { grid-template-columns: 1fr; }
}
