/* =========================
   DESIGN SYSTEM
========================= */

:root {
  --bg: #ffffff;
  --surface: #f0f8f590;
  --surface-elevated: #ffffff;
  --text: #111111;
  --muted: #5e5e60;
  --border: #e5e5e7;
  --accent: #00A186;
  --accent-soft: rgba(0,161,134,0.14);
  --accent-hover: #008f77;
  --accent-contrast: #ffffff;
  --radius: 14px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0f0f11;
  --surface: #1c1c1e;
  --surface-elevated: #232326;
  --text: #f5f5f7;
  --muted: #8f8f90;
  --border: #2c2c2e;
  --accent: #33D6B8;
  --accent-soft: rgba(51,214,184,0.18);
  --accent-hover: #24c6a8;
  --accent-contrast: #0f0f11;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

/* =========================
   BASE
========================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 24px 16px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.3s ease-out;
}

/* =========================
   TYPOGRAPHY
========================= */

h1 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}

h2 {
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 1.75rem 0 0.75rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 1.25rem 0 0.5rem;
}

h4 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 1rem 0 0.5rem;
}

p {
  margin: 0 0 20px;
  color: var(--muted);
}

li {
  color: var(--muted);
}

.tool-help {
  font-size: 0.85rem;
  margin-bottom: 12px;
}

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  p, li  { font-size: 0.9rem; }
}

/* =========================
   HEADER & LOGO
========================= */

.site-header {
  width: 85%;
  max-width: 720px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;     /* center main/sub text vertically */
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  text-decoration: none;
  line-height: 1;          /* makes height predictable */
  justify-self: center;
  grid-column: 2;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.logo-main { color: var(--accent); }
.logo-sub  { color: var(--text); margin-left: 2px; }


/* =========================
   TOOL ICONS
========================= */

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.tool-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .tool-icon {
    width: 18px;
    height: 18px;
  }
}

/* =========================
   PRIMARY-LINK (Home / Main Tools)
========================= */

.primary-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  background: var(--surface-elevated);
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-link svg {
  stroke: currentColor;
}

.primary-link:hover {
  background: rgba(0,161,134,0.08); /* subtle tint */
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 0 8px rgba(0,161,134,0.25);
  transform: translateY(-1px);
}

/* =========================
   TIP ICONS
========================= */

.icon-inline {
  display: inline-block;
  stroke-width: 2;
  fill: var(--bg);
  width: 16px;
  height: 16px;
  margin-right: 0px;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(2px); /* adjust for vertical alignment */
}

.icon-ads {
  display: inline-block;
  stroke-width: 2;
  fill: var(--bg);
  width: 20px;
  height: 20px;
  margin-right: 0px;
  stroke: var(--accent);
  transform: translateY(4px); /* adjust for vertical alignment */
}

.icon-h2 {
  display: inline-block;
  stroke-width: 2;
  fill: none;
  width: 24px;
  height: 24px;
  margin-right: 2px;
  stroke: var(--text);
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateY(3px); /* adjust for vertical alignment */
}

.icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

/* =========================
   LAYOUT
========================= */

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* Card - light and dark modes */
.card {
  background: var(--surface-elevated);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.05); /* subtle edge in light mode */
  transition: background 0.25s ease, box-shadow 0.25s ease, border 0.25s ease;
}

.card > :last-child {
  margin-bottom: 0; /* prevent extra bottom gap */
}

/* Light-mode card tweaks */
[data-theme="light"] .card {
  background: #fafafa; /* off-white for contrast */
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: var(--shadow-md);
}

/* Dark-mode card tweaks */
[data-theme="dark"] .card {
  background: var(--surface-elevated);
  border: 1px solid rgba(255,255,255,0.08); /* subtle highlight */
  box-shadow: var(--shadow-md);
}

/* =========================
   LINKS
========================= */

a,
a:visited {
  color: var(--accent);
  text-decoration: none;
}

a:hover { opacity: 0.85; }

/* =========================
   TOOLS LIST SECTION
========================= */

