/* ==========================================================================
   Markaz-e-ilm — Tasbih counter (tools/tasbih.blade.php)
   A dark green card with gold accents; scoped to .mi-tools .tsb.
   ========================================================================== */
.mi-tools .tsb {
  --tsb-bg: #012062;            /* app navy */
  --tsb-bg-2: #0251B7;          /* app primary blue */
  --tsb-line: rgba(255, 255, 255, .16);
  --tsb-gold: #9cc8ff;          /* highlight: sky blue (was gold) */
  --tsb-gold-2: #ffffff;
  --tsb-ink: #f5f8ff;
  --tsb-muted: #b9cbea;
  --tsb-bead: #17468f;
  position: relative;
  background: radial-gradient(120% 80% at 50% 0%, #0a5bc8 0%, transparent 62%), linear-gradient(165deg, var(--tsb-bg) 0%, #013a8a 55%, var(--tsb-bg-2) 100%);
  color: var(--tsb-ink);
  border-radius: 24px;
  padding: 22px 18px 18px;
  box-shadow: 0 20px 50px rgba(1, 32, 98, .28);
  overflow: hidden;
  margin: 8px 0 12px;
}
.mi-tools .tsb button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Heading */
.mi-tools .tsb-head { text-align: center; margin-bottom: 16px; }
.mi-tools .tsb-head h1 { font-family: var(--mi-font-head); font-size: 1.45rem; font-weight: 700; color: var(--tsb-gold-2); margin: 0 0 6px; }
.mi-tools .tsb-head p { display: inline-block; margin: 0; padding: 4px 12px; border: 1px solid var(--tsb-line); border-radius: 999px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--tsb-muted); }

