/* ============================================================
   QuickTools — premium UI stylesheet (v2)
   Complements Tailwind (Play CDN). No @apply is used here
   because the Tailwind Play CDN does not process this file.
   ============================================================ */

:root {
  --brand: #2563eb;
  --brand-2: #4f46e5;
  --brand-dark: #1d4ed8;
  --ring: rgba(59, 130, 246, 0.45);
  --card: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.6);
  --shadow-soft: 0 10px 30px -14px rgba(15, 23, 42, 0.20);
  --shadow-lift: 0 28px 60px -26px rgba(30, 64, 175, 0.5);
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #0f172a;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  background-color: #f5f7fc;
  background-image:
    radial-gradient(900px 520px at 6% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(820px 500px at 102% -4%, rgba(56, 189, 248, 0.16), transparent 55%),
    radial-gradient(760px 520px at 50% 118%, rgba(236, 72, 153, 0.10), transparent 60%);
  background-attachment: fixed;
}

h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, sans-serif; letter-spacing: -.02em; }

/* ---------- SPA view transitions ---------- */
.view { animation: viewIn 0.32s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.view.hidden { display: none !important; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes floaty {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -8px; }
}

@keyframes blobFloat {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  33%  { transform: translate3d(46px, -34px, 0) scale(1.14); }
  66%  { transform: translate3d(-34px, 26px, 0) scale(0.92); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes shine {
  0%        { transform: translateX(-140%) skewX(-15deg); }
  60%, 100% { transform: translateX(240%) skewX(-15deg); }
}

/* ---------- Hero (animated mesh) ---------- */
.qt-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0b1224 0%, #111a35 45%, #1b2a63 100%);
}
.qt-hero::before,
.qt-hero::after {
  content: "";
  position: absolute;
  border-radius: 9999px;
  filter: blur(72px);
  opacity: 0.62;
  pointer-events: none;
  z-index: 0;
}
.qt-hero::before {
  width: 540px; height: 540px; top: -190px; left: -130px;
  background: radial-gradient(circle at 30% 30%, #3b82f6, transparent 66%);
  animation: blobFloat 16s ease-in-out infinite;
}
.qt-hero::after {
  width: 470px; height: 470px; bottom: -210px; right: -110px;
  background: radial-gradient(circle at 60% 40%, #8b5cf6, transparent 66%);
  animation: blobFloat 22s ease-in-out infinite reverse;
}
.qt-hero > * { position: relative; z-index: 1; }

.animate-float { animation: floaty 4.6s ease-in-out infinite; }

/* ---------- Primary button ---------- */
.btn-primary {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  color: #fff; font-weight: 700; font-size: 1rem; letter-spacing: .01em;
  padding: .85rem 1.4rem; border-radius: 1rem; border: 1px solid rgba(255, 255, 255, .16);
  cursor: pointer; min-height: 48px;
  background-image: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 120%);
  box-shadow: 0 14px 30px -12px rgba(79, 70, 229, .65), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .18s ease, box-shadow .25s ease, filter .2s ease;
}
.btn-primary::before {
  content: ""; position: absolute; top: 0; left: 0; width: 45%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-140%) skewX(-15deg);
}
.btn-primary:hover::before { animation: shine .9s ease; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -16px rgba(79, 70, 229, .8); }
.btn-primary:active { transform: scale(.96); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring), 0 14px 30px -12px rgba(79, 70, 229, .65); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; filter: grayscale(.25); }

/* ---------- Secondary / copy button ---------- */
.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: linear-gradient(180deg, #ffffff, #f8fafc); color: #1e293b;
  font-weight: 600; font-size: .875rem;
  padding: .55rem .95rem; border-radius: .8rem; border: 1px solid rgba(15, 23, 42, .12);
  cursor: pointer; min-height: 40px;
  box-shadow: 0 4px 12px -8px rgba(15, 23, 42, .4);
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
}
.btn-secondary:hover { background: #fff; border-color: rgba(59, 130, 246, .5); box-shadow: 0 10px 22px -14px rgba(37, 99, 235, .6); }
.btn-secondary:active { transform: scale(.94); }
.btn-secondary:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn-secondary.copied,
.btn-secondary.copied:hover {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-color: transparent; color: #fff;
  transform: scale(.94);
  box-shadow: 0 10px 24px -12px rgba(22, 163, 74, .7);
}

/* ---------- Inputs ---------- */
.input {
  width: 100%; font-size: 1rem; color: #0f172a;
  background: rgba(255, 255, 255, .85);
  padding: .8rem 1rem; border: 1px solid rgba(15, 23, 42, .10); border-radius: 1rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input::placeholder { color: #94a3b8; }
.input:hover { border-color: rgba(15, 23, 42, .18); }
.input:focus {
  outline: none; background: #fff; border-color: #3b82f6;
  box-shadow: 0 0 0 4px var(--ring), inset 0 1px 2px rgba(15, 23, 42, .04);
}
textarea.input { resize: vertical; line-height: 1.65; }
.input:disabled { background: #f1f5f9; color: #94a3b8; }
select.input { cursor: pointer; }

/* ---------- Tool cards (glassmorphism) ---------- */
.tool-card {
  position: relative; display: block; height: 100%; overflow: hidden;
  padding: 1.6rem; border-radius: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--shadow-soft);
  transition: transform .3s cubic-bezier(.22, .61, .36, 1), box-shadow .3s ease, border-color .3s ease;
}
.tool-card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(59, 130, 246, .6), rgba(168, 85, 247, .5), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0; transition: opacity .3s ease; pointer-events: none;
}
.tool-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lift); border-color: rgba(191, 219, 254, .9); }
.tool-card:hover::after { opacity: 1; }
.tool-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring), var(--shadow-lift); }

