.tool-page { padding: var(--space-2xl) 0 var(--space-4xl); }

/* Tool header */
.tool-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}
.tool-header__icon {
  width: 60px; height: 60px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--color-bg);
  color: var(--color-primary);
}
.tool-header__icon svg { width: 30px; height: 30px; }
.tool-header__icon--calculators { background: var(--cat-calc-bg); color: var(--cat-calc-icon); }
.tool-header__icon--ai-tools    { background: var(--cat-ai-bg);   color: var(--cat-ai-icon); }
.tool-header__icon--pdf-tools   { background: var(--cat-pdf-bg);  color: var(--cat-pdf-icon); }
.tool-header__icon--file-converters { background: var(--cat-file-bg); color: var(--cat-file-icon); }
.tool-header__icon--converters  { background: var(--cat-conv-bg); color: var(--cat-conv-icon); }

.tool-header__title {
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -.03em;
  margin-bottom: var(--space-sm);
}
.tool-header__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.tool-meta-badge {
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}
.tool-header__desc {
  font-size: 1rem;
  color: var(--color-muted);
  max-width: 600px;
}

/* Tool content area */
.tool-content {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

/* Content + Sidebar layout */
.tool-content-section {
  margin-bottom: var(--space-2xl);
}
.tool-content-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--space-2xl);
  align-items: start;
}
.tool-content-main { min-width: 0; }

.tool-sidebar { display: flex; flex-direction: column; gap: var(--space-md); }

.tool-sidebar__content {}
.tool-sidebar__content .sidebar-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.tool-sidebar__content .sidebar-card:last-child { margin-bottom: 0; }
.tool-sidebar__content .sidebar-card h3 {
  font-size: .875rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-md);
}
.tool-sidebar__content .sidebar-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: .8rem;
}
.tool-sidebar__content .sidebar-stat:last-child { border-bottom: none; padding-bottom: 0; }
.tool-sidebar__content .sidebar-stat-label { color: var(--color-muted); }
.tool-sidebar__content .sidebar-stat-val { font-weight: 700; color: var(--color-dark); font-family: var(--font-heading); }
.tool-sidebar__content .sidebar-stat-val.good { color: #166534; }
.tool-sidebar__content .sidebar-stat-val.low  { color: #92400e; }

/* Ad placeholder — shows a dashed box when empty, ready for banner */
.tool-sidebar__ad:not(:empty),
.tool-sidebar__ad[data-ad] {
  border-radius: var(--radius-md);
  overflow: hidden;
}

@media (max-width: 900px) {
  .tool-content-grid { grid-template-columns: 1fr; }
  .tool-sidebar { flex-direction: row; flex-wrap: wrap; }
  .tool-sidebar__content { flex: 1 1 280px; }
  .tool-sidebar__ad { flex: 1 1 280px; }
}

/* Description */
.tool-description {
  margin-bottom: var(--space-2xl);
  font-size: .975rem;
  line-height: 1.8;
  color: var(--color-text);
}
.tool-description h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: var(--space-xl) 0 var(--space-sm);
  color: var(--color-dark);
}
.tool-description h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: var(--space-lg) 0 var(--space-xs);
  color: var(--color-dark);
}
.tool-description p { margin-bottom: var(--space-md); }
.tool-description ul,
.tool-description ol {
  padding-left: 1.5rem;
  margin-bottom: var(--space-md);
}
.tool-description li { margin-bottom: var(--space-xs); }

/* FAQ */
.tool-faq { margin-bottom: var(--space-2xl); }
.tool-faq h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-lg);
}
.faq-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.faq-item {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur);
}
.faq-item[open] { border-color: var(--color-primary); }
.faq-item__q {
  list-style: none;
  padding: var(--space-md) var(--space-lg);
  font-weight: 600;
  font-size: .95rem;
  color: var(--color-dark);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  user-select: none;
  transition: background var(--dur);
}
.faq-item__q:hover { background: var(--color-bg); }
.faq-item__q::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-muted);
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease);
}
.faq-item[open] .faq-item__q::after { transform: rotate(45deg); }
.faq-item__q::-webkit-details-marker { display: none; }
.faq-item__a {
  padding: 0 var(--space-lg) var(--space-md);
  font-size: .9rem;
  color: var(--color-muted);
  line-height: 1.7;
  border-top: 1px solid var(--color-border);
}