/* Dhikr picker */
.mi-tools .tsb-pick { position: relative; z-index: 3; }
.mi-tools .tsb-pick-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px 10px 10px; background: rgba(255,255,255,.04); border: 1px solid var(--tsb-line); border-radius: 16px; text-align: left; cursor: pointer; }
.mi-tools .tsb-pick-btn:hover { background: rgba(255,255,255,.07); }
.mi-tools .tsb-pick-ic { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(145deg, var(--tsb-gold-2), var(--tsb-gold)); color: #0251B7; }
.mi-tools .tsb-pick-en { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-tools .tsb-pick-ar { font-size: 1.15rem; color: var(--tsb-gold-2); white-space: nowrap; overflow: hidden; max-width: 45%; }
.mi-tools .tsb-pick-btn .bi-chevron-down { color: var(--tsb-muted); transition: transform .2s; }
.mi-tools .tsb-pick-btn[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.mi-tools .tsb-list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: #0b2f6e; border: 1px solid var(--tsb-line); border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.4); max-height: 320px; overflow-y: auto; }
.mi-tools .tsb-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; outline: none; }
.mi-tools .tsb-list li:hover, .mi-tools .tsb-list li:focus { background: rgba(255,255,255,.07); }
.mi-tools .tsb-list li[aria-selected="true"] { background: rgba(156,200,255,.16); }
.mi-tools .tsb-list .en { flex: 1; min-width: 0; font-size: .92rem; }
.mi-tools .tsb-list .ar { color: var(--tsb-gold-2); font-size: 1.05rem; }
.mi-tools .tsb-list .del { flex: none; border: 0; background: none; color: var(--tsb-muted); padding: 2px 4px; cursor: pointer; }
.mi-tools .tsb-list .add { color: var(--tsb-gold-2); font-weight: 600; font-size: .9rem; border-top: 1px solid var(--tsb-line); border-radius: 0 0 10px 10px; margin-top: 4px; }

/* Ring */
.mi-tools .tsb-ring-wrap { display: flex; justify-content: center; margin: 14px 0 4px; }
.mi-tools .tsb-ring { position: relative; width: min(100%, 320px); aspect-ratio: 1; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; user-select: none; -webkit-user-select: none; }
.mi-tools .tsb-ring:focus-visible { outline: 3px solid var(--tsb-gold); outline-offset: 2px; }
.mi-tools .tsb-ring svg { width: 100%; height: 100%; display: block; }
.mi-tools .tsb-thread { fill: none; stroke: rgba(156,200,255,.25); stroke-width: 2; }
.mi-tools .tsb-progress { fill: none; stroke: var(--tsb-gold); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 0 100; transform: rotate(-90deg); transform-origin: 150px 150px; transition: stroke-dasharray .25s ease; }
.mi-tools .tsb-bead { fill: var(--tsb-bead); stroke: rgba(255,255,255,.08); stroke-width: 1; transition: fill .2s, r .2s; }
.mi-tools .tsb-bead.on { fill: var(--tsb-gold); stroke: rgba(255,255,255,.35); }
.mi-tools .tsb-bead.last { r: 13; fill: var(--tsb-gold-2); }
.mi-tools .tsb-center { position: absolute; inset: 22%; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 50%; background: radial-gradient(circle at 50% 35%, rgba(255,255,255,.06), rgba(0,0,0,.12)); border: 1px solid var(--tsb-line); pointer-events: none; }
.mi-tools .tsb-count { font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 15vw, 4.6rem); line-height: 1; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.mi-tools .tsb-count.pulse { animation: tsbPulse .18s ease-out; }
.mi-tools .tsb-of { margin-top: 6px; font-size: .85rem; color: var(--tsb-ink); }
.mi-tools .tsb-round { font-size: .72rem; color: var(--tsb-muted); }
.mi-tools .tsb-center-ar { margin-top: 6px; font-size: 1.1rem; color: var(--tsb-gold-2); max-width: 90%; text-align: center; line-height: 1.5; }
.mi-tools .tsb.done .tsb-ring { animation: tsbDone .6s ease-out; }
@keyframes tsbPulse { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes tsbDone { 0% { filter: drop-shadow(0 0 0 rgba(156,200,255,0)); } 40% { filter: drop-shadow(0 0 22px rgba(156,200,255,.7)); } 100% { filter: drop-shadow(0 0 0 rgba(156,200,255,0)); } }

.mi-tools .tsb-meaning { text-align: center; color: var(--tsb-muted); font-size: .85rem; margin: 2px 0 14px; min-height: 1.2em; }

/* Tap button */
.mi-tools .tsb-tap { display: flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 280px); margin: 0 auto; padding: 14px 20px; border: 0; border-radius: 999px; background: linear-gradient(180deg, #ffffff, #e7f0ff); color: #0251B7 !important; font-weight: 700; font-size: 1rem; box-shadow: 0 8px 22px rgba(156,200,255,.28); cursor: pointer; transition: transform .08s; }
.mi-tools .tsb-tap:active { transform: scale(.97); }
.mi-tools .tsb-tap:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.mi-tools .tsb-hint { text-align: center; font-size: .72rem; color: var(--tsb-muted); margin: 8px 0 14px; }
.mi-tools .tsb-hint kbd { background: rgba(255,255,255,.1); color: var(--tsb-ink); border-radius: 4px; padding: 1px 5px; font-size: .7rem; }

/* Stats */
.mi-tools .tsb-stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 14px; padding: 12px 0; border-top: 1px solid var(--tsb-line); border-bottom: 1px solid var(--tsb-line); }
.mi-tools .tsb-stats div { text-align: center; }
.mi-tools .tsb-stats div + div { border-left: 1px solid var(--tsb-line); }
.mi-tools .tsb-stats dt { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--tsb-muted); font-weight: 600; }
.mi-tools .tsb-stats dd { margin: 4px 0 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Controls */
.mi-tools .tsb-ctrls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 6px; background: rgba(255,255,255,.03); border: 1px solid var(--tsb-line); border-radius: 18px; margin-bottom: 10px; }
.mi-tools .tsb-ctrls button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 58px; padding: 6px 2px; border: 0; border-radius: 14px; background: none; cursor: pointer; font-size: .7rem; color: var(--tsb-muted); }
.mi-tools .tsb-ctrls button .bi { font-size: 1.05rem; color: var(--tsb-ink); }
.mi-tools .tsb-ctrls button:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.mi-tools .tsb-ctrls button:disabled { opacity: .4; cursor: default; }
.mi-tools .tsb-ctrls button[aria-pressed="false"][data-tsb-sound] .bi { color: var(--tsb-muted); }
.mi-tools .tsb-ctrls .is-target { background: rgba(156,200,255,.14); border: 1px solid rgba(156,200,255,.35); }
.mi-tools .tsb-ctrls .is-target b { font-size: 1rem; color: var(--tsb-gold-2); }

/* Modes */
.mi-tools .tsb-modes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mi-tools .tsb-modes button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--tsb-line); border-radius: 999px; background: none; font-size: .8rem; color: var(--tsb-muted); cursor: pointer; }
.mi-tools .tsb-modes button[aria-pressed="true"] { background: rgba(156,200,255,.16); border-color: rgba(156,200,255,.45); color: var(--tsb-gold-2); }

