/**
 * V1 / V2 first-screen input template SSOT
 * /token-calculator/ (debug-input.html) · /prompt-optimizer/ (cost/v2.html)
 */

/* —— Page shell —— */
html.page-v1-calculator.page-home .page-v1-calc-section,
html.page-cost-v2 .page-v2-optimizer-section {
  padding: 40px 0 0;
  text-align: left;
}

html.page-v1-calculator.page-home .toket-tool-input-shell,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--toket-layout-shell-x, 20px);
}

html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-shell.v2-input-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding-bottom: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* —— Title block —— */
html.page-v1-calculator.page-home .toket-tool-input-head,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-head {
  margin: 0 0 18px;
  text-align: left;
}

html.page-v1-calculator.page-home .toket-tool-input-head__title,
html.page-v1-calculator.page-home .toket-tool-input-head h1,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-head__title,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-head h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main, var(--toket-text));
}

html.page-v1-calculator.page-home .toket-tool-input-head__desc,
html.page-v1-calculator.page-home .toket-tool-input-head > p:first-of-type,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-head__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--text-secondary);
}

html.page-cost-v2 .page-v2-optimizer-section .v2-input-hero {
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* —— Input card —— */
html.page-v1-calculator.page-home .toket-tool-input-card,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 20px 22px 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.04);
  text-align: left;
  cursor: default;
  pointer-events: auto;
}

html.page-v1-calculator.page-home .toket-tool-input-card.home-product-card:hover,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-card:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.04);
}

