/* =========================================================
   Toolar Tools UI — DARK ONLY (no light mode)
   - Ignores .dark class completely
   - Forces readable high-contrast dark UI
   - Works with Tailwind layout utilities
   ========================================================= */

/* -----------------------------
   1) Dark Design Tokens (always on)
------------------------------ */
:root{
  --bg: #0b1220;
  --fg: #f8fafc;              /* near-white */
  --muted: #cbd5e1;           /* slate-300 */
  --muted-2: #94a3b8;         /* slate-400 */

  --card: rgba(17,24,39,0.72);     /* deep glass */
  --card-border: rgba(255,255,255,0.10);
  --card-shadow: 0 16px 50px rgba(0,0,0,0.55);

  --surface: rgba(255,255,255,0.06);
  --surface-2: rgba(255,255,255,0.09);
  --divider: rgba(255,255,255,0.12);

  --ring: rgba(96,165,250,0.55);   /* blue-400 */
  --blue1: #3b82f6;
  --blue2: #2563eb;
  --indigo1: #6366f1;
  --indigo2: #4f46e5;
  --cyan1: #06b6d4;
  --cyan2: #0891b2;

  --green: #10b981;
  --red: #ef4444;
  --amber: #f59e0b;

  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 12px;

  --pad-lg: 18px;
  --pad-md: 14px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* -----------------------------
   2) Base helpers
------------------------------ */
.tool-ui, .tool-ui *{
  box-sizing: border-box;
  font-family: var(--font-sans);
}

.tool-ui{
  color: var(--fg);
}

.tool-ui .muted{ color: var(--muted); }
.tool-ui .muted-2{ color: var(--muted-2); }

.tool-ui .divider{
  height: 1px;
  background: var(--divider);
  width: 100%;
}

.tool-ui .soft-surface{
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
}

.tool-ui .mono{
  font-family: var(--font-mono);
}

/* Subtle entrance animation */
@media (prefers-reduced-motion: no-preference){
  .tool-ui .fade-in{
    animation: toolFadeIn 240ms ease-out both;
  }
  @keyframes toolFadeIn{
    from{ opacity: 0; transform: translateY(6px); }
    to{ opacity: 1; transform: translateY(0); }
  }
}

/* -----------------------------
   3) Cards
------------------------------ */
.card,
.card-glass{
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--card-shadow);
}

.card-header{
  padding: var(--pad-lg);
  border-bottom: 1px solid var(--divider);
}

.card-body{
  padding: var(--pad-lg);
}

.card-title{
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.card-subtitle{
  color: var(--muted);
  font-weight: 600;
}

/* Hover sheen */
.card-hover{
  position: relative;
  overflow: hidden;
}
.card-hover::before{
  content:"";
  position:absolute;
  inset:-40% -40% auto -40%;
  height: 140%;
  background: radial-gradient(closest-side, rgba(99,102,241,0.20), transparent 70%);
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
.card-hover:hover::before{ opacity: 1; }

/* -----------------------------
   4) Labels / hints / errors
------------------------------ */
.label,
.label-tiny{
  display:block;
  margin-bottom: 8px;
  font-size: 0.70rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-2);
}

.hint{
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
}

.err,
.error{
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--red);
}

/* -----------------------------
   5) Inputs / selects / textarea (dark only)
------------------------------ */
.input,
.input-gloss,
select.input-gloss,
textarea.input-gloss{
  width: 100%;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--fg) !important;
  background: linear-gradient(180deg, rgba(17,24,39,0.88) 0%, rgba(15,23,42,0.88) 100%);
  border: 1px solid rgba(255,255,255,0.16);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}

/* Dropdown text readable */
select.input-gloss{
  color: var(--fg) !important;
}

/* Option color (best effort across browsers) */
select.input-gloss option{
  background: #0b1220;
  color: #f8fafc;
}

.input-gloss:focus,
.input:focus,
select.input-gloss:focus,
textarea.input-gloss:focus{
  box-shadow: 0 0 0 4px var(--ring);
  border-color: rgba(96,165,250,0.7);
}

.input-gloss:active{
  transform: translateY(0.5px);
}

.input-gloss::placeholder{
  color: rgba(148,163,184,0.9);
  font-weight: 600;
}

/* number input nicer */
input[type="number"].input-gloss{
  appearance: textfield;
}
input[type="number"].input-gloss::-webkit-outer-spin-button,
input[type="number"].input-gloss::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

/* -----------------------------
   6) Buttons
------------------------------ */
.btn,
.btn-gloss-blue,
.btn-gloss-indigo,
.btn-gloss-emerald,
.btn-gloss-purple,
.btn-gloss-orange{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-weight: 900;
  letter-spacing: -0.01em;
  transition: transform 120ms ease, box-shadow 180ms ease, filter 180ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  color: #fff !important;
}

.btn-gloss-blue{
  background: linear-gradient(135deg, var(--blue1) 0%, var(--blue2) 100%);
  border-top: 1px solid rgba(255,255,255,0.25);
  box-shadow: 0 12px 26px rgba(37,99,235,0.28);
}

