/* Обнуление и базовые стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #444;
  background-color: #f9f9f7;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

a {
  text-decoration: none;
  color: #c41e3a;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Хедер */
.header {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: bold;
  color: #c41e3a;
}

.logo-img {
  height: 40px;
}

/* Начертание бренда — Cormorant, капитель, точки-разделители между
   словами и лёгкое сжатие ширины (90%), см. выбор шрифта на отдельной
   витрине-подборке. Используется в шапке рядом с логотипом и в футере
   (класс добавляется поверх .logo/.footer-column h4, не заменяет их). */
.wordmark {
  font-family: 'Cormorant', Georgia, 'Times New Roman', serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  transform: scaleX(0.9);
  transform-origin: left center;
}

/* В шапке (десктоп, светлая тема) текст бренда — чёрный, а не унаследованный
   красный от .logo. Точки между словами (.wordmark-dot) остаются красными —
   это фирменный акцент, а не основной текст. */
.logo .wordmark {
  color: #000;
}

.wordmark-dot {
  display: inline-block;
  width: 0.28em;
  height: 0.28em;
  margin: 0 0.14em;
  border-radius: 50%;
  background: #c41e3a;
  /* vertical-align: middle центрирует точку по x-height (высоте строчных
     букв), а текст здесь — КАПИТЕЛЬ (text-transform: uppercase у
     .wordmark), у которой высота заглавных заметно больше x-height. Из-за
     этого точка визуально съезжала вниз относительно букв. Фиксированное
     смещение от базовой линии вместо "middle" поднимает точку к
     оптическому центру заглавных букв. Значение 0.18em измерено напрямую
     на живой странице (canvas actualBoundingBoxAscent для высоты
     капители шрифта .wordmark) — прежнее 0.08em оказалось недостаточным. */
  vertical-align: 0.18em;
}

.nav a {
  margin-left: 20px;
  color: #333;
  font-weight: 500;
}

/* Стиль для пунктов меню — УСИЛЕННАЯ ВЕРСИЯ ДЛЯ OPERA */
.nav a {
    position: relative;
    transition: color 0.3s ease;
    text-decoration: none;
    z-index: 1;
}

/* Красная линия под активным пунктом — ГАРАНТИРОВАННО для Opera */
.nav a.active::after,
.nav a:hover::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #c41e3a !important;
    border-radius: 3px;
    transform: scaleX(1) !important;
    transition: transform 0.3s ease !important;
    display: block !important;
    z-index: -1;
}

/* Линия в неактивном состоянии — скрыта */
.nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #c41e3a;
    border-radius: 3px;
    transform: scaleX(0);
    transition: transform 0.3s ease;
    display: block;
    z-index: -1;
}

/* Вендорные префиксы для Opera */
@-o-keyframes slideIn {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.nav a:hover::after,
.nav a.active::after {
    -o-animation: slideIn 0.3s ease forwards;
}

.cart-button {
  background-color: #c41e3a;
  color: white;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
}

.cart-button:hover {
  background-color: #a0182e;
}

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

.home h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 15px;
}

.home p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 30px;
}

/* Магазин */
.shop h2,
.delivery h2,
.cooperation h2,
.gallery h2,
.constructor h2 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 2rem;
}

.shop-intro {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
}

.categories {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.category {
  padding: 10px 20px;
  background-color: #ffebee;
  color: #c41e3a;
  border-radius: 30px;
  font-weight: 500;
  transition: 0.3s;
}

.category:hover,
.category.active {
  background-color: #c41e3a;
  color: white;
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;
}

.product-card {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s;
  position: relative;
  /* flex-column + margin-top:auto на кнопке/уведомлении ниже — чтобы
     "В корзину" всегда сидела на одном уровне у всех карточек в ряду
     сетки (.products: display:grid уже выравнивает карточки по высоте
     строки, но без flex кнопка просто "плавала" там, где кончался текст
     над ней). */
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
}

.product-images {
  position: relative;
  overflow: hidden;
}

.product-images img {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  object-fit: cover;
}

.alt-image {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.5s;
}

.product-card:hover .alt-image {
  display: block;
  opacity: 1;
}

.product-card h3 {
  padding: 15px 15px 5px;
  font-size: 1.2rem;
  color: #333;
}

/* Настоящая ссылка на постоянный адрес товара — см. .product-card h3 в
   templates/index.html и тот же приём в styles-mobile.css. Визуально как
   обычный текст названия, без подчёркивания/цвета ссылки. */
.product-name-link {
  color: inherit;
  text-decoration: none;
}

.product-desc-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 15px;
  margin-bottom: 10px;
}