/* Related tools */
.related-tools h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-lg);
}

@media (max-width: 640px) {
  .tool-header { flex-direction: column; }
  .tool-content { padding: var(--space-md); }
}

/* ── Calculator component ────────────────────────────────────── */
.calc { display: flex; flex-direction: column; gap: var(--space-xl); }

.calc__body {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: var(--space-xl);
  align-items: start;
}

/* Inputs side */
.calc__inputs { display: flex; flex-direction: column; gap: var(--space-md); }
.calc__inputs-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: var(--space-xs);
}
.calc__field { display: flex; flex-direction: column; gap: 6px; }
.calc__label { font-size: .875rem; font-weight: 600; color: var(--color-text); }
.calc__input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--dur), box-shadow var(--dur);
  background: var(--color-white);
}
.calc__input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.1);
}
.calc__prefix {
  padding: 0 12px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-bg);
  border-right: 1.5px solid var(--color-border);
  height: 44px;
  display: flex;
  align-items: center;
}
.calc__input {
  flex: 1;
  height: 44px;
  padding: 0 var(--space-md);
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-dark);
  background: transparent;
}
.calc__input::placeholder { color: var(--color-border); }

.calc__btn {
  height: 48px;
  background: var(--color-cta);
  color: #fff;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  transition: background var(--dur), transform var(--dur);
  margin-top: var(--space-xs);
}
.calc__btn:hover { background: var(--color-cta-h); transform: translateY(-1px); }
.calc__btn:active { transform: translateY(0); }

.calc__reset {
  height: 36px;
  color: var(--color-muted);
  font-size: .875rem;
  text-align: center;
  transition: color var(--dur);
}
.calc__reset:hover { color: var(--color-primary); }

/* Results side */
.calc__results {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calc__results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-muted);
  text-align: center;
  font-size: .9rem;
  line-height: 1.6;
}
.calc__results-empty svg { opacity: .3; }
.calc__results-data {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.calc__results-header {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--color-muted);
  text-transform: uppercase;
}

.calc__primary-result {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
}
.calc__result-label { font-size: .8rem; font-weight: 600; color: var(--color-muted); }
.calc__result-value {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--color-dark);
  letter-spacing: -.04em;
}
.calc__result-badge {
  font-size: .78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.calc__result-badge--good { background: #DCFCE7; color: #166534; }
.calc__result-badge--warn { background: #FEF9C3; color: #854D0E; }
.calc__result-badge--bad  { background: #FEE2E2; color: #991B1B; }

.calc__secondary-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}
.calc__metric {
  background: var(--color-white);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc__metric-label { font-size: .8rem; color: var(--color-muted); font-weight: 500; }
.calc__metric-value { font-family: var(--font-heading); font-weight: 800; font-size: 1.75rem; color: var(--color-dark); letter-spacing: -.03em; }
.calc__metric--hidden { display: none; }

.calc__note {
  font-size: .85rem;
  background: #EEF2FF;
  color: #3730A3;
  padding: 12px 14px 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: 3px solid var(--color-primary);
  line-height: 1.6;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.calc__note::before {
  content: 'ⓘ';
  flex-shrink: 0;
  font-size: 1rem;
  margin-top: 1px;
}

/* Benchmarks */
.calc__benchmarks {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.calc__benchmarks-title {
  padding: var(--space-md) var(--space-lg);
  font-weight: 700;
  font-size: .875rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-dark);
}
.calc__benchmarks-list { display: flex; flex-direction: column; }
.calc__benchmark {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--dur);
  font-size: .875rem;
}
.calc__benchmark:last-child { border-bottom: none; }
.calc__benchmark--active {
  background: #EEF2FF;
  border-left: 3px solid var(--color-primary);
}
.calc__benchmark-name { color: var(--color-text); }
.calc__benchmark-range { font-weight: 700; color: var(--color-dark); }

@media (max-width: 700px) {
  .calc__body { grid-template-columns: 1fr; }
  .calc__results { min-height: auto; }
  .calc__result-value { font-size: 2.75rem; }
  .calc__secondary-results { grid-template-columns: repeat(3, 1fr); }
}