.tools-section .tool-list {
  display: flex;
  flex-direction: column;
  gap: 12px; /* spacing between buttons */
}

/* Base tool buttons (matches original primary-link) */
.tools-section .tool-list a {
  display: inline-flex;      /* align icon + text */
  align-items: center;       /* vertical alignment */
  gap: 8px;                  /* space between icon and text */
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 500;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

/* Hover effect */
.tools-section .tool-list a:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  background: var(--surface-elevated);
}

.tools-section a.primary-link:hover {
  background: rgba(0,161,134,0.08);  /* subtle tint */
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 0 8px rgba(0,161,134,0.2);
  border: 1px solid var(--accent);
  transform: translateY(-1px);
}

/* =========================
   TOOLS SECTION HEADINGS
========================= */
.tools-section h1,
.tools-section h2 {
  display: flex;
  align-items: center;   /* vertical center icon + text */
  gap: 0.3em;            /* spacing between icon and text */
  font-weight: 600;
  margin-bottom: 0.5em;
}

/* icons scale slightly smaller than text for balance */
.tools-section h1 svg {
  width: 1.2em;          /* slightly smaller than h1 text */
  height: 1.2em;
  stroke: currentColor;
  flex-shrink: 0;
}

.tools-section h2 svg {
  width: 1.2em;          /* slightly smaller than h2 text */
  height: 1.2em;
  stroke: currentColor;
  flex-shrink: 0;
}

/* =========================
   FORM CONTROLS (TOOLS)
========================= */

textarea {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: block;

  min-height: 280px;
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);

  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;

  resize: vertical;

  font-size: 16px;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}


/* =========================
   BUTTONS
========================= */

button {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(0,0,0,0.16);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* =========================
   PRIMARY
========================= */

.primary-btn {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.primary-btn:hover {
  background: var(--accent-hover);
}

/* =========================
   SECONDARY
========================= */

.secondary-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* =========================
   TERTIARY
========================= */

.tertiary-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}

.tertiary-btn:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* =========================
   GHOST
========================= */

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}

.ghost-btn:hover {
  background: var(--surface);
  color: var(--text);
}

/* =========================
   TOOL ACTIONS
========================= */