/* Sheets (target, own dhikr) */
.mi-tools .tsb-sheet { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(1, 14, 44, .72); backdrop-filter: blur(3px); }
.mi-tools .tsb-sheet[hidden] { display: none; }
.mi-tools .tsb-sheet-card { width: min(100%, 340px); padding: 18px; background: #0b2f6e; border: 1px solid var(--tsb-line); border-radius: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.mi-tools .tsb-sheet-card h2 { font-size: 1.05rem; color: var(--tsb-gold-2); margin: 0 0 12px; }
.mi-tools .tsb-targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.mi-tools .tsb-targets button { padding: 10px 0; border: 1px solid var(--tsb-line); border-radius: 12px; background: rgba(255,255,255,.04); font-weight: 700; cursor: pointer; }
.mi-tools .tsb-targets button[aria-pressed="true"] { background: var(--tsb-gold); color: #0251B7; border-color: var(--tsb-gold); }
.mi-tools .tsb-custom { display: block; font-size: .78rem; color: var(--tsb-muted); margin-bottom: 12px; }
.mi-tools .tsb-custom input { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--tsb-line); border-radius: 10px; background: rgba(0,0,0,.2); color: var(--tsb-ink); font-size: 1rem; }
.mi-tools .tsb-custom input:focus { outline: 2px solid var(--tsb-gold); outline-offset: 1px; }
.mi-tools .tsb-sheet-actions { display: flex; gap: 8px; justify-content: flex-end; }
.mi-tools .tsb-ghost, .mi-tools .tsb-solid { padding: 9px 18px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.mi-tools .tsb-ghost { border: 1px solid var(--tsb-line); background: none; }
.mi-tools .tsb-solid { border: 0; background: var(--tsb-gold); color: #0251B7 !important; }

.mi-tools .tsb-note { text-align: center; font-size: .78rem; color: var(--mi-muted); margin: 4px 0 24px; }

/* Focus mode: the counter fills the screen */
html.tsb-locked { overflow: hidden; }
.mi-tools .tsb.is-focus { position: fixed; inset: 0; z-index: 2000; margin: 0; border-radius: 0; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom)); }
.mi-tools .tsb.is-focus > * { width: min(100%, 520px); margin-left: auto; margin-right: auto; }
.mi-tools .tsb.is-focus .tsb-head, .mi-tools .tsb.is-focus .tsb-hint { display: none; }
.mi-tools .tsb.is-focus .tsb-ring { width: min(100%, 420px, 52vh); }
.mi-tools .tsb:fullscreen { width: 100%; height: 100%; }

@media (max-width: 380px) {
  .mi-tools .tsb { padding: 18px 12px 14px; }
  .mi-tools .tsb-ctrls button { font-size: .64rem; }
  .mi-tools .tsb-stats dd { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .mi-tools .tsb-count.pulse, .mi-tools .tsb.done .tsb-ring { animation: none; }
}
