/* ============================================
   COMPONENTS
   ============================================ */

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
}

.btn--sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-sm);
}

.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--fs-md);
}

.btn--xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--fs-lg);
}

.btn--full {
  width: 100%;
}

.btn--accent {
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn--accent:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn--accent:active {
  transform: translateY(0);
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Shimmer effect on accent buttons */
.btn--accent::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 600ms;
}

.btn--accent:hover::after {
  left: 150%;
}

/* ===== LOGO ===== */
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.logo__img {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.logo__text {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .logo__text {
    font-size: var(--fs-xs);
  }
  .logo__img {
    width: 36px;
    height: 36px;
  }
}

/* ===== ICONS ===== */
.icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.icon--check {
  color: var(--accent);
}

/* ===== FORMS ===== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-field label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

.form-field .required {
  color: var(--accent);
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--t-base);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

/* Валидация: красная обводка только ПОСЛЕ взаимодействия пользователя */
.form-field input:not(:focus):not(:placeholder-shown):invalid,
.form-field textarea:not(:focus):not(:placeholder-shown):invalid,
.form-field select:not(:focus):invalid[data-touched="true"] {
  border-color: #EF4444;
}

.form-field input:not(:focus):not(:placeholder-shown):invalid:focus,
.form-field textarea:not(:focus):not(:placeholder-shown):invalid:focus {
  border-color: var(--accent);
}

.form-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

.form-field textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-body);
}

.form-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  cursor: pointer;
}

.form-consent input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.form-consent a {
  color: var(--accent);
  text-decoration: underline;
}

.form-note {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--space-4);
}

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent;
  transition: background var(--t-base), border-color var(--t-base);
}

.header.is-scrolled {
  background: var(--bg-primary);
  border-bottom-color: var(--border-light);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: var(--space-6);
  position: relative;
}

.nav {
  flex: 1;
  display: flex;
  justify-content: flex-start;
}

.nav__list {
  display: flex;
  gap: var(--space-8);
  width: 100%;
}

.nav__list > li:nth-child(4) {
  margin-left: auto;
}

.header__center-logo {
  position: absolute;
  left: 50%;
  top: calc(100% - 29px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: top var(--t-base), transform var(--t-base);
}

.header.is-scrolled .header__center-logo {
  top: 50%;
  transform: translate(-50%, -50%);
}

.header__center-logo img {
  display: block;
  width: clamp(128px, 9vw, 160px);
  height: auto;
}

.nav,
.header__actions {
  position: relative;
  z-index: 1;
}

.nav__link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  transition: color var(--t-base);
  position: relative;
  padding: var(--space-2) 0;
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--t-base);
}

.nav__link:hover::after {
  width: 100%;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header__phone {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  transition: color var(--t-base);
}

.header__phone:hover {
  color: var(--accent);
}

.burger {
  display: none;
  width: 28px;
  height: 28px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0;
}

.burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--t-base);
}

.burger.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger.is-active span:nth-child(2) {
  opacity: 0;
}
.burger.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* desktop: call-btn hidden, burger hidden */
.header__call-btn {
  display: none;
}

@media (max-width: 1024px) {
  /* скрываем десктопные элементы */
  .nav,
  .header__phone,
  .header__actions .btn--accent:not(.header__call-btn) {
    display: none;
  }

  /* показываем бургер (уже первый flex-элемент = левый) */
  .burger {
    display: flex;
    flex-shrink: 0;
  }

  /* логотип — по центру через абсолютное позиционирование */
  .header__center-logo {
    display: inline-flex;
    top: 50%;
    transform: translate(-50%, -50%);
  }

  /* кнопка "Позвонить" — справа */
  .header__call-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: var(--fs-sm);
    padding: 8px 14px;
  }
}

/* Mobile nav drawer */
.nav.is-open {
  display: flex;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  padding: var(--space-8) var(--space-6);
  z-index: var(--z-header);
}

.nav.is-open .nav__list {
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
  display: flex;
}

.nav.is-open .nav__list > li:nth-child(4) {
  margin-left: 0;
}

.nav.is-open .nav__link {
  font-size: var(--fs-xl);
}

/* ===== MODAL ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal.is-open {
  display: flex;
  animation: modalFadeIn var(--t-base) ease-out;
}

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

.modal__overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - var(--space-8));
  overflow-y: auto;
  padding: var(--space-10);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalSlideUp var(--t-spring);
}

.modal__dialog--sm {
  max-width: 420px;
  text-align: center;
}

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

.modal__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: all var(--t-base);
}

.modal__close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal__title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-3);
}

.modal__desc {
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

.modal__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.modal__success-icon {
  color: var(--accent);
  margin-bottom: var(--space-2);
}

@media (max-width: 480px) {
  .modal__dialog {
    padding: var(--space-6);
  }
  .modal__title {
    font-size: var(--fs-xl);
  }
}

/* ===== EQUIPMENT DETAILS (Large Modal) ===== */
.modal__dialog--lg {
  max-width: 1100px;
  padding: 0;
  overflow: hidden;
}

.equipment-details {
  display: grid;
  grid-template-columns: 3fr 7fr;
  gap: 0;
  max-height: 82vh;
}

.equipment-details__image {
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-6);
  border-right: 1px solid var(--border-light);
  gap: var(--space-6);
}

.equipment-details__image img {
  width: 100%;
  max-width: 240px;
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5));
}

.equipment-details__content {
  padding: var(--space-8) var(--space-8) var(--space-8) var(--space-6);
  overflow-y: auto;
  min-height: 0;
  max-height: 82vh;
}

.equipment-details__content .modal__title {
  margin-bottom: var(--space-1);
  font-size: var(--fs-2xl);
}

.equipment-details__small {
  display: block;
  font-size: var(--fs-sm);
  color: var(--accent-light);
  margin-bottom: var(--space-6);
  font-weight: var(--fw-medium);
}

.equipment-details__section {
  margin-bottom: var(--space-6);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}

.equipment-details__section h4 {
  color: var(--text-primary);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin-bottom: var(--space-2);
}

.equipment-details__section ul {
  list-style: disc;
  padding-left: var(--space-5);
  margin: 0;
}

.equipment-details__section li {
  margin-bottom: var(--space-1);
}

.equipment-details__price {
  font-size: var(--fs-xl);
  color: var(--text-primary);
  margin-bottom: 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

/* Стилизованный скролл для правой колонки */
.equipment-details__content::-webkit-scrollbar {
  width: 4px;
}
.equipment-details__content::-webkit-scrollbar-track {
  background: transparent;
}
.equipment-details__content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}
.equipment-details__content::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.equipment-details__price strong {
  font-size: var(--fs-2xl);
  color: var(--accent);
  font-family: var(--font-display);
}

@media (max-width: 768px) {
  .equipment-details {
    grid-template-columns: 1fr;
    max-height: calc(100vh - var(--space-8));
    overflow-y: auto;
  }
  .equipment-details__image {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: var(--space-6);
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-4);
  }
  .equipment-details__image .equipment-details__cta {
    width: 100%;
  }
  .equipment-details__content {
    padding: var(--space-6);
    overflow-y: visible;
    max-height: none;
  }
}