.tool-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.primary-result.has-result {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* =========================
   OUTPUT
========================= */

pre {
  width: 100%;
  max-width: 900px;
  margin: 1rem auto 0;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Real CSV output */
pre[data-state="output"] {
  padding: 1rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-x: auto;
}

/* Error / helper text */
pre[data-state="message"] {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
}

/* =========================
   FOOTER
========================= */

.site-footer {
  margin-top: 20px;
  padding: 20px 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.footer-brand {
  text-decoration: none;
  font-weight: 600; /* optional */
}

.footer-brand .brand-main {
  color: var(--accent);
}

.footer-brand .brand-sub {
  color: var(--text);
}

/* =========================
   ANIMATION
========================= */

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

/* =========================
   BREADCRUMB
========================= */

.breadcrumb {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  color: #666;
}

.breadcrumb a {
  text-decoration: none;
  color: var(--accent);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* =========================
   DIVIDERS
========================= */

.section-divider {
  border: none;
  height: 1px;
  background-color: var(--border);
  margin: 22px 0;
}

/* =========================
   RELATED TOOLS CARD
========================= */

.related-tools-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin: 22px auto;
  border: 1px solid var(--border);
  max-width: 670px;
  text-align: center;
}

.related-tools-card h3 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--text);
}

.related-tools-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.related-tools-card a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.related-tools-card a:hover {
  opacity: 0.85;
}

/* =========================
   GUIDES / CARDS LAYOUT & COLLAPSIBLE
========================= */

/* Intro text */
.guide-intro {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Search box */
.guide-search {
  width: 100%;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.guide-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.guide-search {
  background: var(--surface-elevated);
  color: var(--text);
}

.guide-search::placeholder {
  color: var(--muted);
}

/* Show All / Hide All container */
.guides-toggle-all {
  text-align: right;
  margin-bottom: 0.5rem;
}
.guides-toggle-all button {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.guides-toggle-all button:hover {
  background: var(--accent);
  color: #fff;
}

/* Section */
.guides-section {
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem 0.75rem 0.75rem;
  background: var(--surface);
  transition: background 0.2s, border-color 0.2s;
}

/* Section header with collapse toggle */
.guides-section h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 0.5rem 0;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
}

/* Collapse button */
.guides-section h2 .toggle-btn {
  font-size: 0.85rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.guides-section h2 .toggle-btn:hover {
  background: var(--accent);
  color: #fff;
}

.label-content {
  display: inline-flex;   /* keep icon and text together */
  align-items: center;    /* vertically center icon + text */
  gap: 0.3em;             /* spacing between icon and text */
}

/* Collapsed section hides grid */
.guides-section.collapsed .guide-grid {
  display: none;
}

/* Grid */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}

/* Card */
.guide-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  min-height: 80px;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}

/* Hover & touch highlight */
.guide-card:hover,
.guide-card:active {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Card title */
.guide-card h3 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

/* Tags container under title (clickable filter only) */
.guide-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Individual tags */
.guide-tags .badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 8px;
  background-color: rgba(0, 161, 134, 0.15);
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.guide-tags .badge:hover {
  background-color: var(--accent-soft);
}

.guide-tags .badge.active {
  background-color: var(--accent);
  color: #fff;
}

/* Controls row (search + reset + show/hide) */
.guide-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

/* Responsive: full-width grid for small screens */
@media (max-width: 480px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================
   HEADER GUIDES LINK
========================= */

.header-link {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  grid-column: 3;
  justify-self: end;
  margin-left: auto;
  display: inline-flex;       /* make icon + text align */
  align-items: center;        /* vertical alignment */
  gap: 6px;                   /* space between icon and text */
}

.header-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Mobile: stack link under logo */
@media (max-width: 600px) and (orientation: portrait) {
  .site-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: static;
    padding: 4px 0;
    padding-top: 6px;   /* reduce header top padding */
    padding-bottom: 6px; /* optional, reduce bottom */
  }

  .logo {
    position: static;
    transform: none;
    margin-bottom: 4px;
  }
  
  .header-link {
    margin-left: 0;
  }
}

.header-link svg {
  display: block;
  width: 1em;      /* adjust size for desktop/mobile */
  height: 1em;
  stroke: currentColor;
  flex-shrink: 0;   /* prevent shrinking in flex layout */
  transform: translateY(1px); /* adjust up/down as needed */
}

/* =========================
   PREMIUM SLIDER
========================= */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 12px 0;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text); /* your default text color */
}

.theme-label svg {
  user-select: none;
  display: block;
  width: 1.25em;      /* adjust size for desktop/mobile */
  height: 1.25em;
  stroke: currentColor;
  flex-shrink: 0;   /* prevent shrinking in flex layout */
  transform: translateY(-1px); /* adjust up/down as needed */
}

/* Switch container */
.theme-switch {
  position: relative;
  display: inline-block;
  width: 36px;   /* was 50px */
  height: 20px;  /* was 28px */
}

/* Hide default checkbox */
.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* Slider background */
.theme-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc; /* light track default */
  border-radius: 999px;
  transition: background-color 0.3s;
}

/* Thumb */
.theme-slider::before {
  content: "";
  position: absolute;
  height: 16px;  /* was 24px */
  width: 16px;   /* was 24px */
  left: 2px;
  top: 2px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Checked state */
.theme-switch input:checked + .theme-slider {
  background-color: #00A186;
}

.theme-switch input:checked + .theme-slider::before {
  transform: translateX(16px);
}

/* =========================
   FORM
========================= */

/* Report Issue Form */

#issueForm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

/* Labels */
#issueForm label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.3px;
}

/* Inputs, Select, Textarea */
#issueForm select,
#issueForm textarea,
#issueForm input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

#issueForm textarea {
  resize: vertical;
  min-height: 140px;
}

