/* ByteSize Daily Tools — shared stylesheet
   One theme for every page: dark background, purple->teal gradient accent.
   Do not hard-code colors in page markup — use these tokens/classes instead. */

:root {
  --bg: #0f1220;
  --card: #191c2e;
  --card2: #20233a;
  --text: #e8e9f3;
  --muted: #a5a8c4;
  --accent: #7c5cff;
  --accent2: #4dd4c4;
  --border: #2a2e48;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  background-image: radial-gradient(600px 400px at 90% -10%, rgba(124, 92, 255, .18), transparent 60%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 18, 32, .8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 6px;
  min-height: 64px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0f1220;
  font-weight: 800;
}

nav.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  row-gap: 6px;
  position: relative;
}
nav.site a {
  color: var(--muted);
  font-size: .95rem;
}
nav.site a:hover { color: var(--text); }

/* ---------- Category menus (horizontal top bar, click to open) ---------- */
.dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; color: var(--muted); }
.dropdown-toggle:hover, .dropdown.open .dropdown-toggle { color: var(--text); }
.dropdown-toggle .caret { font-size: .6em; transition: transform .15s ease; }
.dropdown.open .dropdown-toggle .caret { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 210px;
  max-width: min(440px, calc(100vw - 24px));
  columns: 190px 2;          /* up to two columns, based on width */
  column-gap: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 16px;
  z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown.flip .dropdown-menu { left: auto; right: 0; }      /* flip when near the right edge */
/* Small pointer so each menu reads as attached to its category. */
.dropdown-menu::before {
  content: "";
  position: absolute;
  top: -6px; left: 20px;
  width: 10px; height: 10px;
  background: var(--card);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.dropdown.flip .dropdown-menu::before { left: auto; right: 20px; }
.dropdown-menu a {
  display: block;
  break-inside: avoid;
  padding: 7px 0;
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}
.dropdown-menu a:hover { color: var(--accent2); }

@media (max-width: 640px) {
  .dropdown-menu { columns: 1; position: fixed; top: 56px; left: 8px; right: 8px; min-width: 0; max-width: none; }
  .dropdown.flip .dropdown-menu { left: 8px; right: 8px; }
  .dropdown-menu::before { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 56px 0 32px;
}
.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 12px;
}
.hero h1 .grad {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Tool grid (homepage) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 24px 0 48px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: transform .15s ease, box-shadow .15s ease;
  color: var(--text);
  display: block;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.tool-card .ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0f1220;
  font-size: 1.2rem;
  margin-bottom: 12px;
}
.tool-card .ic-svg {
  display: block;
  color: #0f1220;
}
.tool-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.tool-card.soon {
  opacity: .6;
  cursor: default;
}

/* ---------- Tool panel ---------- */
main.container {
  flex: 1;
  padding-bottom: 48px;
}

.tool {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 32px;
}
.tool h1 {
  font-size: 1.7rem;
  margin: 0 0 6px;
}
.tool .sub {
  color: var(--muted);
  margin: 0 0 24px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.field {
  flex: 1 1 140px;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: .85rem;
  color: var(--muted);
}

input, select, textarea {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(77, 212, 196, .2);
}

button.go {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 10px;
  color: #0f1220;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 24px;
  cursor: pointer;
}
button.go:hover { filter: brightness(1.08); }

/* ---------- Result ---------- */
.result {
  margin-top: 24px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.result .lbl {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.result .big {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent2);
}
.result table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: .9rem;
}
.result table td {
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.result table td:last-child {
  text-align: right;
  font-weight: 600;
}

/* ---------- Ad slot ---------- */
.ad-slot {
  margin-top: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}
.ad-slot.top { margin-top: 0; margin-bottom: 24px; }

/* ---------- Side rail ad slots (desktop only) ---------- */
.ad-rail {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  height: 600px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: .8rem;
  padding: 12px;
  z-index: 10;
}
.ad-rail-left { left: 16px; }
.ad-rail-right { right: 16px; }
@media (min-width: 1400px) {
  .ad-rail { display: flex; }
}

/* ---------- Content note (SEO explainer) ---------- */
.content-note {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.content-note h2 {
  font-size: 1.25rem;
  margin: 0 0 12px;
}
.content-note p {
  color: var(--muted);
}

/* ---------- Doc pages (About / Privacy / Contact) ---------- */
.doc h1 {
  font-size: 2rem;
  margin-top: 40px;
}
.doc h2 {
  font-size: 1.3rem;
  margin-top: 28px;
}
.doc p, .doc li {
  color: var(--muted);
}

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid var(--border);
  margin-top: auto;
}
footer.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px 20px;
  font-size: .85rem;
  color: var(--muted);
}
footer.site nav {
  display: flex;
  gap: 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  header.site .container { min-height: 56px; }
  .brand .full { display: none; }
  nav.site { gap: 12px; }
  .hero { padding: 40px 0 24px; }
  .hero h1 { font-size: 1.9rem; }
  .row { flex-direction: column; align-items: stretch !important; }
  .row > * { flex-basis: auto !important; min-width: 0 !important; }
  .tool { padding: 20px; }
}

/* ---------- Text tools (case / sort / replace / line breaks) ---------- */
.case-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.case-btns .case { font-size: .9rem; padding: 10px 16px; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.btn-sec {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
}
.btn-sec:hover { border-color: var(--accent2); }
.opt-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.opt-row label { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.opt-row label input { width: auto; }
.counts {
  display: flex; flex-wrap: wrap; gap: 20px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: .9rem; color: var(--muted);
}
.counts b { color: var(--text); font-weight: 700; }
.copied { color: var(--accent2); font-size: .85rem; margin-left: 4px; }

/* Ads hidden for now — no trade licence yet. Markup kept in place; delete this block to re-enable. */
.ad-slot, .ad-rail { display: none !important; }