/* ---------- Nav ---------- */
.nav-link {
  position: relative; padding: .5rem .85rem; border-radius: .7rem; font-weight: 600;
  color: #334155; font-size: .95rem;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}
.nav-link:hover { color: #0f172a; background: rgba(148, 163, 184, .16); }
.nav-link.active {
  color: #1d4ed8;
  background: linear-gradient(135deg, rgba(59, 130, 246, .14), rgba(99, 102, 241, .14));
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .28);
}

/* ---------- Ad slots (hidden unless activated by core.js) ---------- */
.ad-slot { display: none; }
/* Reserved height when active -> prevents layout shift (CLS) as AdSense fills the slot */
.ad-slot.is-active { display: block; min-height: 100px; }
@media (min-width: 768px) { .ad-slot.is-active { min-height: 280px; } }
/* Dev-only opt-in box: add data-debug="1" to preview placement */
.ad-slot[data-debug="1"] {
  display: block; border: 2px dashed rgba(148, 163, 184, .7); background: #eef2f7;
  border-radius: 1rem; min-height: 100px; color: #64748b; text-align: center;
  padding: 1.4rem; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
}

/* ---------- Result cards (name grid + fancy rows) ---------- */
.result-row,
.fancy-card {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: .85rem; padding: .7rem .9rem;
  box-shadow: 0 6px 16px -12px rgba(15, 23, 42, .4);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.result-row:hover,
.fancy-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, .35);
  box-shadow: 0 12px 26px -16px rgba(37, 99, 235, .55);
}
.result-row { animation: fadeUp .45s cubic-bezier(.22, .61, .36, 1) both; }
.result-row:nth-child(1) { animation-delay: .02s; }
.result-row:nth-child(2) { animation-delay: .07s; }
.result-row:nth-child(3) { animation-delay: .12s; }
.result-row:nth-child(4) { animation-delay: .17s; }
.result-row:nth-child(5) { animation-delay: .22s; }
.result-row:nth-child(6) { animation-delay: .27s; }
.result-row:nth-child(7) { animation-delay: .32s; }
.result-row:nth-child(8) { animation-delay: .37s; }
.result-row:nth-child(9) { animation-delay: .42s; }
.result-row:nth-child(10) { animation-delay: .47s; }
.result-text {
  flex: 1; min-width: 0; font-size: 1.12rem; font-weight: 700;
  color: #0f172a; word-break: break-word;
}