/* Focus state */
#issueForm select:focus,
#issueForm textarea:focus,
#issueForm input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Submit Button */
#issueForm button {
  align-self: flex-start;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#issueForm button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

#issueForm button:active {
  transform: translateY(0);
}

/* =========================
   CALC INPUTS
========================= */

/* Tool inputs specifically */
input[type="number"],
input[type="text"],
select {
  font-size: 16px;
}

/* =========================
   TOOL TABLE
========================= */

.tool-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tool-table th,
.tool-table td {
  padding: 8px;
  text-align: left;
}

.tool-table th {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  height: 55px; /* or whatever feels right */
  vertical-align: middle; /* ensures text is centered if header wraps */
}

.tool-table tr:not(:last-child) td {
  border-bottom: 1px solid var(--border);
}

.tool-table input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 16px; /* prevent iOS zoom */
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.tool-table input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Center cells and align numbers inside inputs */
.tool-table td {
  text-align: center;
  vertical-align: middle;
}

.tool-table td input[type="number"] {
  width: 75%;        /* fill most of the cell */
  box-sizing: border-box;
  text-align: right; /* numbers inside input aligned right */
}

.tool-table-50-50  th:nth-child(1),
.tool-table-50-50  th:nth-child(1),
.tool-table-50-50  th:nth-child(2),
.tool-table-50-50  th:nth-child(2) {
  width: 50%;
}

.tool-table-33-33-33  th:nth-child(1),
.tool-table-33-33-33  th:nth-child(1),
.tool-table-33-33-33  th:nth-child(2),
.tool-table-33-33-33  th:nth-child(2),
.tool-table-33-33-33  th:nth-child(3),
.tool-table-33-33-33  th:nth-child(3) {
  width: 33%;
}

.tool-table-10-45-45 th:nth-child(1),
.tool-table-10-45-45 td:nth-child(1) {
  width: 10%;
}

.tool-table-10-45-45 th:nth-child(2),
.tool-table-10-45-45 td:nth-child(2) {
  width: 45%;
}

.tool-table-10-45-45 th:nth-child(3),
.tool-table-10-45-45 td:nth-child(3) {
  width: 45%;
}

.tool-table-20-40-40 th:nth-child(1),
.tool-table-20-40-40 td:nth-child(1) {
  width: 20%;
}

.tool-table-20-40-40 th:nth-child(2),
.tool-table-20-40-40 td:nth-child(2) {
  width: 40%;
}

.tool-table-20-40-40 th:nth-child(3),
.tool-table-20-40-40 td:nth-child(3) {
  width: 40%;
}


/* Center checkboxes in their cell */
.tool-table td.checkbox-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

.tool-table td.checkbox-cell input[type="checkbox"] {
  width: auto;        /* prevent full-width from general input styles */
  margin: 0;
  transform: scale(1.4) translateY(10px); /* adjust 1-3px as needed */
  padding: 0;         /* remove padding from general input styles */
  cursor: pointer; /* optional, makes it clear it’s clickable */
}

/* Responsive for mobile */
@media (max-width: 480px) {
  .tool-table td input[type="number"] {
    width: 95%;
  }
}

/* Portfolio result states */
.result-positive {
  color: #16a34a; /* green */
}

.result-negative {
  color: #dc2626; /* red */
}

.result-value {
  font-size: 1.8rem;
  font-weight: 700;
}

.row-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
}

.row-controls button {
  width: 160px;        /* same fixed width */
  text-align: center;
}

