/* CSS Design System for remont101.ru */

/* Local Inter Variable Font (Cyrillic & Latin subsets, weights 400-800) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url('../fonts/inter-cyrillic-variable.woff2') format('woff2-variations'),
       url('../fonts/inter-cyrillic-variable.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 400 800;
  src: url('../fonts/inter-latin-variable.woff2') format('woff2-variations'),
       url('../fonts/inter-latin-variable.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Color Tokens */
  --color-primary: #E8604C;
  --color-primary-hover: #D14F3D;
  --color-primary-light: #FBEDE9;
  --color-text-primary: #1E1E1E;
  --color-text-secondary: #6B6B6B;
  --color-text-muted: #9B9994;
  --color-border: #E4E2DD;
  --color-border-focus: #E8604C;
  --color-bg: #FFFFFF;
  --color-bg-selected: #F4F3EF;
  --color-bg-secondary: #F7F6F3;
  --color-progressbar-bg: #EDEBE6;
  --color-progressbar-fill: #E8604C;
  --color-success: #3FA34D;
  --color-error: #D93636;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, SF Pro, Roboto, system-ui, sans-serif;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
}

/* Mobile height constraints & body overflow hidden */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
  }
}

/* Page Layout Container */
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  background-color: var(--color-bg);
  position: relative;
}

@media (max-width: 768px) {
  .page-container {
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
  }
}

/* Sticky Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg);
  flex-shrink: 0;
}

.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  position: relative;
}

.logo {
  height: 32px;
  display: flex;
  align-items: center;
}

.logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* Edge-to-edge Progress Bar */
.progress-container {
  width: 100%;
  height: 4px;
  background-color: var(--color-progressbar-bg);
  position: relative;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--color-progressbar-fill);
  transition: width 0.3s ease;
}

/* Main Content Area */
main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: 32px 20px 0 20px; /* 32px-40px top padding */
  overflow-y: auto;
  min-height: 0;
}

/* Step wrapper for transitions */
.step-content {
  display: none;
  animation: fadeSlideIn 0.3s ease-out forwards;
  flex-direction: column;
  min-height: calc(100vh - 156px);
  min-height: calc(100dvh - 156px);
  flex-shrink: 0;
  padding-bottom: 200px;
  box-sizing: border-box;
}

.step-content.active {
  display: flex;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Headings */
h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin-bottom: 24px;
  text-align: left;
}

@media (min-width: 480px) {
  h1 {
    font-size: 30px;
  }
}

.step-subtitle {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text-secondary);
  margin-bottom: 28px;
  text-align: left;
}

h1 + .step-subtitle {
  margin-top: -16px;
}

/* Master Hero Image on Home step */
.master-hero-image {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 24px auto;
  border-radius: 120px 120px 0 0; /* Premium rounded arch */
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--color-border);
}

.master-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Cards Container (List of choices) */
.options-list {
  border: 1px solid var(--color-border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  flex-shrink: 0;
}

/* Option Row / Card */
.option-row {
  min-height: 64px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  background-color: var(--color-bg);
  transition: background-color 0.15s ease;
  user-select: none;
}

.option-row:last-child {
  border-bottom: none;
}

/* Hover for non-mobile */
@media (hover: hover) {
  .option-row:hover {
    background-color: var(--color-bg-secondary);
  }
}

/* Radio Control */
.control-indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
  background-color: #fff;
}

.option-row.selected .control-indicator {
  border-color: var(--color-primary);
}

.control-indicator::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--color-primary);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.option-row.selected .control-indicator::after {
  opacity: 1;
  transform: scale(1);
}

/* Checkbox Control */
.checkbox-row .control-indicator {
  border-radius: 6px;
}

.checkbox-row.selected .control-indicator {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-row .control-indicator::after {
  content: none;
}

.checkbox-row .control-indicator-icon {
  width: 12px;
  height: 9px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform: scale(0.6);
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.checkbox-row.selected .control-indicator-icon {
  opacity: 1;
  transform: scale(1);
}

/* Option Text */
.option-text {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--color-text-primary);
}

/* Selection state background */
.option-row.selected {
  background-color: var(--color-bg-selected);
}

/* Custom Text Input for 'Other' expanded choice */
.custom-input-container {
  display: none;
  padding: 12px 20px 20px 20px;
  background-color: var(--color-bg-selected);
  border-top: 1px solid var(--color-border);
}

.option-row.selected + .custom-input-container {
  display: block;
}

.text-field {
  width: 100%;
  height: 52px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232, 96, 76, 0.12);
}

.text-field::placeholder {
  color: var(--color-text-muted);
}

/* Error message style */
.validation-error {
  color: var(--color-error);
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 12px;
  display: none;
}

/* Auto-complete (Searchable Dropdown) on step 1-0 */
.autocomplete-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.autocomplete-item {
  padding: 14px 16px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.1s;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background-color: var(--color-bg-secondary);
}

/* Custom form group in Angi style: container with border, label inside, input below */
.form-group {
  position: relative;
  margin-bottom: 16px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 8px 16px;
  background-color: var(--color-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 58px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232, 96, 76, 0.12);
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #3F3F3F;
  margin-bottom: 2px;
  display: block;
}

