/* ====================
   Основные переменные и сброс стилей
   ==================== */
:root {
  --color-primary: #003366;
  --color-accent: #cc0000;
  --color-bg: #f5f5f5;
  --font-heading: 'Montserrat', sans-serif;
  --font-body: 'Roboto', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: #111;
  line-height: 1.6;
}

/* ====================
   Шапка / Hero-блок
   ==================== */
header {
  position: relative;
  width: 100%;
  height: 60vh;
  background: url('../img/header.png') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}

.header-content {
  position: relative;
  text-align: center;
  z-index: 1;
}

.header-content h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.header-content p {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
}

.btn-primary {
  display: inline-block;
  background: linear-gradient(90deg, #0066cc, #cc0000);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0.25rem;
  text-decoration: none;
  font-weight: bold;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  text-align: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ====================
   Медиа-запрос для адаптивного Hero на смартфонах
   ==================== */
@media (max-width: 768px) {
  header {
    /* Заменяем изображение шапки для мобильных */
    background: url('../img/header-mobile.png') center/cover no-repeat;

    /* Убираем фиксированную высоту, чтобы контент не перекрывался */
    height: auto;
    padding: 2rem 1rem;
  }

   .header-content {
    padding-top: 2rem; /* Добавляем отступ сверху */
  }
   
  .header-content h1 {
    /* Уменьшаем размер заголовка на мобильных */
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .header-content p {
    /* Уменьшаем размер подзаголовка */
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  .btn-primary {
    /* Корректируем размер кнопки */
    padding: 0.6rem 1.2rem;
  }
}

/* ====================
   Основной контент
   ==================== */
/* Основной контент с отступом от шапки */
main {
  max-width: 960px;
  margin: 2rem auto 2rem;
  padding: 0 20px;
}

section {
  margin-bottom: 3rem;
}

h2 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  margin-bottom: 1rem;
  font-size: 2rem;
  text-align: center;
}

/* ====================
   Адаптивная карта в контактах
   ==================== */
.contact-map {
  background: #fff;
  padding: 1rem;
  border-radius: .5rem;
  margin-top: 2rem;
}
.contact-map h3 {
  font-family: var(--font-heading);
  color: var(--color-primary);
  margin-bottom: .75rem;
  text-align: center;
}

/* блок-обёртка, чтобы iframe сохранял пропорции */
.map-responsive {
  position: relative;
  width: 100%;
  /* выставьте нужное соотношение сторон: 
     56.25% = 16:9, 75% = 4:3, 50% = 2:1 и т.д. */
  padding-top: 56.25%;
  overflow: hidden;
  border-radius: .5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.map-responsive iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ====================
   Услуги
   ==================== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: 1.5rem;
}
.service-card {
  background: #fff;
  border-radius: .5rem;
  text-align: center;
  padding: 1.5rem;
  transition: box-shadow .2s, transform .2s;
}
.service-card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transform: translateY(-4px);
}
.service-card img {
  width: 60px;
  margin-bottom: 1rem;
}

/* ====================
   Цены
   ==================== */
.price-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
.price-card {
  background: #fff;
  padding: 1rem 1.5rem;
  border-radius: .25rem;
  text-align: center;
  width: 200px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: transform .2s;
}
.price-card:hover {
  transform: translateY(-3px);
}
.price-card h4 {
  font-family: var(--font-heading);
  margin-bottom: .5rem;
}
.price-card .price {
  font-size: 1.25rem;
  color: var(--color-accent);
}

/* ====================
   Контакты
   ==================== */
.contact-info {
  text-align: center;
  margin-bottom: 1.5rem;
}
.social-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}
.social-links a {
  width: 50px;
  height: 50px;
  display: block;
}

/* ====================
   Форма
   ==================== */
.center-button {
  text-align: center;
  margin-bottom: 1.5rem; /* Отступ снизу, чтобы отделить кнопку от формы */
}

.contact-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.contact-form input,
.contact-form textarea,
.contact-form button {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 0.25rem;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 5px rgba(0, 102, 204, 0.3);
}

/* Стиль только для кнопок без btn-primary */
.contact-form button:not(.btn-primary) {
  background: var(--color-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.contact-form button:not(.btn-primary):hover {
  background: #b30000;
}

/* ====================
   Рейтинг Яндекса
   ==================== */
.rating-badge {
  text-align: center;
  margin: 1.5rem 0;
}

/* ====================
   Карта
   ==================== */
#map {
  padding: 1.5rem 0;
  text-align: center; /* центрируем содержимое секции */
}

.map-container {
  position: relative;
  width: 100%;
  max-width: 640px;      /* не шире 640px */
  margin: 1.5rem auto;   /* автопроцент и отступ */
  padding-top: 75%;      /* 480/640 = 0.75 => 75% от ширины для высоты */
}

.map-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Сетка для «О компании» и «Контакты» */
.company-contacts-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}

/* Убеждаемся, что секции внутри занимают всю свою колонку */
.company-contacts-wrapper section {
  background: #fff; /* по желанию: фоновые карточки */
  padding: 1.5rem;
  border-radius: 0.5rem;
}

/* ====================
   Футер
   ==================== */
footer {
  background-color: #000; /* Чёрный фон */
  color: #fff;            /* Белый текст */
  text-align: center;     /* Центрирование текста */
  padding: 1rem 0;        /* Отступ сверху и снизу */
  font-size: 0.9rem;
  margin-top: 2rem;       /* Отступ сверху от контента */
}

/* ====================
   Чат-бот: кнопка и окно
   ==================== */
#chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: var(--font-body);
  z-index: 9999;
}

#chat-toggle {
  background: var(--color-primary);
  color: #fff;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: background 0.2s;
}

#chat-toggle:hover {
  background: #004080;
}

#chat-body {
  display: none;
  width: 300px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  overflow: hidden;
  margin-bottom: 10px;
}

#chat-header {
  background: var(--color-primary);
  color: #fff;
  padding: 10px;
  font-weight: bold;
  text-align: center;
}

#chat-messages {
  padding: 10px;
  height: 180px;
  overflow-y: auto;
  font-size: 0.9rem;
}

#chat-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  justify-content: center;
}

#chat-buttons button {
  padding: 5px 10px;
  font-size: 0.85rem;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

#chat-buttons button:hover {
  background: #ddd;
}

#user-input {
  width: 100%;
  border: none;
  border-top: 1px solid #ccc;
  padding: 10px;
  box-sizing: border-box;
  outline: none;
  font-size: 0.9rem;
}

.chat-link-button {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  margin-top: 0.5rem;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: bold;
  transition: background 0.2s;
}

.chat-link-button:hover {
  background: #004080;
}