.fund-number {
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

/* Centre Fund column header */
.tool-table th:first-child {
  text-align: center;
}

/* Centre Fund column cells */
.tool-table td:first-child {
  text-align: center;
}

.tool-table thead th {
  text-align: center;
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
}

.table-wrapper table {
  width: 100%;
  min-width: 600px; /* optional, prevents the table from collapsing too small */
  border-collapse: collapse;
}

.table-wrapper table {
  border-collapse: collapse;
  width: 100%;
}

.table-wrapper th,
.table-wrapper td {
  border: 1px solid #ddd; /* light gray lines */
  padding: 8px;
}

.table-wrapper th {
  background-color: var(--surface-elevated);
  text-align: left;
}

@media (max-width: 480px) {
  .table-wrapper table {
    font-size: 0.9rem;
  }
}

/* =========================
   BACK TO GUIDES BUTTON
========================= */

.back-to-guides {
  display: flex;
  flex-direction: column;  /* stack everything vertically */
  align-items: center;     /* center horizontally */
  gap: 0px;                /* space between button and link */
  margin: 2.5rem 0;
  font-size: 1rem;      /* sets font size for link text */
}

.back-to-guides button,
.back-to-guides a {
  display: inline-flex;
  align-items: center;     /* vertical alignment for icons */
  gap: 1px;                /* space between icon and text */
  text-decoration: none;
}

.icon-inline-guides {
  display: inline-block;
  stroke-width: 3; 
  width: 16px;
  height: 16px;
  margin-right: 2px;
  color: var(--accent);
  transform: translateY(0px); /* adjust for vertical alignment */
}

/* =========================
   GUIDES
========================= */


.guide-article {
  max-width: 760px;
  margin: 0 auto 30px auto;
  line-height: 1.7;
}

.guide-article h1 {
  margin-bottom: 16px;
}

.guide-article h2 {
  margin-top: 36px;
  margin-bottom: 12px;
}

.guide-article p {
  margin-bottom: 16px;
  color: var(--text);
}

.guide-article ul {
  margin-bottom: 16px;
  padding-left: 20px;
}

.guide-article li {
  margin-bottom: 6px;
  color: var(--text);
}

.guide-article pre {
  background: var(--surface);
  border: 1px solid var(--border);
}

.guide-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
}


/* =========================
   TOOL RESULTS CARD
========================= */

.results {
  margin: 20px 0;
}

.primary-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

/* Remove default paragraph spacing inside card */
.primary-result p {
  margin: 6px 0;
}

/* Top label (e.g. Mortgage Result) */
.result-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

/* Divider under label */
.result-divider {
  border: none;
  height: 1px;
  background: var(--border);
  background-color: rgba(0,161,134,0.14);
  margin: 12px 0 18px;
  width: 100%;
}

/* Large primary number (when used) */
.result-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 10px 0 16px;
}

/* Multi-line result body (mortgage-style outputs) */
.result-body {
  font-size: 1rem;
  line-height: 1.6;
}

/* Placeholder message */
.result-placeholder {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1.6;
}

.result-sub span:last-child {
  font-weight: 600;
}

/* =========================
   MOBILE TYPOGRAPHY
    !NEAR END ALWAYS!
========================= */

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }
  h4 { font-size: 1rem; }
}

/* =========================
   GUIDES SEARCH + RESET FIX
========================= */

/* Keep controls layout stable */
.guide-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Wrap search */
.search-wrapper {
  position: relative;
  flex: 1; /* makes search take remaining space */
}

/* Search input full width */
.search-wrapper .guide-search {
  width: 100%;
  padding-right: 90px; /* room for reset */
  margin-bottom: 0; /* remove default spacing */
}

/* Reset button inside input */
.search-wrapper #resetFilters {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);

  padding: 4px 10px;
  font-size: 0.8rem;
  line-height: 1;

  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);

  box-shadow: none;
}

.search-wrapper #resetFilters:hover {
  background: var(--accent);
  color: #fff;
}

/* Bottom-only reset button styling */
#resetFiltersBottom {
  padding: 6px 12px;          /* slightly bigger */
  font-size: 0.95rem;         /* match top buttons better */
  border-radius: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#resetFiltersBottom:hover {
  background: var(--accent);
  color: #fff;
}

.guides-toggle-all.bottom-reset {
  text-align: right;         /* match top buttons alignment */
  margin: 1rem 0 0 0;        /* some spacing from content above */
}

.button-only {
  display: flex;
  justify-content: center;
}