.product-card .product-desc {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.4;
  white-space: pre-line;
  padding: 0;
  margin: 0;
  /* Обрезаем до 4 строк, чтобы карточки в сетке каталога не "гуляли" по
     высоте от товара к товару (разная длина описания раньше двигала
     кнопку "В корзину" то выше, то ниже) — читатель разворачивает
     описание кнопкой "Показать полностью" ниже, та же логика, что и в
     мобильной версии (см. templates/index_mobile.html: product-desc). */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .product-desc.expanded {
  -webkit-line-clamp: unset;
  overflow: visible;
}

.product-desc-toggle {
  align-self: flex-start;
  padding: 0;
  background: none;
  border: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c41e3a;
  cursor: pointer;
}

.product-desc-toggle:hover {
  text-decoration: underline;
}

.product-card p {
  font-size: 0.95rem;
  padding: 0 15px;
  margin-bottom: 5px;
}

.price span {
  font-weight: bold;
  color: #c41e3a;
}

.price.bulk span {
  color: #a0182e;
  font-size: 0.9rem;
}

.availability-out-of-stock {
    color: #d32f2f;
    font-weight: bold;
}

.availability-in-stock {
    color: #2e7d32;
    font-weight: bold;
}

.availability-coming-soon {
    color: #ff9800;
    font-weight: bold;
}

.availability-reserved {
    color: #757575;
    font-weight: bold;
}

.soon-badge {
  background-color: #ff9800;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-left: 8px;
}

.coming-soon .add-to-cart {
  display: none;
}

.add-to-cart {
  display: block;
  width: calc(100% - 30px);
  margin: 15px auto;
  padding: 10px;
  background-color: #c41e3a;
  color: white;
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
}

.add-to-cart:hover {
  background-color: #a0182e;
}

/* Кнопка "Хочу такой" — для карточек в статусах "Забронировано"/"Продано"
   (см. templates/index.html), где раньше отображалось только пустое
   .availability-notice. Открывает форму заявки (static/js/product-
   interest.js) — сообщение уходит в ту же воронку и с теми же
   уведомлениями менеджеру, что и обычный заказ (см. orders/serializers.py:
   ProductInterestSerializer). Цвет — тот же акцент, что у .add-to-cart. */
.want-similar-btn {
  display: block;
  width: calc(100% - 30px);
  margin: 15px auto;
  padding: 10px;
  background-color: #c41e3a;
  color: white;
  border: none;
  border-radius: 6px;
  text-align: center;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

.want-similar-btn:hover {
  background-color: #a0182e;
}

/* Прижимаем кнопку/уведомление к низу карточки (см. flex-column у
   .product-card выше) — все варианты взаимоисключающие, всегда последний
   элемент карточки. */
.product-card .add-to-cart,
.product-card .want-similar-btn,
.product-card .availability-notice {
  margin-top: auto;
}

/* Модальное окно заявки "Хочу такой" — общее для десктопа и мобильной
   версии (см. static/js/product-interest.js), стилизовано в духе попапа
   "подробнее о цветке" в конструкторе (см. static/constructor.css:
   .rhf-c-popup*). В отличие от мобильных стилей (styles-mobile*.css), этот
   файл не использует CSS-переменные для цвета — значения захардкожены,
   как и у остальных стилей каталога (см. .cart-modal ниже). */
.rhf-interest-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(20, 18, 16, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.rhf-interest-overlay[hidden] { display: none; }

.rhf-interest-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  color: #333;
  border-radius: 16px;
  padding: 24px 20px 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.rhf-interest-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  color: #333;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.rhf-interest-title {
  margin: 0 0 8px;
  padding-right: 28px;
  font-family: 'Cormorant', Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  color: #333;
}

.rhf-interest-product {
  margin: 0 0 12px;
  font-size: 13px;
  color: #666;
}
.rhf-interest-product[hidden] { display: none; }

.rhf-interest-note {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(196, 30, 58, 0.06);
  font-size: 13px;
  line-height: 1.5;
  color: #666;
}

.rhf-interest-field { margin-bottom: 14px; }
.rhf-interest-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 13px;
  color: #333;
}
.rhf-interest-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
  color: #333;
  box-sizing: border-box;
}

