/* ==========================================================================
   O96X Design System & Styles
   Clean, modern, responsive, light/dark mode via prefers-color-scheme
   ========================================================================== */

:root {
  /* Light Theme Palette (Default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-pill: #f1f5f9;
  --bg-pill-checked: #2563eb;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-pill-checked: #ffffff;
  
  --brand-primary: #2563eb;
  --brand-primary-hover: #1d4ed8;
  --brand-accent: #3b82f6;
  --brand-light: #eff6ff;

  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --success-bg: #f0fdf4;
  --success-text: #166534;
  --success-border: #bbf7d0;

  --error-bg: #fef2f2;
  --error-text: #991b1b;
  --error-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --transition: all 0.2s ease-in-out;
}

/* Dark Theme via prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --bg-pill: #1e293b;
    --bg-pill-checked: #3b82f6;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-pill-checked: #ffffff;

    --brand-primary: #3b82f6;
    --brand-primary-hover: #60a5fa;
    --brand-accent: #60a5fa;
    --brand-light: #172554;

    --border-color: #334155;
    --border-focus: #60a5fa;

    --success-bg: #052e16;
    --success-text: #86efac;
    --success-border: #166534;

    --error-bg: #450a0a;
    --error-text: #fca5a5;
    --error-border: #991b1b;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  }
}

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

html {
  scroll-behavior: smooth;
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

.section {
  padding: 80px 0;
}

.section-alt {
  background-color: var(--bg-secondary);
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 48px;
}

.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
  .header {
    background-color: rgba(11, 15, 25, 0.85);
  }
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.logo-badge {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.logo-tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Hero Section */
.hero-section {
  padding: 100px 0 80px;
  text-align: center;
  background: radial-gradient(circle at 50% 10%, rgba(37, 99, 235, 0.08) 0%, transparent 60%);
}

.hero-container {
  max-width: 820px;
}

.hero-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background-color: var(--brand-light);
  color: var(--brand-primary);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 3.25rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 48px;
}

.hero-features {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.feature-icon {
  font-size: 1.15rem;
}

/* Grid & Cards (Что автоматизируем) */
.grid {
  display: grid;
  gap: 24px;
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-accent);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: inline-block;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.card-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Steps Flow (Как проходит работа) */
.steps-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  position: relative;
}

.step-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.step-item:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--shadow-sm);
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.step-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.step-text {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Form Section */
.form-section-container {
  display: flex;
  justify-content: center;
}

.form-wrapper {
  width: 100%;
  max-width: 680px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.form-header {
  margin-bottom: 32px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.req {
  color: #ef4444;
}

.optional {
  font-weight: normal;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control.is-invalid {
  border-color: #ef4444;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Radio Pill Group */
.radio-pill-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-pill {
  position: relative;
  cursor: pointer;
  flex: 1;
  min-width: 70px;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.radio-pill span {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  background-color: var(--bg-pill);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: var(--transition);
  text-align: center;
}

.radio-pill input:checked + span {
  background-color: var(--bg-pill-checked);
  color: var(--text-pill-checked);
  border-color: var(--bg-pill-checked);
}

.radio-pill:hover span {
  border-color: var(--brand-accent);
}

/* Checkbox */
.checkbox-group {
  margin-top: 10px;
  margin-bottom: 24px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input {
  margin-top: 2px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand-primary);
}

/* Honeypot field (hidden from view) */
.hp-field {
  display: none !important;
  visibility: hidden;
  height: 0;
  width: 0;
  position: absolute;
  left: -9999px;
}

/* Field Validation Errors */
.field-error {
  display: none;
  font-size: 0.8rem;
  color: #ef4444;
  margin-top: 4px;
}

.field-error.active {
  display: block;
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
}

.alert-success {
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.alert-error {
  background-color: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.alert-icon {
  font-size: 1.25rem;
  font-weight: bold;
}

.alert-heading {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-message {
  font-size: 0.9rem;
  line-height: 1.4;
}

.d-none {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-align: center;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

/* Spinner inside button */
.spinner-svg {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
}

.spinner-circle {
  stroke: currentColor;
  stroke-dasharray: 50;
  stroke-dashoffset: 20;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Footer / Contacts */
.footer {
  margin-top: auto;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 48px 0 0;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  padding-bottom: 40px;
}

.footer-desc {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 320px;
}

.footer-heading {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.contact-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-link {
  font-size: 0.95rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.contact-link:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

/* Mobile & Tablet Responsiveness */
@media (max-width: 860px) {
  .hero-title {
    font-size: 2.35rem;
  }
  
  .steps-flow {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-wrapper {
    padding: 24px 16px;
  }

  .footer-container {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.85rem;
  }

  .hero-subtitle {
    font-size: 1.05rem;
  }

  .section-title {
    font-size: 1.65rem;
  }

  .hero-features {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .header-cta {
    display: none;
  }
}
