:root {
  --accent: #1d55bd;
  --bg: #dadee4;
  --text: #1b1b1b;
  --radius: 20px;
  --transition: 0.25s ease;
}

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.car-cost-calc {
  padding: 40px;
  max-width: 1200px;
  margin: 40px auto;
  border-radius: var(--radius);
  background: var(--bg);
}

/* === ЗАГОЛОВКИ === */
.calc-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
  line-height: 1em;
}

.calc-subtitle {
  text-align: center;
  opacity: 0.75;
  margin-bottom: 30px;
  font-size: 16px;
}

/* === ТАБЫ МАРОК === */
.calc-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
}

.calc-tabs .tab {
  background: #e9ecf2;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.calc-tabs .tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(29, 85, 189, 0.35);
}

.calc-tabs .tab:hover {
  background: var(--accent);
  color: #fff;
}

/* === КОНТЕЙНЕР УСЛУГ === */
.calc-services {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.services {
  display: none;
  flex-direction: column;
  gap: 40px;
}

.services.active {
  display: flex;
}

/* === ГРУППЫ УСЛУГ === */
.group-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  border-bottom: 2px solid rgba(29, 85, 189, 0.2);
  padding-bottom: 4px;
}

.group-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
}

/* Для планшетов и мобильных */
@media (max-width: 992px) {
  .group-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .group-cards {
    grid-template-columns: 1fr;
  }
}

/* карточка адаптивная, без фиксированной ширины */
.service-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  background: #fff;
  border: 2px solid #e3e4e8;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  transition: var(--transition);
}

.service-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(29, 85, 189, 0.15);
}

.service-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.service-card h4 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}

.service-card p {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.8;
  flex-grow: 1;
  margin-bottom: 12px;
}

.service-card .price {
  display: block;
  margin-top: auto;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
}

.service-card .period {
  font-size: 13px;
  opacity: 0.7;
  margin-left: 6px;
}

/* === КНОПКА + / – === */
.toggle-service {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: 2px solid #ccc;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 24px;
  cursor: pointer;
  transition: var(--transition);
  color: #333;
}

.service-card.selected .toggle-service {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.toggle-service:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* === ИТОГОВЫЙ БЛОК === */
.calc-summary {
  display: none;
}

.calc-summary.visible {
  border-radius: var(--radius);
  background: var(--bg);
  display: block;
  padding: 40px;
  animation: fadeInUp 0.4s ease;
}

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

.summary-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.summary-header h3 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid #ddd;
  padding-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.order-btn-wrap {
  text-align: center;
  margin-top: 24px;
}

.order-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 32px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.order-btn:hover {
  background: #143a85;
  transform: translateY(-1px);
}

/* === ФОРМА ЗАЯВКИ === */
.calc-order {
  display: none;
}

.calc-order.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  border-radius: var(--radius);
  background: var(--bg);
  margin: 40px auto;
  max-width: 1200px;
  padding: 40px;
}

.calc-order h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.calc-order form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-order input[type="text"],
.calc-order input[type="tel"],
.calc-order select {
  padding: 10px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
}

.calc-order .submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.calc-order .submit-btn:hover {
  background: #143a85;
}

/* === THANK YOU === */
.thank-you {
  display: none;
  text-align: center;
  padding: 30px 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.4s ease;
  border-radius: var(--radius);
  background: var(--bg);
}

.thank-you.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.checkmark {
  font-size: 48px;
  color: #28a745;
  margin-bottom: 10px;
}

/* === КНОПКА "ЗАКРЫТЬ ФОРМУ" === */
.close-thank-btn {
  margin-top: 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.2s ease;
}

.close-thank-btn:hover {
  background: #143a85;
  transform: translateY(-1px);
}

/* === МЕТКА ОБЯЗАТЕЛЬНЫХ ПОЛЕЙ === */
.req {
  color: #e63946;
  font-weight: 700;
  margin-left: 3px;
  font-size: 16px;
  vertical-align: middle;
}

/* === АДАПТИВ === */
@media (max-width: 768px) {
  .service-card {
    width: 100%;
  }
}

/* Keep calculator cards within the available column width. */
.car-cost-calc .group-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.car-cost-calc .service-card {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 992px) {
  .car-cost-calc .group-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .car-cost-calc {
    padding-inline: clamp(12px, 4vw, 24px);
  }

  .car-cost-calc .group-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}