.rhf-interest-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 400;
  color: #666;
  cursor: pointer;
}
.rhf-interest-consent input { margin-top: 2px; flex-shrink: 0; }
.rhf-interest-consent a { color: #c41e3a; }

.rhf-interest-error {
  color: #d32f2f;
  font-size: 12px;
  margin-top: 4px;
  min-height: 14px;
}

.rhf-interest-submit {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 13px;
  background: #c41e3a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.rhf-interest-submit:hover { background: #a0182e; }
.rhf-interest-submit:disabled { opacity: 0.6; cursor: default; }

.rhf-interest-status {
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
}
.rhf-interest-status.success { color: #2e7d32; }
.rhf-interest-status.error { color: #d32f2f; }

/* Доставка */
.delivery-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
}

.delivery-image {
  flex: 1;
  min-width: 300px;
}

.delivery-text {
    flex: 1;
    min-width: 300px;
}

.delivery-text h3 {
    color: #c41e3a;
    margin: 20px 0 10px;
    font-size: 1.3rem;
}

.delivery-text p {
    margin-bottom: 12px;
    line-height: 1.6;
}

/* Конструктор букета — промо-блок на главной, между "Магазин" и "Оплата
   и доставка" (см. settings.is_constructor в rhf/views.py: index() —
   орders.utils.enforce_constructor_business_rules держит настройку
   выключенной, если пула для конструктора сейчас не хватает). Та же
   двухколоночная раскладка, что и у .delivery-content выше, только текст
   и видео меняются местами (текст слева, видео справа). */
.constructor-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
}

.constructor-text {
  flex: 1;
  min-width: 300px;
}

.constructor-text p {
  margin-bottom: 16px;
  line-height: 1.6;
}

.constructor-video-wrap {
  flex: 1;
  min-width: 300px;
}

.constructor-video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* Тот же красный "пилюльный" стиль, что и у .telegram-button ниже — своя
   копия, а не переиспользование класса, чтобы кнопки двух разных блоков
   не были случайно завязаны друг на друга при будущих правках. */
.constructor-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background-color: #c41e3a;
  color: white;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(196, 30, 58, 0.2);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.constructor-cta:hover {
  background-color: #a0182e;
  transform: scale(1.05);
}

/* Сотрудничество */
.cooperation-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 30px;
  justify-content: space-between;
}

.cooperation-image {
  flex: 1;
  min-width: 300px;
}

.cooperation-text {
  flex: 1;
  min-width: 300px;
}

/* Футер */
.footer {
  background-color: #333;
  color: #ddd;
  padding: 40px 0 20px;
}

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

.footer-column h4 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.footer-column p,
.footer-column a {
  color: #bbb;
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: block;
}

/* Ссылка ВНУТРИ строки контактов (например, <p>Тел.: <a>...</a></p>) не
   должна сама быть блочной — иначе она переносится под текст "Тел.:"/
   "Email:" на новую строку вместо того, чтобы продолжать её. Селектор
   специфичнее ".footer-column a" (добавлен родитель p), поэтому
   перекрывает display: block выше без !important. Ссылки, которые и
   должны идти каждая с новой строки (колонка "Документы" — через <br/>,
   не через <p>), это правило не затрагивает. */
.footer-column p a {
  display: inline;
}

.social-links a {
  margin-right: 15px;
  color: #c41e3a;
}

.social-links a:hover {
  opacity: 0.8;
}

.copyright {
  text-align: center;
  color: #999;
  font-size: 0.9rem;
  border-top: 1px solid #555;
  padding-top: 20px;
}

/* Строка с указанием разработчика/фотографа — по аналогии с
   templates/index_mobile.html (та же ссылка на t.me/maximzar_pbase). */
.footer-credit {
  text-align: center;
  color: #999;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 10px;
}

.footer-credit a {
  color: inherit;
}

/* Адаптив */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 15px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav a {
    margin: 0 10px;
  }

  .home h1 {
    font-size: 2rem;
  }

  .delivery-content,
  .cooperation-content,
  .constructor-content {
    flex-direction: column;
  }

  .delivery-image,
  .cooperation-image {
    max-width: 100%;
  }
}

/* Отзывы клиентов — блок над галереей "Наша ферма" (см. is_show_review в
   rhf/views.py, шаблон index.html). Фото отзыва показывается БЕЗ обрезки,
   в исходной ориентации (вертикальной/горизонтальной) — просто img с
   height:auto, без aspect-ratio/object-fit:cover, в отличие от карточек
   товара. Карточки выложены CSS-колонками (масонри без JS): высота
   каждой карточки своя, колонка заполняется сверху вниз. */
.reviews h2 {
  text-align: center;
  margin-bottom: 24px;
  color: #4a4a4a;
}