html.page-v1-calculator.page-home .toket-tool-input-card.is-busy {
  border-color: color-mix(in srgb, var(--toket-brand, #635bff) 32%, var(--line));
}

:is(html[data-theme="dark"].page-v1-calculator, html.dark.page-v1-calculator) .toket-tool-input-card,
:is(html[data-theme="dark"].page-cost-v2, html.dark.page-cost-v2)
  .page-v2-optimizer-section
  .toket-tool-input-card {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
}

html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-card .v2-input-compose {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

/* —— Textarea —— */
html.page-v1-calculator.page-home .toket-tool-input-textarea,
html.page-cost-v2 .page-v2-optimizer-section textarea#prompt.toket-tool-input-textarea {
  display: block;
  width: 100%;
  height: 128px;
  min-height: 128px;
  margin: 0 0 14px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--toket-input-border, color-mix(in srgb, var(--line) 88%, #9ca3af));
  background: var(--toket-input-bg, color-mix(in srgb, var(--card-bg) 96%, transparent));
  font-family: inherit;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-main);
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html.page-v1-calculator.page-home .toket-tool-input-textarea:focus,
html.page-cost-v2 .page-v2-optimizer-section textarea#prompt.toket-tool-input-textarea:focus {
  border-color: var(--toket-input-border-focus, var(--toket-brand, #635bff));
  box-shadow: var(--toket-focus-ring, 0 0 0 3px color-mix(in srgb, var(--toket-brand, #635bff) 22%, transparent));
}

html.page-v1-calculator.page-home .toket-tool-input-textarea::placeholder,
html.page-cost-v2 .page-v2-optimizer-section textarea#prompt.toket-tool-input-textarea::placeholder {
  color: var(--toket-placeholder, var(--text-secondary));
  opacity: 1;
}

/* —— Type chips —— */
html.page-v1-calculator.page-home .toket-tool-input-chips,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-chips {
  margin: 0 0 14px;
}

html.page-v1-calculator.page-home .toket-tool-input-chips .v1-calc-media-btns,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-chips .v2-media-task-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

html.page-v1-calculator.page-home .toket-tool-input-chip,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--card-bg) 92%, transparent);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

html.page-v1-calculator.page-home .toket-tool-input-chip:hover,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-chip:hover {
  color: var(--text-main);
  border-color: color-mix(in srgb, var(--toket-brand, #635bff) 35%, var(--line));
}

html.page-v1-calculator.page-home .toket-tool-input-chip.is-active,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-chip.is-active {
  color: var(--text-main);
  border-color: color-mix(in srgb, var(--toket-brand, #635bff) 50%, var(--line));
  background: color-mix(in srgb, var(--toket-brand, #635bff) 10%, transparent);
}

/* —— CTA row —— */
html.page-v1-calculator.page-home .toket-tool-input-actions,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
}

html.page-v1-calculator.page-home .toket-tool-input-actions .home-btn,
html.page-v1-calculator.page-home .toket-tool-input-actions .toket-tool-input-submit,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions .toket-tool-input-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  width: auto;
  max-width: none;
  transform: none;
}

/* V1 product-card inherits width:100% on .home-btn — keep CTA inline */
html.page-v1-calculator.page-home .home-product-card.toket-tool-input-card .toket-tool-input-actions .home-btn,
html.page-v1-calculator.page-home .home-product-card.toket-tool-input-card .toket-tool-input-actions .toket-tool-input-submit {
  width: auto !important;
}

/* V2 .btn.btn-main pill styles must not override first-screen CTA */
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions .toket-tool-input-submit.btn.btn-main {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 22px !important;
  border-radius: 12px !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  width: auto !important;
  transform: none !important;
}

/* Removed from default first screen (P3); keep hidden if legacy markup returns */
html.page-cost-v2 .page-v2-optimizer-section .chips-row,
html.page-cost-v2 .page-v2-optimizer-section .prompt-examples {
  display: none !important;
}

html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions .toket-tool-input-submit:hover:not(:disabled) {
  transform: none;
}

html.page-v1-calculator.page-home .toket-tool-input-hint,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* —— Advanced options —— */
html.page-v1-calculator.page-home .toket-tool-input-advanced,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced {
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-bg) 94%, transparent);
  overflow: hidden;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced > summary,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 44px;
  min-height: 44px;
  padding: 0 14px;
  margin: 0;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  list-style: none;
  user-select: none;
  box-sizing: border-box;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced > summary::-webkit-details-marker,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced > summary::-webkit-details-marker {
  display: none;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced > summary::after,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced .v2-adv-summary-caret {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
  opacity: 0.75;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced > summary::after {
  content: "▾";
  transition: transform 0.15s ease;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced:not([open]) > summary::after {
  transform: rotate(-90deg);
}

html.page-v1-calculator.page-home .toket-tool-input-advanced[open],
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced[open] {
  padding-bottom: 12px;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced[open] > summary,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced[open] > summary {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  border-radius: 12px 12px 0 0;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced .v1-calc-advanced__tip,
html.page-v1-calculator.page-home .toket-tool-input-advanced .v1-calc-tabs,
html.page-v1-calculator.page-home .toket-tool-input-advanced .v1-calc-adv-grid,
html.page-v1-calculator.page-home .toket-tool-input-advanced .v1-calc-extra-fields,
html.page-v1-calculator.page-home .toket-tool-input-advanced #videoCountWrap,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced .v2-adv-options-body {
  padding-left: 14px;
  padding-right: 14px;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced .v1-calc-advanced__tip,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced .v2-adv-tip {
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
}

html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced .v2-adv-options-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

html.page-v1-calculator.page-home .toket-tool-input-advanced .v2-input-model-pref,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-advanced .v2-input-model-pref {
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}

/* —— Disclaimer (outside card) —— */
html.page-v1-calculator.page-home .toket-tool-input-disclaimer,
html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-disclaimer {
  margin: 24px 0 32px;
  padding: 0;
  max-width: none;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: center;
}

/* —— V1 status line (not part of template spec; keep compact) —— */
html.page-v1-calculator.page-home .v1-calc-summary {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-secondary);
}

html.page-v1-calculator.page-home .toket-tool-input-card :is(
  button,
  input,
  select,
  textarea,
  summary,
  details
) {
  pointer-events: auto;
}

/* —— Responsive —— */
@media (max-width: 640px) {
  html.page-v1-calculator.page-home .page-v1-calc-section,
  html.page-cost-v2 .page-v2-optimizer-section {
    padding-top: 32px;
  }

  html.page-v1-calculator.page-home .toket-tool-input-head__title,
  html.page-v1-calculator.page-home .toket-tool-input-head h1,
  html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-head h1 {
    font-size: 24px;
  }

  html.page-v1-calculator.page-home .toket-tool-input-card,
  html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-card {
    padding: 16px 16px 18px;
  }

  html.page-v1-calculator.page-home .toket-tool-input-actions,
  html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions {
    flex-direction: column;
    align-items: stretch;
  }

  html.page-v1-calculator.page-home .toket-tool-input-actions .home-btn,
  html.page-v1-calculator.page-home .toket-tool-input-actions .toket-tool-input-submit,
  html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-actions .toket-tool-input-submit {
    width: 100%;
  }

  html.page-v1-calculator.page-home .toket-tool-input-hint,
  html.page-cost-v2 .page-v2-optimizer-section .toket-tool-input-hint {
    text-align: center;
  }
}
