/* ============================================
   Общие стили сайта — юридические услуги
   Перегруз, парковка на газоне, ДТП, арбитраж
   ============================================ */

:root {
  --color-primary: #1a365d;
  --color-primary-dark: #0f2744;
  --color-accent: #c9a227;
  --color-accent-hover: #b8921f;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-bg: #ffffff;
  --color-bg-alt: #f5f6f8;
  --color-border: #e2e6eb;
  --font-main: 'Montserrat', 'Segoe UI', system-ui, sans-serif;
  --font-size-base: 16px;
  --line-height: 1.5;
  --container-max: 1200px;
  --header-height: 72px;
  --mobile-bar-height: 56px;
  --transition: 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent);
}

/* ========== Типографика ========== */
h1, h2, h3, h4 {
  margin: 0 0 0.75em;
  font-weight: 600;
  line-height: 1.25;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h3 { font-size: 1.25rem; }

p {
  margin: 0 0 1em;
}

.text-muted {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.disclaimer {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5em;
}

/* ========== Контейнер ========== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== Шапка ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  gap: 24px;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-primary);
  white-space: nowrap;
}

.nav-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-main a {
  padding: 8px 12px;
  color: var(--color-text);
  font-weight: 500;
  border-radius: 4px;
}

.nav-main a:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.nav-main a.nav-current,
.nav-main a.nav-highlight {
  color: var(--color-accent);
  font-weight: 600;
}

.nav-services {
  position: relative;
}

.nav-services-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  border-radius: 4px;
}

.nav-services-trigger:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  margin-top: 4px;
  padding: 8px 0;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.nav-services.open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--color-text);
}

.nav-dropdown a:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-phone {
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-accent);
  color: #1a1a1a;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #1a1a1a;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

.btn-block {
  width: 100%;
}

/* ========== Мобильное меню (бургер) ========== */
.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: none;
  background: none;
  cursor: pointer;
}

.burger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-primary);
  transition: transform var(--transition), opacity var(--transition);
}

.burger-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger-btn.open span:nth-child(2) {
  opacity: 0;
}

.burger-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-bg);
  z-index: 99;
  overflow-y: auto;
  padding: 24px;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu .nav-main {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.mobile-menu .nav-main a,
.mobile-menu .nav-dropdown a {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
}

.mobile-menu .nav-dropdown {
  position: static;
  opacity: 1;
  visibility: visible;
  transform: none;
  box-shadow: none;
  border: none;
  margin: 0;
  padding: 0 0 0 16px;
}

.mobile-menu .nav-services.open .nav-dropdown {
  display: block;
}

.mobile-menu .header-actions {
  flex-direction: column;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

/* Нижняя панель (мобильная) */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 98;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 8px 12px;
  gap: 8px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.mobile-bottom-bar .btn {
  flex: 1;
  padding: 10px 12px;
  font-size: 0.875rem;
}

body.has-mobile-bar {
  padding-bottom: calc(var(--mobile-bar-height) + 16px);
}

/* ========== Hero / первый экран ========== */
.hero {
  padding: 48px 0 56px;
  background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.hero-content h1 {
  margin-bottom: 16px;
}

.hero-content .subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.hero-content .disclaimer {
  margin-bottom: 24px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-form-wrap {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.hero-form-wrap h3 {
  margin-bottom: 20px;
  font-size: 1.125rem;
}

/* ========== Формы ========== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.9375rem;
}

.form-group label .required {
  color: #c00;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.form-consent input {
  width: auto;
  margin-top: 4px;
  flex-shrink: 0;
}

.form-consent label {
  margin-bottom: 0;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.form-success {
  display: none;
  padding: 16px;
  background: #e8f5e9;
  border-radius: 8px;
  color: #2e7d32;
  font-weight: 500;
}

.form-success.visible {
  display: block;
}

.form-success + .form-fields {
  display: none;
}

/* ========== Секции ========== */
.section {
  padding: 56px 0;
}

.section:nth-child(even) {
  background: var(--color-bg-alt);
}

.section-title {
  margin-bottom: 32px;
  text-align: center;
}

.section-title h2 {
  margin-bottom: 8px;
}

/* Карточки в ряд */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

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

.card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.card h3 {
  margin-bottom: 8px;
  font-size: 1.125rem;
}

.card .card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

/* Шаги / процесс */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  counter-reset: step;
}

.step {
  position: relative;
  padding-left: 48px;
  counter-increment: step;
}

.step::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 50%;
}

.step h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.step p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* Список рисков */
.risks-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.risks-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 12px;
}

.risks-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  background: var(--color-accent);
  border-radius: 50%;
}

/* Блок «Когда есть шансы» */
.chances-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}

.chances-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.chances-list li:last-child {
  border-bottom: none;
}

/* Усилитель срочности */
.urgency-block {
  text-align: center;
  padding: 32px 24px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 12px;
}

.urgency-block h2,
.urgency-block p {
  color: #fff;
  margin-bottom: 16px;
}