.btn-gloss-indigo{
  background: linear-gradient(135deg, var(--indigo1) 0%, var(--indigo2) 100%);
  border-top: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 12px 26px rgba(79,70,229,0.28);
}

.btn-gloss-emerald{
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-top: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 12px 26px rgba(16,185,129,0.22);
}

.btn-gloss-purple{
  background: linear-gradient(135deg, #9333ea 0%, #7e22ce 100%);
  border-top: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 12px 26px rgba(147,51,234,0.22);
}

.btn-gloss-orange{
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  border-top: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 12px 26px rgba(249,115,22,0.22);
}

.btn-gloss-blue:hover,
.btn-gloss-indigo:hover,
.btn-gloss-emerald:hover,
.btn-gloss-purple:hover,
.btn-gloss-orange:hover{
  filter: brightness(1.03);
}

.btn-gloss-blue:active,
.btn-gloss-indigo:active,
.btn-gloss-emerald:active,
.btn-gloss-purple:active,
.btn-gloss-orange:active{
  transform: scale(0.985);
}

/* Disabled */
.btn[disabled],
button:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

/* -----------------------------
   7) Segmented control
------------------------------ */
.segment{
  display:flex;
  background: var(--surface);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  gap: 6px;
}
.segment button{
  flex: 1;
  padding: 12px 10px;
  border-radius: 12px;
  font-weight: 900;
  font-size: 0.85rem;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease;
}
.segment button.is-active{
  background: rgba(255,255,255,0.08);
  color: #c7d2fe;
  box-shadow: 0 10px 22px rgba(0,0,0,0.30);
}

/* -----------------------------
   8) Result tiles
------------------------------ */
.result-card{
  text-align:center;
  position:relative;
  overflow:hidden;
}
.result-label{
  font-size: 0.70rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.result-value{
  font-size: 3rem;
  font-weight: 950;
  color: #c7d2fe;
  letter-spacing: -0.03em;
  margin-top: 6px;
}
.result-unit{
  font-size: 1rem;
  font-weight: 900;
  color: var(--muted);
}

/* Status colors */
.status-pass{ color: var(--green) !important; }
.status-fail{ color: var(--red) !important; }
.status-warn{ color: var(--amber) !important; }

/* -----------------------------
   9) Rows / tables
------------------------------ */
.row{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}
.row:last-child{ border-bottom: 0; }
.row .left{ color: var(--muted); font-weight: 700; }
.row .right{ color: var(--fg); font-weight: 900; }

.table-lite{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-lite th,
.table-lite td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--divider);
  font-size: 0.95rem;
  color: var(--fg);
}
.table-lite th{
  text-align:left;
  font-weight: 900;
  color: var(--muted);
  background: var(--surface);
}
.table-lite tr:last-child td{ border-bottom: 0; }

/* -----------------------------
   10) Chips
------------------------------ */
.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 950;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(165,180,252,0.14);
  color: #c7d2fe;
  border: 1px solid rgba(165,180,252,0.16);
}

/* -----------------------------
   11) Typography tweaks
------------------------------ */
.tool-ui h1, .tool-ui h2, .tool-ui h3{
  letter-spacing: -0.03em;
  color: var(--fg);
}
.tool-ui p{
  line-height: 1.55;
  color: var(--muted);
}

/* -----------------------------
   12) Utility spacing
------------------------------ */
.pad-lg{ padding: var(--pad-lg); }
.pad-md{ padding: var(--pad-md); }
.round-xl{ border-radius: var(--radius-xl); }
.round-lg{ border-radius: var(--radius-lg); }
.round-md{ border-radius: var(--radius-md); }

/* -----------------------------
   13) HARD OVERRIDES: Tailwind gray text -> readable on dark
   (prevents invisible text like your screenshot)
------------------------------ */
.tool-ui :is(
  .text-gray-50,.text-gray-100,.text-gray-200,.text-gray-300,.text-gray-400,
  .text-gray-500,.text-gray-600,.text-gray-700,.text-gray-800,.text-gray-900,
  .text-slate-50,.text-slate-100,.text-slate-200,.text-slate-300,.text-slate-400,
  .text-slate-500,.text-slate-600,.text-slate-700,.text-slate-800,.text-slate-900,
  .text-zinc-50,.text-zinc-100,.text-zinc-200,.text-zinc-300,.text-zinc-400,
  .text-zinc-500,.text-zinc-600,.text-zinc-700,.text-zinc-800,.text-zinc-900,
  .text-neutral-50,.text-neutral-100,.text-neutral-200,.text-neutral-300,.text-neutral-400,
  .text-neutral-500,.text-neutral-600,.text-neutral-700,.text-neutral-800,.text-neutral-900
){
  color: var(--muted) !important;
}

/* Keep strong emphasis readable */
.tool-ui :is(.font-black,.font-extrabold,.font-bold){
  color: var(--fg);
}
