/* =====================================================================
   Ugesi UI kit - facelift v2 (flat / pro)
   Custom form controls shared by every tool page. No dependencies.
   Tokens come from chrome.css (:root). Accent is used ONLY for
   primary actions, links and focus. Everything else is ink on white.
   ===================================================================== */

/* ---- focus ring (every interactive element) ---- */
.ui-check input:focus-visible + .box,
.ui-radio input:focus-visible + .box,
.ui-select select:focus-visible,
.ui-switch input:focus-visible + .track,
.seg button:focus-visible,
.btn:focus-visible,
.btn-generate:focus-visible,
input[type="range"]:focus-visible,
.up-drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =====================  checkbox / radio  ===================== */
.ui-check, .ui-radio {
  display: inline-flex; align-items: flex-start; gap: 10px;
  cursor: pointer; user-select: none; font-size: 14.5px; line-height: 1.45;
  color: var(--text);
}
.ui-check input, .ui-radio input {
  position: absolute; opacity: 0; width: 1px; height: 1px;
}
.ui-check .box, .ui-radio .box {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px;
  border: 1.5px solid var(--line-strong); border-radius: 4px;
  background: var(--panel); display: inline-grid; place-items: center;
  transition: border-color .12s, background .12s;
}
.ui-radio .box { border-radius: 50%; }
.ui-check .box svg { width: 12px; height: 12px; opacity: 0; stroke: #fff; stroke-width: 2.4; fill: none; }
.ui-radio .box::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #fff; transform: scale(0); transition: transform .12s;
}
.ui-check:hover .box, .ui-radio:hover .box { border-color: var(--ink); }
.ui-check input:checked + .box,
.ui-radio input:checked + .box { background: var(--ink); border-color: var(--ink); }
.ui-check input:checked + .box svg { opacity: 1; }
.ui-radio input:checked + .box::after { transform: scale(1); }
.ui-check input:disabled ~ *, .ui-radio input:disabled ~ * { opacity: .45; cursor: not-allowed; }
.ui-check.is-error .box { border-color: var(--danger); }

/* =====================  select  ===================== */
.ui-select { position: relative; display: block; }
.ui-select select {
  -webkit-appearance: none; appearance: none;
  width: 100%; padding: 10px 38px 10px 12px;
  font: inherit; font-size: 14.5px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 8px; cursor: pointer; transition: border-color .12s;
}
.ui-select select:hover { border-color: var(--ink); }
.ui-select::after {
  content: ""; position: absolute; right: 13px; top: 50%;
  width: 9px; height: 9px; pointer-events: none;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.ui-select select:disabled { opacity: .5; cursor: not-allowed; }

/* =====================  segmented control  ===================== */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button {
  font: inherit; font-size: 13.5px; padding: 8px 14px; cursor: pointer;
  background: transparent; border: 0; border-right: 1px solid var(--line);
  color: var(--muted); transition: background .12s, color .12s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover:not(:disabled) { color: var(--ink); background: var(--tint); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.seg .num, .seg button { font-variant-numeric: tabular-nums; }

/* =====================  switch  ===================== */
.ui-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.ui-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ui-switch .track {
  width: 36px; height: 20px; border-radius: 10px; background: var(--line-strong);
  position: relative; transition: background .15s; flex: 0 0 auto;
}
.ui-switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left .15s;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.ui-switch input:checked + .track { background: var(--ink); }
.ui-switch input:checked + .track::after { left: 18px; }

/* =====================  range  ===================== */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
  border-radius: 2px; background: var(--line-strong); cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 2.5px solid #fff; box-shadow: 0 0 0 1px var(--line-strong);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 2.5px solid #fff; box-shadow: 0 0 0 1px var(--line-strong);
}
.range-wrap { display: flex; align-items: center; gap: 14px; }
.range-val { min-width: 44px; text-align: right; font-size: 14px; color: var(--ink); }

/* =====================  upload dropzone  ===================== */
.up-drop {
  position: relative; border: 1.5px dashed var(--line-strong); border-radius: 8px;
  background: var(--panel); padding: 18px 14px; text-align: center;
  transition: border-color .12s, background .12s; cursor: pointer;
}
.up-drop:hover, .up-drop.is-drag { border-color: var(--accent); background: var(--tint); }
.up-drop.is-done { border-style: solid; border-color: var(--ok); }
.up-drop.is-error { border-color: var(--danger); }
.up-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.up-drop .up-ico { display: block; margin: 0 auto 6px; width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 1.6; }
.up-drop .up-cta { font-size: 14px; color: var(--ink); font-weight: 600; }
.up-drop .up-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.up-status { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.up-drop.is-done .up-status { color: var(--ok-ink); font-weight: 600; }
.up-drop .up-thumb { display: none; max-height: 64px; margin: 0 auto 8px; border-radius: 6px; }
.up-drop.is-done .up-thumb { display: block; }
.up-drop.is-done .up-ico { display: none; }
.up-badge-src { display: inline-block; margin-top: 6px; font-size: 12px; padding: 2px 8px;
  border: 1px solid var(--line-strong); border-radius: 999px; color: var(--muted); }

/* =====================  buttons  ===================== */
.btn, .btn-generate {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: 15px; letter-spacing: .01em;
  border-radius: 8px; cursor: pointer; transition: background .12s, border-color .12s, color .12s;
  text-decoration: none;
}
.btn-generate {
  width: 100%; padding: 13px 18px; border: 0;
  background: var(--cta); color: var(--cta-ink);
}
.btn-generate:hover:not(:disabled) { background: var(--cta-strong); }
.btn-generate:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  padding: 9px 14px; background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); font-size: 13.5px;
}
.btn-ghost:hover { border-color: var(--ink); }

/* =====================  text result (prompt tools)  ===================== */
.text-out { display: none; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 16px; }
.text-out.is-on { display: block; }
.text-out h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 10px; }
.text-out pre { white-space: pre-wrap; word-wrap: break-word; font: inherit; font-size: 14.5px;
  line-height: 1.6; color: var(--text); margin: 0 0 12px; }
.text-out .row { display: flex; flex-wrap: wrap; gap: 8px; }

/* =====================  next actions after a result  ===================== */
.next-actions { display: none; margin-top: 12px; }
.next-actions.is-on { display: block; }
.next-actions .na-lbl { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 8px; }
.next-actions .row { display: flex; flex-wrap: wrap; gap: 8px; }

/* =====================  related tools strip  ===================== */
.related-strip { margin: 34px 0 6px; padding-top: 22px; border-top: 1px solid var(--line); }
.related-strip h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 0 0 12px; font-weight: 650; }
.related-strip .row { display: flex; flex-wrap: wrap; gap: 10px; }
.related-strip a {
  display: inline-block; padding: 9px 14px; font-size: 13.5px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px;
  text-decoration: none; transition: border-color .12s;
}
.related-strip a:hover { border-color: var(--accent); color: var(--accent-strong); }

/* ---- RTL (ar/he/ur) ---- */
[dir="rtl"] .ui-select select { padding: 10px 12px 10px 38px; }
[dir="rtl"] .ui-select::after { right: auto; left: 13px; }
[dir="rtl"] .range-val { text-align: left; }
[dir="rtl"] .up-badge-src { direction: rtl; }
