/* ──────────────────────────────────────────────
   YouTube Downloader — Main Stylesheet
   Mobile-first, fully responsive
   ────────────────────────────────────────────── */

/* ── CSS Variables ── */
:root {
  --clr-bg:        #0f0f13;
  --clr-surface:   #1a1a22;
  --clr-surface2:  #22222e;
  --clr-border:    #2e2e3e;
  --clr-accent:    #ff0000;
  --clr-accent-h:  #cc0000;
  --clr-green:     #22c55e;
  --clr-gold:      #f59e0b;
  --clr-text:      #f0f0f5;
  --clr-muted:     #8888aa;
  --clr-error:     #ff4d4d;

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     18px;

  --shadow:        0 4px 24px rgba(0,0,0,0.45);
  --shadow-card:   0 2px 16px rgba(0,0,0,0.35);

  --font:          'Inter', system-ui, sans-serif;
  --transition:    0.18s ease;
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

/* ── Container ── */
.container {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* ── HEADER ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 15, 19, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--clr-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  flex-wrap: wrap;
  gap: 6px;
  padding-block: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--clr-text);
  transition: opacity var(--transition);
}
.logo:hover { opacity: 0.85; }
.logo strong { font-weight: 700; }

/* ── Language Switcher ── */
.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--clr-muted);
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.lang-btn:hover {
  color: var(--clr-text);
  background: var(--clr-surface2);
  border-color: var(--clr-border);
}
.lang-btn.active {
  color: var(--clr-text);
  background: var(--clr-surface2);
  border-color: var(--clr-border);
  font-weight: 600;
}
.flag { font-size: 1rem; line-height: 1; }

@media (max-width: 480px) {
  .logo { font-size: 0.95rem; gap: 7px; }
  .logo svg { width: 22px; height: 22px; }
  .lang-btn { padding: 4px 7px; font-size: 0.72rem; }
}

@media (max-width: 380px) {
  .lang-code { display: none; }
  .lang-btn { padding: 4px 6px; }
}

@media (max-width: 480px) {
  .badge-text { display: none; }
}

@media (max-width: 360px) {
  .premium-badge { font-size: 0.68rem; padding: 3px 7px; }
}

/* ── HERO ── */
.hero {
  padding-block: 60px 48px;
  text-align: center;
}

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero-title span { color: var(--clr-accent); }

.hero-subtitle {
  font-size: clamp(0.9rem, 2.5vw, 1.05rem);
  color: var(--clr-muted);
  margin-bottom: 32px;
}

/* ── Input Row ── */
.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-wrapper {
  flex: 1;
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrapper input {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 42px;
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-wrapper input:focus {
  border-color: var(--clr-accent);
  box-shadow: 0 0 0 3px rgba(255,0,0,0.12);
}
.input-wrapper input::placeholder { color: var(--clr-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  height: 50px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--clr-accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--clr-accent-h);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-download {
  width: 100%;
  background: var(--clr-green);
  color: #fff;
  height: 48px;
  margin-top: 4px;
}
.btn-download:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-1px);
}
.btn-download:active:not(:disabled) { transform: translateY(0); }
.btn-download:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Duration limit notice ── */
.duration-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  padding: 7px 12px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--clr-muted);
}
.duration-notice svg { color: #f59e0b; flex-shrink: 0; }
.duration-notice-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #f59e0b;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.duration-notice-link:hover { color: #fbbf24; }

/* ── Download progress bar ── */
.btn-progress-bar {
  position: absolute;
  inset: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.18);
  border-radius: inherit;
  pointer-events: none;
  transition: none;
}

/* ── Spinner ── */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error message ── */
.error-msg {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(255, 77, 77, 0.1);
  border: 1px solid rgba(255,77,77,0.3);
  border-radius: var(--radius-sm);
  color: var(--clr-error);
  font-size: 0.88rem;
  text-align: left;
}

/* ── Video Card ── */
.video-card {
  margin-top: 24px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: fadeSlideUp 0.3s ease;
}

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

.video-thumb-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--clr-surface2);
}

.video-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-meta {
  padding: 18px 20px 20px;
  text-align: left;
}

.video-title-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-details {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--clr-muted);
}
.detail-label { font-weight: 500; color: var(--clr-muted); }
.video-details li { display: flex; gap: 4px; }

/* ── Quality selector ── */
.quality-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.quality-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--clr-muted);
  flex-shrink: 0;
}

.select-wrapper {
  position: relative;
  flex: 1;
  min-width: 150px;
}

.select-wrapper select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--clr-surface2);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 8px 36px 8px 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}
.select-wrapper select:focus { border-color: var(--clr-accent); }

.select-arrow {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-muted);
  pointer-events: none;
}

/* Quality badge colors in select */
option.free   { color: var(--clr-green); }
option.premium { color: var(--clr-gold); }

/* ── SEO / How-to Block ── */
.seo-block {
  background: var(--clr-surface);
  border-top: 1px solid var(--clr-border);
  padding-block: 52px;
}

.seo-inner {
  text-align: left;
}

.seo-inner h2 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  margin-bottom: 12px;
}

.seo-intro {
  color: var(--clr-muted);
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 36px;
}