.reviews-grid {
  columns: 3 320px;
  column-gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.review-card {
  break-inside: avoid;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.review-card-photo {
  position: relative;
  cursor: pointer;
}

.review-card-photo img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

/* Значок "ещё N фото" — показывается только если в отзыве больше одного
   фото (см. photos|length в шаблоне): первым всегда фото самого букета
   (Review.product_thumbnail_url), клик по превью открывает попап-галерею
   с пролистыванием стрелками — тот же #product-gallery-modal, что и у
   фото товара в Магазине (см. openReviewGallery() ниже по странице). */
.review-card-photo-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 12px;
  pointer-events: none;
}

.review-card-body {
  padding: 16px 18px;
}

.review-card-stars {
  font-size: 18px;
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.review-card-stars .star-filled { color: #c41e3a; }
.review-card-stars .star-empty { color: #ddd; }

.review-card-comment {
  color: #444;
  line-height: 1.55;
  margin-bottom: 12px;
}

.review-card-name {
  font-weight: 600;
  color: #4a4a4a;
}

/* Галерея */
.gallery h2 {
  text-align: center;
  margin-bottom: 20px;
  color: #4a4a4a;
}

.carousel {
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.carousel-inner {
  display: flex;
  transition: transform 0.5s ease;
}

.carousel-image {
  width: 100%;
  flex-shrink: 0;
  object-fit: cover;
  height: 500px;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.carousel-image.active {
  opacity: 1;
}

/* Затрудняем сохранение фото фермы (галерея #carousel-inner конкретно —
   не трогаем #product-carousel-inner, там та же карусель переиспользуется
   для фото товаров, которые наоборот должны легко разглядываться). Не
   защита от скриншота — таких средств у браузера нет, только убирает
   самые удобные способы: выделение, перетаскивание, long-press на тач-
   экранах. Контекстное меню правой кнопкой блокируется в script.js. */
#carousel-inner .carousel-image {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Стрелки */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  padding: 16px;
  font-size: 24px;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.carousel-btn:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.prev {
  left: 10px;
}

.next {
  right: 10px;
}

/* Индикаторы */
.carousel-indicators {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.indicator {
  width: 12px;
  height: 12px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.indicator.active {
  background-color: white;
}

/* Элементы корзины */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eee;
  border-radius: 8px;
  align-items: center;
}

.cart-item img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
}

.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cart-item-name {
  font-weight: bold;
  font-size: 15px;
}

.cart-item-price {
  color: #666;
  font-size: 14px;
}

.cart-item-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cart-item-quantity button {
  width: 28px;
  height: 28px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  cursor: pointer;
  font-weight: bold;
  border-radius: 4px;
}

.cart-item-quantity input {
  width: 40px;
  text-align: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px;
}

.cart-item-remove {
  background: #f44336;
  color: white;
  border: none;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

.cart-item-remove:hover {
  background: #d32f2f;
}

/* Подвал корзины — ИСПРАВЛЕНО */
.cart-footer {
  margin-top: 20px;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

/* Контейнер для суммы и кнопки — ИСПРАВЛЕНО */
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Сумма заказа — слева */
.cart-total {
  text-align: left;
  font-weight: bold;
  color: #333;
  margin: 0;
}

/* Кнопка "Оформить заказ" — справа */
#checkout-btn {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: normal;
  white-space: nowrap;
}

#checkout-btn:hover:not(:disabled) {
  background: #45a049;
}

#checkout-btn:disabled {
  background: #cccccc;
  cursor: not-allowed;
}

.empty-message {
  text-align: center;
  color: #888;
  font-style: italic;
}

/* Модальное окно корзины — исправлено для Opera */
.cart-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: flex-start; /* ← Изменено с center на flex-start */
  z-index: 1000;
  padding-top: 50px; /* ← Добавлен отступ сверху */
  box-sizing: border-box;
}

.cart-modal {
  background: white;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh; /* ← Уменьшено с 90vh до 80vh */
  overflow-y: auto;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  margin: 0 auto; /* ← Добавлено центрирование */
  box-sizing: border-box;
}

/* Для Opera — дополнительная страховка */
@supports (-webkit-touch-callout: none) {
  .cart-modal-overlay {
    align-items: flex-start;
    padding-top: 60px;
  }
}

/* Модальное окно — общее */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background: white;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 28px;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
}

.close:hover {
  color: #c41e3a;
}

/* Видео и изображения главной страницы */
.farm-video,
.farm-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  margin: 20px 0;
  display: block;
}

/* Контейнер видео */
.video-wrapper {
  width: 100%;
  max-width: 100vw;
  position: relative;
  margin: 20px 0;
  border-radius: 8px;
  overflow: hidden;
}

.video-wrapper video {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: cover;
}

/* Модальное окно галереи товара */
#product-gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* 100dvh учитывает скрывающуюся адресную строку мобильного браузера —
     без этого 100vh на телефоне больше видимой области экрана, и часть
     попапа (включая крестик закрытия) оказывается за пределами экрана. */
  height: 100dvh;
  background-color: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

/* Внутренний контейнер попапа — раньше здесь был селектор ".modal", который
   не соответствовал реальной разметке (class="product-gallery-modal-content"),
   поэтому карточка товара оставалась полностью нестилизованной: без
   ограничения высоты и без overflow, из-за чего "не прокручивалась", а
   крестик закрытия (позиционированный внутри неё) мог уезжать за экран. */
#product-gallery-modal .product-gallery-modal-content {
  background: black;
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 90vh;
  height: 90dvh;
  max-height: 90vh;
  max-height: 90dvh;
  border-radius: 12px;
  overflow-y: auto;
}

/* Кнопка авторизации в хедере */
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.auth-button {
  background-color: #f8f8f8;
  color: #333;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid #ddd;
  transition: all 0.3s ease;
}

.auth-button:hover {
  background-color: #e8e8e8;
  border-color: #ccc;
}

/* Стиль для кнопки после входа */
.auth-button.profile {
  background-color: #e3f2fd;
  color: #1976d2;
  border-color: #90caf9;
}

.auth-button.profile:hover {
  background-color: #bbdefb;
}

/* Адаптив для видео */
@media (max-width: 768px) {
  .farm-video {
    max-height: 40vh;
    border-radius: 6px;
  }

  /* Попап галереи товара на телефоне — во всю ширину/высоту экрана
     (с учётом динамической панели браузера через dvh) и с явным
     внутренним скроллом, чтобы контент не обрезался без возможности
     его увидеть. */
  #product-gallery-modal .product-gallery-modal-content {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  /* Крестик закрытия попапа галереи — фиксируем относительно экрана,
     а не относительно прокручиваемого контента попапа, чтобы он
     всегда оставался на виду и не "уезжал" за пределы экрана. */
  #product-gallery-modal .close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 2100;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    color: #fff;
  }
}