.urgency-block .btn-primary {
  background: var(--color-accent);
  color: #1a1a1a;
}

/* Кейсы */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.case-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 24px;
}

.case-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.case-card a {
  font-size: 0.875rem;
  word-break: break-all;
}

/* Универсальная форма внизу */
.cta-form-section {
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.cta-form-section .form-success.visible + .form-fields {
  display: none;
}

.cta-form-section .form-fields {
  display: block;
}

/* ========== Всплывающие элементы ========== */
.popup-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.popup-bar.visible {
  display: flex;
}

.popup-bar-text {
  flex: 1;
  font-size: 0.9375rem;
}

.popup-bar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.popup-bar .btn-primary {
  background: var(--color-accent);
  color: #1a1a1a;
  padding: 8px 16px;
  font-size: 0.875rem;
}

.popup-bar .btn-secondary {
  border-color: #fff;
  color: #fff;
  padding: 8px 16px;
  font-size: 0.875rem;
}

.popup-bar .btn-secondary:hover {
  background: #fff;
  color: var(--color-primary);
}

.popup-bar-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.9;
}

.popup-bar-close:hover {
  opacity: 1;
}

/* Боковой слайдер */
.popup-slider {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100%;
  background: var(--color-bg);
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  z-index: 201;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.popup-slider.visible {
  transform: translateX(0);
}

.popup-slider h3 {
  margin-bottom: 12px;
}

.popup-slider p {
  margin-bottom: 20px;
  font-size: 0.9375rem;
}

.popup-slider-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--color-text-muted);
}

/* Exit-intent модалка */
.popup-exit {
  position: fixed;
  inset: 0;
  z-index: 202;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.popup-exit.visible {
  display: flex;
}

.popup-exit-inner {
  background: var(--color-bg);
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 100%;
  position: relative;
}

.popup-exit-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--color-text-muted);
}

.popup-exit-inner h3 {
  margin-bottom: 12px;
}

.popup-exit-inner p {
  margin-bottom: 20px;
  font-size: 0.9375rem;
}

.popup-exit-inner .btn {
  margin-right: 8px;
  margin-bottom: 8px;
}

/* Чат-виджет */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
}

.chat-widget-bubble {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 12px;
  max-width: 260px;
  padding: 12px 16px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.chat-widget-bubble.visible {
  display: block;
}

.chat-widget-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.chat-widget-buttons .btn {
  padding: 10px 20px;
  font-size: 0.875rem;
}

/* ========== Подвал ========== */
.site-footer {
  background: var(--color-primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 40px 0 24px;
  margin-top: 56px;
}

.site-footer a {
  color: rgba(255,255,255,0.9);
}

.site-footer a:hover {
  color: var(--color-accent);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-nav h4 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: rgba(255,255,255,0.6);
}

.footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 8px;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
}

.footer-disclaimer {
  margin-top: 16px;
  font-size: 0.75rem;
  max-width: 720px;
}

/* ========== Страницы услуг (укороченные) ========== */
.page-hero {
  padding: 40px 0 48px;
  background: var(--color-bg-alt);
}

.page-hero h1 {
  margin-bottom: 16px;
}

.page-hero .subtitle {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.page-hero .hero-buttons {
  margin-bottom: 32px;
}

/* Контакты */
.contact-blocks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.contact-block {
  padding: 24px;
  background: var(--color-bg-alt);
  border-radius: 12px;
}

.contact-block h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

/* Правовые страницы */
.legal-page {
  padding: 40px 0 56px;
}

.legal-page h1 {
  margin-bottom: 24px;
}

.legal-page h2 {
  margin-top: 32px;
  margin-bottom: 12px;
}

.legal-page .requisites {
  margin-top: 40px;
  padding: 24px;
  background: var(--color-bg-alt);
  border-radius: 12px;
  font-size: 0.9375rem;
}

/* FAQ */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-item summary {
  padding: 20px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--color-accent);
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item .faq-answer {
  padding: 0 0 20px;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.faq-item .faq-answer p {
  margin-bottom: 8px;
}

.faq-item .faq-answer ul {
  margin: 8px 0;
  padding-left: 20px;
}

/* ========== Адаптив ========== */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-form-wrap {
    order: -1;
    max-width: 100%;
  }

  .nav-main:not(.mobile-menu .nav-main) {
    display: none;
  }

  .burger-btn {
    display: flex;
  }

  .mobile-bottom-bar {
    display: flex;
  }

  body.has-mobile-bar {
    padding-bottom: calc(var(--mobile-bar-height) + 16px);
  }

  .chat-widget {
    bottom: calc(var(--mobile-bar-height) + 16px);
  }
}

@media (max-width: 640px) {
  .header-phone {
    font-size: 0.875rem;
  }

  .hero {
    padding: 32px 0 40px;
  }

  .section {
    padding: 40px 0;
  }

  .mobile-bottom-bar .btn span {
    display: none;
  }
}