/* ---------- Fancy text stagger (built by JS inside #ftOutputs) ---------- */
#ftOutputs.fancy-stagger > .fancy-card { animation: fadeUp .45s cubic-bezier(.22, .61, .36, 1) both; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(1) { animation-delay: .02s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(2) { animation-delay: .06s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(3) { animation-delay: .10s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(4) { animation-delay: .14s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(5) { animation-delay: .18s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(6) { animation-delay: .22s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(7) { animation-delay: .26s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(8) { animation-delay: .30s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(9) { animation-delay: .34s; }
#ftOutputs.fancy-stagger > .fancy-card:nth-child(10) { animation-delay: .38s; }

/* ---------- Copy chip (icon-only) ---------- */
.copy-btn {
  flex: 0 0 auto; width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: .6rem; border: 1px solid rgba(37, 99, 235, .12);
  background: #eff6ff; color: #2563eb; font-size: .95rem;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, transform .12s ease, border-color .18s ease;
}
.copy-btn:hover { background: #dbeafe; }
.copy-btn:active { transform: scale(.9); }
.copy-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.copy-btn .copy-check { display: none; }
.copy-btn.copied { background: #dcfce7; color: #16a34a; border-color: rgba(22, 163, 74, .25); }
.copy-btn.copied .copy-icon { display: none; }
.copy-btn.copied .copy-check { display: inline-block; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 160%);
  background: linear-gradient(135deg, #0f172a, #1e293b); color: #fff;
  padding: .75rem 1.15rem; border-radius: .85rem; font-size: .9rem; font-weight: 500;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .6);
  z-index: 100; opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1), opacity .3s ease;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Legal / article typography ---------- */
.legal-content h2 { font-size: 1.3rem; font-weight: 700; color: #0f172a; margin: 1.6rem 0 .5rem; }
.legal-content h3 { font-size: 1.05rem; font-weight: 600; color: #1e293b; margin: 1.1rem 0 .4rem; }
.legal-content p  { margin: .6rem 0; line-height: 1.75; }
.legal-content ul, .legal-content ol { margin: .6rem 0 .6rem 1.25rem; line-height: 1.75; }
.legal-content ul { list-style: disc; }
.legal-content ol { list-style: decimal; }
.legal-content a  { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Metric tiles ---------- */
.metric {
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(248, 250, 252, .85));
  border: 1px solid rgba(15, 23, 42, .08); border-radius: 1rem;
  padding: .85rem .95rem; text-align: center;
  box-shadow: 0 8px 22px -18px rgba(15, 23, 42, .45);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.metric:hover { transform: translateY(-2px); border-color: rgba(59, 130, 246, .3); box-shadow: 0 14px 30px -20px rgba(37, 99, 235, .55); }
.metric .value {
  font-size: 1.5rem; font-weight: 800; line-height: 1.15; word-break: break-word;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.metric .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin-top: .15rem; }

/* ---------- Scrollbar ---------- */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Admin panel ---------- */
.admin-tab {
  padding: .55rem 1rem; border-radius: .7rem; font-weight: 600; font-size: .9rem;
  color: #475569; cursor: pointer; border: 1px solid transparent; background: transparent;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.admin-tab:hover { background: #f1f5f9; }
.admin-tab.is-active {
  background: #eff6ff; color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .28);
}
.admin-switch {
  position: relative; flex: 0 0 auto; width: 46px; height: 26px; border-radius: 9999px;
  background: #cbd5e1; cursor: pointer; transition: background .2s ease;
}
.admin-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 9999px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .2s ease;
}
input:checked + .admin-switch { background: #2563eb; }
input:checked + .admin-switch::after { transform: translateX(20px); }

/* ============================================================
   Dark mode (class-based: `html.dark`)
   ============================================================ */
html { color-scheme: light; }
html.dark { color-scheme: dark; }

body, header, footer, .tool-card, .result-row, .fancy-card, .metric, .input, .btn-secondary, .admin-tab, .nav-link {
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

html.dark body {
  color: #e2e8f0;
  background-color: #070b17;
  background-image:
    radial-gradient(900px 520px at 6% -10%, rgba(79, 70, 229, 0.22), transparent 60%),
    radial-gradient(820px 500px at 102% -4%, rgba(14, 165, 233, 0.16), transparent 55%),
    radial-gradient(760px 520px at 50% 118%, rgba(236, 72, 153, 0.12), transparent 60%);
}
html.dark h1, html.dark h2, html.dark h3, html.dark h4 { color: #e2e8f0; }

/* Component overrides */
html.dark .tool-card { background: rgba(15, 23, 42, .72); border-color: rgba(148, 163, 184, .16); box-shadow: 0 14px 34px -22px rgba(0, 0, 0, .85); }
html.dark .tool-card:hover { border-color: rgba(96, 165, 250, .5); }
html.dark .result-row, html.dark .fancy-card { background: linear-gradient(180deg, #0f172a, #0b1220); border-color: rgba(148, 163, 184, .14); }
html.dark .metric { background: linear-gradient(180deg, rgba(15, 23, 42, .95), rgba(11, 18, 32, .9)); border-color: rgba(148, 163, 184, .14); }
html.dark .metric .label { color: #94a3b8; }
html.dark .input { background: rgba(15, 23, 42, .8); color: #e2e8f0; border-color: rgba(148, 163, 184, .22); }
html.dark .input::placeholder { color: #64748b; }
html.dark .input:hover { border-color: rgba(148, 163, 184, .35); }
html.dark select.input option { background: #0f172a; color: #e2e8f0; }
html.dark .btn-secondary { background: linear-gradient(180deg, #1e293b, #0f172a); color: #e2e8f0; border-color: rgba(148, 163, 184, .24); }
html.dark .btn-secondary:hover { background: #1e293b; border-color: rgba(96, 165, 250, .5); }
html.dark .nav-link { color: #cbd5e1; }
html.dark .nav-link:hover { background: rgba(148, 163, 184, .16); color: #fff; }
html.dark .nav-link.active { color: #93c5fd; background: linear-gradient(135deg, rgba(59, 130, 246, .22), rgba(99, 102, 241, .22)); box-shadow: inset 0 0 0 1px rgba(96, 165, 250, .35); }
html.dark .legal-content h2 { color: #e2e8f0; }
html.dark .legal-content h3 { color: #cbd5e1; }
html.dark .legal-content a { color: #93c5fd; }
html.dark #toast { background: linear-gradient(135deg, #1e293b, #0f172a); }
html.dark .ad-slot[data-debug="1"] { background: rgba(30, 41, 59, .6); border-color: rgba(148, 163, 184, .4); }
html.dark .admin-tab { color: #cbd5e1; }
html.dark .admin-tab:hover { background: #1e293b; }
html.dark .admin-tab.is-active { background: #1e293b; color: #93c5fd; }
html.dark .admin-switch { background: #334155; }

/* Tailwind utility overrides used across the pages */
html.dark .bg-gray-50 { background-color: #070b17; }
html.dark .bg-white { background-color: #0f172a; }
html.dark .bg-white\/90 { background-color: rgba(15, 23, 42, .9); }
html.dark .bg-white\/10 { background-color: rgba(255, 255, 255, .06); }
html.dark .bg-gray-100 { background-color: #1e293b; }
html.dark .bg-slate-900 { background-color: #020617; }
html.dark .border-gray-200 { border-color: #1e293b; }
html.dark .border-slate-700 { border-color: #1e293b; }
html.dark .text-slate-900, html.dark .text-slate-800 { color: #e2e8f0; }
html.dark .text-slate-700 { color: #cbd5e1; }
html.dark .text-slate-600, html.dark .text-slate-500, html.dark .text-slate-400 { color: #94a3b8; }
html.dark .text-blue-600, html.dark .text-blue-700 { color: #93c5fd; }
html.dark .text-red-600 { color: #fca5a5; }
html.dark .text-emerald-700, html.dark .text-emerald-800 { color: #6ee7b7; }
html.dark .bg-emerald-50 { background-color: rgba(16, 185, 129, .12); }
html.dark .border-emerald-200 { border-color: rgba(16, 185, 129, .3); }
html.dark .hover\:text-blue-600:hover, html.dark .hover\:text-blue-700:hover { color: #93c5fd; }
html.dark .hover\:bg-gray-100:hover { background-color: #1e293b; }

/* ---------- Print ---------- */
@media print {
  header, footer, .ad-slot, .no-print { display: none !important; }
  body { background: #fff; }
}