.block-subtitle {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 18px;
  margin-top: 36px;
  color: var(--clr-text);
}

/* ── How-to Steps ── */
.howto-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.howto-step {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--clr-accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.step-body {
  flex: 1;
}

.step-name {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: 4px;
}

.step-text {
  font-size: 0.88rem;
  color: var(--clr-muted);
  line-height: 1.65;
  margin: 0;
}

/* ── Benefits Grid ── */
.benefits-grid {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 4px;
}

.benefit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--clr-surface2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.9rem;
  color: var(--clr-text);
  line-height: 1.45;
}

.benefit-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

@media (min-width: 560px) {
  .benefits-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── FAQ Block ── */
.faq-block {
  background: var(--clr-bg);
  border-top: 1px solid var(--clr-border);
  padding-block: 52px;
}

.faq-inner h2 {
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
  margin-bottom: 24px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.faq-item {
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--clr-surface);
  transition: border-color var(--transition);
}

.faq-item:first-child { border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-md); }

.faq-item + .faq-item { margin-top: 8px; }

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--clr-text);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.faq-q:hover { background: var(--clr-surface2); }

.faq-q[aria-expanded="true"] { background: var(--clr-surface2); }

.faq-q[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
}

.faq-chevron {
  flex-shrink: 0;
  color: var(--clr-muted);
  transition: transform 0.22s ease;
}

.faq-a {
  display: none;
  padding: 0 18px 16px;
  font-size: 0.9rem;
  color: var(--clr-muted);
  line-height: 1.7;
  border-top: 1px solid var(--clr-border);
  padding-top: 14px;
  margin: 0;
}

.faq-item.open .faq-a {
  display: block;
  animation: fadeSlideUp 0.2s ease;
}

/* ── Footer ── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--clr-border);
  padding-block: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--clr-muted);
}

/* ── Premium Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 0.2s ease;
}

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

.modal-icon { font-size: 2.5rem; margin-bottom: 12px; }

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Кнопка-крестик */
.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--clr-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.modal-close-btn:hover { color: var(--clr-text); background: rgba(255,255,255,.07); }

/* Список преимуществ */
.modal-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal-benefits li {
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.benefit-check {
  color: #22c55e;
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* Поля формы */
.form-field {
  margin-bottom: 14px;
  text-align: left;
}
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--clr-muted);
  margin-bottom: 5px;
}
.form-input {
  width: 100%;
  background: var(--clr-bg);
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  font-size: 0.95rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.form-input:focus { border-color: var(--clr-accent); }
.form-input.is-error { border-color: #ef4444; }

/* Чекбокс */
.form-field--check { margin-bottom: 18px; }
.check-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.check-input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--clr-border);
  border-radius: 4px;
  background: var(--clr-bg);
  margin-top: 1px;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-input:checked + .check-box {
  background: var(--clr-accent);
  border-color: var(--clr-accent);
}
.check-input:checked + .check-box::after {
  content: "";
  display: block;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
.check-box.is-error { border-color: #ef4444; }
.check-text { font-size: 0.66rem; color: var(--clr-muted); line-height: 1.4; }
.privacy-link { color: var(--clr-accent); text-decoration: underline; }

/* Ошибки валидации */
.field-error {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #ef4444;
}

/* Кнопка оплаты */
.btn-pay {
  width: 100%;
  background: #22c55e;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  padding: 13px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-bottom: 10px;
}
.btn-pay:hover { background: #16a34a; }
.btn-pay:active { transform: scale(0.98); }

/* Мелкий текст под кнопкой */
.fine-print {
  font-size: 0.75rem;
  color: var(--clr-muted);
  line-height: 1.4;
  margin: 0;
}

/* Экран успеха */
.modal-success {
  text-align: center;
  padding: 12px 0;
}
.success-icon { font-size: 3rem; margin-bottom: 14px; }
.success-text {
  color: var(--clr-text);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 22px;
}

/* ── Premium badge в хедере ── */
.premium-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.3);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ── Уведомление об оплате ── */
.payment-notice {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-top: 12px;
  line-height: 1.4;
}
.notice--success { background: rgba(34,197,94,.15);  color: #86efac; border: 1px solid rgba(34,197,94,.3);  }
.notice--warn    { background: rgba(251,191,36,.12);  color: #fde68a; border: 1px solid rgba(251,191,36,.3); }
.notice--error   { background: rgba(239,68,68,.12);   color: #fca5a5; border: 1px solid rgba(239,68,68,.3);  }

/* ── Responsive ── */
@media (max-width: 520px) {
  .input-row {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
  #analyze-btn {
    height: 46px;
  }
  .input-wrapper input {
    height: 48px;
  }
  .hero {
    padding-block: 40px 36px;
  }
}

@media (min-width: 768px) {
  .container { padding-inline: 24px; }
  .video-card {
    display: grid;
    grid-template-columns: 280px 1fr;
  }
  .video-thumb-wrap {
    aspect-ratio: unset;
    height: 100%;
    min-height: 160px;
  }
  .video-thumb {
    height: 100%;
  }
}

@media (min-width: 1024px) {
  .container { max-width: 820px; }
}

/* ── Utility ── */
[hidden] { display: none !important; }