.auth-button-style {
    background-color: #c41e3a;
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

.auth-button-style:hover {
    background-color: #a0182e;
}

/* Стиль кнопки Telegram */
.telegram-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #c41e3a;
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(196, 30, 58, 0.2);
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.telegram-button:hover {
    background-color: #a0182e;
    transform: scale(1.05);
}

.telegram-button svg {
    color: white;
}


/* === ИСПРАВЛЕНИЕ ДЛЯ OPERA: КНОПКИ АВТОРИЗАЦИИ === */
#auth-button,
#profile-button {
    align-items: center;
    gap: 15px;
    background-color: #f8f8f8;
    color: #333;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
}

#auth-button:hover,
#profile-button:hover {
    background-color: #e8e8e8;
    border-color: #ccc;
}


    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.9);
      display: flex;
      justify-content: center;
      align-items: center;
      z-index: 2000;
    }
    .modal {
      background: black;
      position: relative;
      width: 90%;
      max-width: 1200px;
      height: 90vh;
      border-radius: 12px;
      overflow: hidden;
    }
    .carousel { width: 100%; height: 100%; position: relative; }
    .carousel-inner { height: 100%; }
    .carousel-image {
      width: 100%;
      height: 100%;
      flex-shrink: 0;
      object-fit: contain;
    }
    .carousel-btn {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      background-color: rgba(255, 255, 255, 0.3);
      color: white;
      border: none;
      padding: 16px;
      font-size: 24px;
      cursor: pointer;
      z-index: 10;
      border-radius: 50%;
      width: 50px;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background-color 0.3s ease;
    }
    .carousel-btn:hover {
      background-color: rgba(255, 255, 255, 0.5);
    }
    .carousel-indicators {
      position: absolute;
      bottom: 15px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      gap: 10px;
      z-index: 10;
    }
    .indicator {
      width: 12px;
      height: 12px;
      background-color: rgba(255, 255, 255, 0.5);
      border-radius: 50%;
      cursor: pointer;
      transition: background-color 0.3s ease;
    }
    .indicator.active {
      background-color: white;
    }



/* Скрываем кнопки через JS, а не через CSS по умолчанию */
.auth-button-hidden {
    display: none !important;
}