.form-group label span {
  font-weight: 400;
  opacity: 0.7;
}

.form-group .text-field {
  border: none !important;
  background: transparent !important;
  padding: 2px 0 !important;
  margin: 0 !important;
  height: 28px !important;
  line-height: 24px !important;
  font-size: 18px;
  color: var(--color-text-primary);
  outline: none;
  box-shadow: none !important;
  width: 100%;
}

.text-field::placeholder {
  font-size: 15.5px;
  opacity: 0.75;
}

/* Circular validation checkmark icon styling */
.validation-checkmark {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background-color: var(--color-success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.form-group .validation-checkmark {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  margin-top: 0;
}

.validation-checkmark svg {
  width: 12px;
  height: 12px;
  stroke: #FFFFFF;
  display: block;
}

.form-group.valid-blurred .validation-checkmark,
.search-input-wrapper.valid-blurred .validation-checkmark {
  opacity: 1;
}

/* Conditional field animations (Phone) */
#phone-container {
  display: none;
  animation: slideDownFade 0.25s ease-out forwards;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Consent Checkbox */
.consent-container {
  display: flex;
  align-items: flex-start;
  margin-top: 16px;
  margin-bottom: 24px;
}

.consent-checkbox {
  position: absolute;
  opacity: 0;
  height: 0;
  width: 0;
}

.consent-label {
  position: relative;
  padding-left: 32px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  user-select: none;
}

.consent-label a {
  color: var(--color-primary);
  text-decoration: underline;
}

.consent-custom-checkbox {
  position: absolute;
  top: 1px;
  left: 0;
  height: 20px;
  width: 20px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  background-color: #fff;
  transition: background-color 0.15s, border-color 0.15s;
}

.consent-checkbox:checked ~ .consent-custom-checkbox {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.consent-custom-checkbox::after {
  content: "";
  position: absolute;
  display: none;
}

.consent-checkbox:checked ~ .consent-custom-checkbox::after {
  display: block;
}

.consent-custom-checkbox::after {
  left: 6px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Trust Badges */
.trust-badges-block {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.trust-badges-row {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.trust-badge-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trust-badge-item svg {
  width: 16px;
  height: 16px;
  fill: var(--color-success);
  flex-shrink: 0;
}

#loader {
  min-height: calc(100vh - 68px) !important;
  min-height: calc(100dvh - 68px) !important;
  padding-bottom: 0 !important;
}

/* Loader Screen Styles */
.loader-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  padding: 40px 0;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-progressbar-bg);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}

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

.loader-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text-primary);
  text-align: center;
  height: 24px;
  transition: opacity 0.2s ease;
}

/* Sticky Bottom Navigation (Fixed on mobile, flow on desktop > 768px) */
.nav-footer-sticky {
  position: sticky;
  bottom: 0;
  z-index: 90;
  background-color: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px)) 20px;
  flex-shrink: 0;
  margin-left: -20px;
  margin-right: -20px;
}

.nav-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
}

.btn {
  height: 52px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  transition: all 0.15s ease;
  border: none;
}

.btn-back {
  width: 35%;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  font-weight: 600;
}

.btn-next {
  flex: 1;
  background-color: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(232, 96, 76, 0.25);
}

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

.btn-next:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
}

.btn-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

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

.btn-back:hover {
  background-color: var(--color-bg-secondary);
}

/* Legal Footer (Must scroll to view, not visible by default) */
.legal-footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: 32px 20px;
  text-align: left;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-secondary);
  margin: 0 -20px 0 -20px;
}

.legal-footer-copyright {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 12px;
}

.legal-footer-links {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.legal-footer-links a {
  color: var(--color-text-primary);
  text-decoration: underline;
}

.legal-footer-disclaimer {
  color: var(--color-text-muted);
}

/* Extra spacing at end of main to prevent sticky footer from overlapping content */
.scroll-spacing {
  height: 80px;
  flex-shrink: 0;
}

/* City search input wrapper on home step */
.search-input-wrapper {
  position: relative;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background-color: var(--color-bg);
  height: 52px;
  display: flex;
  align-items: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(232, 96, 76, 0.12);
}

.search-input-wrapper > svg {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  fill: var(--color-text-muted);
  pointer-events: none;
}

.search-input-wrapper .text-field {
  border: none !important;
  background: transparent !important;
  padding: 0 16px 0 48px !important;
  margin: 0 !important;
  height: 100% !important;
  width: 100%;
  font-size: 18px;
  color: var(--color-text-primary);
  outline: none;
  box-shadow: none !important;
}

/* Responsive adjustment for Desktop (> 768px) */
@media (min-width: 769px) {
  body {
    background-color: var(--color-bg-secondary);
    padding: 40px 0;
  }
  
  .page-container {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    min-height: auto;
    border: 1px solid var(--color-border);
    overflow: hidden;
  }
  
  .step-content {
    min-height: auto;
  }
  
  .nav-footer-sticky {
    position: static;
    border-radius: 0 0 16px 16px;
  }
  
  .legal-footer {
    border-radius: 0 0 16px 16px;
  }
}
