/* ============================================================
   OTT Engine — Free Tools Hub stylesheet
   Loaded ONLY by /tools, /tools/page-2, and /tools/<tool> pages.
   Site-wide tokens (colors, navbar, footer, blog cards) live in
   style.css and are referenced via CSS custom properties.
   ============================================================ */

/* ---------- Tool category tag colours (extends blog-tag) ---------- */
.blog-tag-encoding   { color: #67e8f9; }
.blog-tag-production { color: #fcd34d; }
.blog-tag-captions   { color: #c4b5fd; }
.blog-tag-streaming  { color: #93c5fd; }
.blog-tag-adops      { color: #fca5a5; }
.blog-tag-planning   { color: #86efac; }

/* ---------- Tool thumb gradients (extends blog-thumb) ---------- */
.blog-thumb-encoding   { background: linear-gradient(135deg, #082f49 0%, #0e7490 100%); }
.blog-thumb-production { background: linear-gradient(135deg, #422006 0%, #b45309 100%); }
.blog-thumb-captions   { background: linear-gradient(135deg, #2e1065 0%, #7c3aed 100%); }
.blog-thumb-streaming  { background: linear-gradient(135deg, #0c1844 0%, #1d4ed8 100%); }
.blog-thumb-adops      { background: linear-gradient(135deg, #450a0a 0%, #b91c1c 100%); }
.blog-thumb-planning   { background: linear-gradient(135deg, #052e16 0%, #15803d 100%); }

/* ---------- Tools-hub trust line / privacy badge ---------- */
.tool-trust {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  border-radius: 100px;
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
}
.tool-trust .bi { font-size: 0.95rem; }

/* ---------- Tool surface (container for the calculator UI) ---------- */
.tool-surface {
  background: var(--ott-bg-card);
  border: 1px solid var(--ott-border);
  border-radius: 14px;
  padding: 1.75rem;
}
@media (max-width: 575.98px) {
  .tool-surface { padding: 1.25rem; }
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 767.98px) {
  .tool-grid { grid-template-columns: 1fr; }
}

.tool-grid-1-2 { grid-template-columns: 1fr 1.4fr; }
@media (max-width: 991.98px) {
  .tool-grid-1-2 { grid-template-columns: 1fr; }
}

/* ---------- Tool form controls ---------- */
.tool-field { margin-bottom: 1rem; }
.tool-field:last-child { margin-bottom: 0; }
.tool-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ott-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.375rem;
}
.tool-help {
  display: block;
  font-size: 0.75rem;
  color: var(--ott-text-secondary);
  margin-top: 0.25rem;
  opacity: 0.85;
}
.tool-input,
.tool-select,
.tool-textarea {
  background: var(--ott-bg-dark);
  border: 1.5px solid var(--ott-border);
  border-radius: 8px;
  color: var(--ott-text-primary);
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tool-input:focus,
.tool-select:focus,
.tool-textarea:focus {
  outline: none;
  border-color: var(--ott-blue-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.tool-textarea {
  font-family: 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  min-height: 180px;
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}
.tool-select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%2394A3B8' d='M4 6l4 4 4-4z'/></svg>"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem; }
.tool-input::placeholder, .tool-textarea::placeholder { color: var(--ott-text-secondary); opacity: 0.6; }
.tool-input[type="number"] { font-variant-numeric: tabular-nums; }

.tool-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.tool-row-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 575.98px) {
  .tool-row, .tool-row-3 { grid-template-columns: 1fr; }
}

/* ---------- Inline preset chips ---------- */
.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}
.tool-chip {
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  color: var(--ott-text-secondary);
  border-radius: 100px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.tool-chip:hover { color: var(--ott-text-primary); border-color: rgba(59,130,246,0.4); }
.tool-chip.active { background: rgba(37,99,235,0.15); border-color: var(--ott-blue-primary); color: var(--ott-text-primary); }

/* ---------- Tool segmented control (yes/no toggles, modes) ---------- */
.tool-seg {
  display: inline-flex;
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-radius: 8px;
  padding: 0.25rem;
  gap: 0.25rem;
}
.tool-seg-btn {
  background: transparent;
  border: none;
  color: var(--ott-text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tool-seg-btn:hover { color: var(--ott-text-primary); }
.tool-seg-btn.active { background: var(--ott-blue-primary); color: #fff; }

/* ---------- Result panels ---------- */
.tool-result-card {
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem;
}
.tool-result-card.is-good   { border-left: 3px solid var(--ott-success); }
.tool-result-card.is-warn   { border-left: 3px solid #f59e0b; }
.tool-result-card.is-error  { border-left: 3px solid #ef4444; }
.tool-result-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ott-text-secondary);
  margin-bottom: 0.375rem;
}
.tool-result-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ott-text-primary);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tool-result-sub {
  font-size: 0.875rem;
  color: var(--ott-text-secondary);
  margin-top: 0.375rem;
}

.tool-kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 1.25rem;
  row-gap: 0.5rem;
  font-size: 0.9375rem;
}
.tool-kv dt { color: var(--ott-text-secondary); font-weight: 500; }
.tool-kv dd { color: var(--ott-text-primary); font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Action bar (copy / reset / download) ---------- */
.tool-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ott-bg-card);
  border: 1px solid var(--ott-border);
  color: var(--ott-text-primary);
  border-radius: 8px;
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn-tool:hover { border-color: rgba(59,130,246,0.45); color: var(--ott-text-primary); }
.btn-tool .bi { font-size: 0.95rem; }
.btn-tool-primary {
  background: var(--ott-blue-primary);
  border-color: var(--ott-blue-primary);
  color: #fff;
}
.btn-tool-primary:hover { background: var(--ott-blue-dark); border-color: var(--ott-blue-dark); color: #fff; }
.btn-tool[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* ---------- Tool tables (reference & result tables) ---------- */
.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  color: var(--ott-text-secondary);
}
.tool-table thead th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ott-text-secondary);
  border-bottom: 1px solid var(--ott-border);
  padding: 0.625rem 0.75rem;
  background: var(--ott-bg-surface);
}
.tool-table tbody td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--ott-border);
  color: var(--ott-text-primary);
  font-variant-numeric: tabular-nums;
}
.tool-table tbody tr:last-child td { border-bottom: none; }
.tool-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.tool-table-scroll {
  overflow-x: auto;
  border: 1px solid var(--ott-border);
  border-radius: 10px;
  background: var(--ott-bg-card);
}

/* ---------- Code / pre output ---------- */
.tool-code {
  background: var(--ott-bg-dark);
  border: 1px solid var(--ott-border);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ott-text-primary);
  white-space: pre;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
}
.tool-code .k { color: #93c5fd; }
.tool-code .s { color: #86efac; }
.tool-code .c { color: #64748b; font-style: italic; }
.tool-code .n { color: #fcd34d; }
.tool-code .tag { color: #f472b6; }
.tool-code .attr { color: #93c5fd; }

/* ---------- AEO explainer & FAQ blocks (reusing blog-* style) ---------- */
.tool-explainer h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--ott-text-primary);
}
.tool-explainer h3 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--ott-text-primary);
}
.tool-explainer p,
.tool-explainer li {
  color: var(--ott-text-secondary);
  font-size: 1rem;
  line-height: 1.75;
}
.tool-explainer p { margin-bottom: 1rem; }
.tool-explainer ul, .tool-explainer ol { padding-left: 1.25rem; margin-bottom: 1rem; }
.tool-explainer li { margin-bottom: 0.375rem; }
.tool-explainer strong { color: var(--ott-text-primary); }
.tool-explainer code {
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.85em;
  color: var(--ott-text-primary);
}
.tool-formula {
  display: block;
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-left: 3px solid var(--ott-blue-primary);
  border-radius: 0 8px 8px 0;
  padding: 0.85rem 1.1rem;
  margin: 1rem 0;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--ott-text-primary);
}

/* ---------- Conversion CTA block (sits below tool output) ---------- */
.tool-cta {
  background: linear-gradient(135deg, rgba(37,99,235,0.10) 0%, rgba(96,165,250,0.06) 100%);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.tool-cta-body { flex: 1; min-width: 260px; }
.tool-cta-title { font-size: 1.125rem; font-weight: 700; color: var(--ott-text-primary); margin-bottom: 0.25rem; }
.tool-cta-sub { font-size: 0.95rem; color: var(--ott-text-secondary); margin: 0; }
.tool-cta-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Related tools / reading ---------- */
.related-tool-card {
  background: var(--ott-bg-card);
  border: 1px solid var(--ott-border);
  border-radius: 12px;
  padding: 1.25rem;
  height: 100%;
  transition: border-color 0.2s, transform 0.2s;
  display: block;
}
.related-tool-card:hover {
  border-color: rgba(59,130,246,0.3);
  transform: translateY(-2px);
}
.related-tool-card .blog-tag { font-size: 0.6875rem; }
.related-tool-name { font-size: 1rem; font-weight: 700; color: var(--ott-text-primary); margin: 0.4rem 0 0.25rem; line-height: 1.35; }
.related-tool-desc { font-size: 0.875rem; color: var(--ott-text-secondary); margin: 0; }

/* ---------- Estimator-specific (Cost Calculator) ---------- */
.estimator-plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(37,99,235,0.15);
  border: 1px solid var(--ott-blue-primary);
  color: var(--ott-text-primary);
  border-radius: 100px;
  padding: 0.4rem 0.95rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.estimator-total {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--ott-text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.estimator-total-period {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ott-text-secondary);
  margin-left: 0.25rem;
}
.estimator-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9375rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--ott-border);
}
.estimator-line:last-of-type { border-bottom: none; }
.estimator-line .lbl { color: var(--ott-text-secondary); }
.estimator-line .val { color: var(--ott-text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.estimator-line.total {
  border-top: 1px solid var(--ott-border);
  border-bottom: none;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  font-size: 1.05rem;
}
.estimator-line.total .val { color: var(--ott-text-primary); font-weight: 800; }
.estimator-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
@media (max-width: 575.98px) {
  .estimator-checkbox-grid { grid-template-columns: 1fr; }
}
.estimator-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ott-bg-dark);
  border: 1px solid var(--ott-border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.8125rem;
  line-height: 1.25;
  transition: border-color 0.15s, background 0.15s;
}
.estimator-checkbox:hover { border-color: rgba(59,130,246,0.35); }
.estimator-checkbox input { flex-shrink: 0; accent-color: var(--ott-blue-primary); }
.estimator-checkbox > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.estimator-checkbox .ec-name { color: var(--ott-text-primary); font-weight: 600; font-size: 0.8125rem; }
.estimator-checkbox .ec-price { color: var(--ott-text-secondary); font-size: 0.75rem; margin-left: 0.2rem; white-space: nowrap; }
.estimator-checkbox input:checked ~ * .ec-name,
.estimator-checkbox:has(input:checked) { border-color: var(--ott-blue-primary); background: rgba(37,99,235,0.08); }
.estimator-billing-toggle {
  display: inline-flex;
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-radius: 999px;
  padding: 0.25rem;
}
.estimator-billing-toggle button {
  background: transparent;
  border: none;
  color: var(--ott-text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.estimator-billing-toggle button.active { background: var(--ott-blue-primary); color: #fff; }
.estimator-save-pill {
  display: inline-block;
  background: rgba(16,185,129,0.18);
  color: #6ee7b7;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-left: 0.4rem;
}

/* ---------- Stream-tester video player ---------- */
.tool-player-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ott-border);
  aspect-ratio: 16 / 9;
}
.tool-player-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}
.tool-player-mode {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  color: var(--ott-text-primary);
  border: 1px solid var(--ott-border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.tool-player-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.tool-stat {
  background: var(--ott-bg-surface);
  border: 1px solid var(--ott-border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}
.tool-stat .lbl { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ott-text-secondary); }
.tool-stat .val { font-size: 1rem; font-weight: 700; color: var(--ott-text-primary); font-variant-numeric: tabular-nums; }

/* ---------- Subtitle converter dropzone ---------- */
.tool-drop {
  border: 2px dashed var(--ott-border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  color: var(--ott-text-secondary);
  font-size: 0.9rem;
  background: var(--ott-bg-dark);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.tool-drop.is-over { border-color: var(--ott-blue-primary); background: rgba(37,99,235,0.06); color: var(--ott-text-primary); }
.tool-drop .bi { font-size: 1.5rem; display: block; margin-bottom: 0.4rem; color: var(--ott-text-accent); }

/* ---------- Tool-page hero tweaks (tighter than blog hero) ---------- */
.tools-hero {
  /* Trimmed bottom padding now that the .tool-meta trust banner is gone — keeps
     ~20 px of breathing room between the hero-sub paragraph and the first
     tool-surface card below, instead of the 40 px gap the default left. */
  padding: 3rem 0 0.5rem;
}
/* The browser's default <p> margin-bottom adds 16 px under the hero-sub; zero
   it out so the gap collapses to just the section's top padding. */
.tools-hero .hero-sub:last-child {
  margin-bottom: 0;
}
/* Scope the next section's top padding only when it directly follows the tool
   hero — so the rest of the site (blog, etc.) keeps its existing rhythm. */
.tools-hero + .section-pad {
  padding-top: 0.75rem;
}
.tools-hero .tool-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--ott-text-secondary);
}

/* Diagnostics list (used by stream tester / manifest inspector) */
.tool-diag {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tool-diag li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--ott-border);
  font-size: 0.9rem;
  color: var(--ott-text-secondary);
}
.tool-diag li:last-child { border-bottom: none; }
.tool-diag .bi { flex-shrink: 0; margin-top: 0.2rem; }
.tool-diag .ok  .bi { color: var(--ott-success); }
.tool-diag .warn .bi { color: #f59e0b; }
.tool-diag .err  .bi { color: #ef4444; }

/* Aspect ratio visual preview */
.ar-preview-wrap {
  background: var(--ott-bg-dark);
  border: 1px solid var(--ott-border);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
/* Outer frame = target. Solid dark fill so the visible "bars" (letterbox /
   pillarbox padding) are clearly distinct from the inner source rect. */
.ar-preview-frame {
  background: #000;
  border: 1px solid var(--ott-border);
  position: relative;
  max-width: 100%;
  max-height: 220px;
  transition: width 0.18s ease, height 0.18s ease;
}
/* Inner rect = scaled source positioned inside the target frame. JS sets
   left/right/top/bottom percentages so the gap reveals the bars. */
.ar-preview-frame .ar-inner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37,99,235,0.30), rgba(96,165,250,0.18));
  border: 1px solid var(--ott-blue-primary);
  transition: left 0.18s ease, right 0.18s ease, top 0.18s ease, bottom 0.18s ease;
}

/* Loudness meter bar */
.loud-bar {
  position: relative;
  height: 28px;
  background: var(--ott-bg-dark);
  border: 1px solid var(--ott-border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.5rem;
}
.loud-bar-fill {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  background: linear-gradient(90deg, rgba(16,185,129,0.4), rgba(37,99,235,0.5));
  transform-origin: left center;
}
.loud-bar-target {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #f59e0b;
}
.loud-bar-axis {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--ott-text-secondary);
  margin-top: 0.25rem;
}

/* Mobile: smaller body padding for tool-explainer */
@media (max-width: 575.98px) {
  .tool-explainer h2 { font-size: 1.2rem; margin-top: 1.75rem; }
  .tool-result-value { font-size: 1.4rem; }
  .estimator-total { font-size: 2rem; }
  .tool-cta { padding: 1.25rem; }
}
