/* Базовая палитра */
:root {
  --yt-dark-green: #2d3a2d;
  --yt-olive: #3d4a3d;
  --yt-accent: #9acd32;
  --yt-accent-hover: #8fbc8f;
  --yt-bronze: #b8860b;
  --yt-bronze-light: #cd9b1d;
  --yt-gray: #4a4a4a;
  --yt-gray-light: #6b6b6b;
  --yt-bg-dark: #1e261e;

  /* Подстройка bootstrap-переменных под палитру сайта */
  --bs-primary: var(--yt-bronze);
  --bs-primary-rgb: 184, 134, 11;
  --bs-link-color: var(--yt-olive);
  --bs-link-hover-color: var(--yt-dark-green);
  --bs-btn-focus-shadow-rgb: 184, 134, 11;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Хэдер сайта */
.site-header {
  background-color: var(--yt-bg-dark);
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.header-content {
  min-height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.header-logo {
  text-decoration: none;
  color: var(--yt-accent) !important;
  font-weight: 700;
  transition: opacity 0.2s ease;
  grid-column: 2;
  justify-self: center;
  max-width: min(44vw, 320px);
}

.header-logo:hover {
  opacity: 0.9;
}

.header-logo-img {
  height: 40px;
  width: auto;
  max-width: 100%;
  display: block;
}

.site-title {
  color: var(--yt-accent) !important;
  font-weight: 700;
}

/* Действия в хэдере (аккаунт и корзина) */
.header-actions {
  flex-shrink: 0;
  z-index: 2;
  grid-column: 3;
  justify-self: end;
}

.header-left {
  width: 42px;
  flex-shrink: 0;
  z-index: 2;
  grid-column: 1;
  justify-self: start;
}

.header-left-spacer {
  width: 42px;
  height: 1px;
}

/* Иконки в хэдере */
.header-icon {
  width: 24px;
  height: 24px;
  color: var(--yt-accent);
  transition: opacity 0.2s ease;
  display: block;
  flex-shrink: 0;
}

.header-icon:hover {
  opacity: 0.85;
}

/* Корзина */
.cart-link {
  text-decoration: none;
  display: flex;
  align-items: center;
}

.cart-icon {
  width: 24px;
  height: 24px;
}

.cart-badge {
  font-size: 0.7rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Аккаунт */
.account-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.account-link {
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: opacity 0.2s ease;
}

.account-link:hover {
  opacity: 0.85;
}

.account-link-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: opacity 0.2s ease;
}

.account-link-button:hover {
  opacity: 0.85;
}

/* Иконки аккаунта используют общий класс .header-icon */

/* Бургер меню в хэдере */
.header-navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.25rem 0.5rem;
  background-color: transparent;
}

.header-navbar-toggler .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%239acd32' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.header-navbar-toggler:hover,
.header-navbar-toggler:focus {
  border-color: var(--yt-accent);
  outline: none;
}

/* Навигация под хэдером (только для десктопа) */
.site-navbar {
  background-color: rgba(45, 58, 45, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0;
}

.site-nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-nav-item {
  margin: 0;
}

.site-nav-link {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  padding: 0.5rem 0;
  display: block;
  position: relative;
  transition: color 0.2s ease;
  font-size: 0.95rem;
}

.site-nav-link:hover {
  color: var(--yt-accent);
}

.site-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--yt-accent);
  transition: width 0.3s ease;
}

.site-nav-link:hover::after,
.site-nav-link.active::after {
  width: 100%;
}


.site-nav-list-mobile {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-nav-item-mobile {
  margin: 0;
}

.site-nav-link-mobile {
  color: var(--yt-gray);
  text-decoration: none;
  padding: 0.75rem 0;
  display: block;
  transition: color 0.2s ease, padding-left 0.2s ease;
  font-size: 1rem;
}

.site-nav-link-mobile:hover {
  color: var(--yt-dark-green);
  padding-left: 0.5rem;
}

.site-nav-link-mobile.active {
  color: var(--yt-dark-green);
  font-weight: 600;
}

/* Аккордеон категорий в мобильном меню */
#mainNavOffcanvas .mobile-main-accordion {
  margin-bottom: 0.5rem;
}

#mainNavOffcanvas .catalog-accordion-mobile {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

#mainNavOffcanvas .catalog-accordion-item {
  margin-bottom: 0.25rem;
}

#mainNavOffcanvas .catalog-accordion-header-inner {
  padding: 0.5rem 0;
}

#mainNavOffcanvas .catalog-accordion-link {
  padding: 0.5rem 0;
  font-size: 0.95rem;
}

#mainNavOffcanvas .catalog-nav-sublist {
  padding-left: 0.75rem;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

#mainNavOffcanvas .catalog-nav-sublink {
  font-size: 0.9rem;
  padding: 0.4rem 0.5rem;
}

/* Offcanvas для мобильного меню */
.offcanvas {
  background-color: #fff;
}

.offcanvas-header {
  background-color: var(--yt-bg-dark);
  color: rgba(255, 255, 255, 0.85);
}

.offcanvas-title {
  color: var(--yt-accent);
  font-weight: 700;
}

footer .footer-link {
  color: rgba(255, 255, 255, 0.75);
}

footer .footer-link:hover {
  color: rgba(255, 255, 255, 0.95);
}

.btn-primary {
  background-color: var(--yt-bronze);
  border-color: var(--yt-bronze);
}

.btn-primary:hover {
  background-color: var(--yt-bronze-light);
  border-color: var(--yt-bronze-light);
}

footer {
  background-color: var(--yt-bg-dark);
  color: rgba(255, 255, 255, 0.75);
}

/* Хлебные крошки */
.breadcrumb {
  --bs-breadcrumb-margin-bottom: 0;
  --bs-breadcrumb-divider-color: var(--yt-gray-light);
  padding: 0.5rem 0 1rem;
  margin-bottom: 0;
  font-size: 0.875rem;
  background-color: transparent;
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--yt-gray-light);
}

.breadcrumb-item a {
  color: var(--yt-gray);
  text-decoration: none;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.breadcrumb-item a:hover {
  color: var(--yt-dark-green);
  text-decoration: underline;
  text-decoration-color: rgba(154, 205, 50, 0.6);
}

.breadcrumb-item.active {
  color: var(--yt-gray-light);
  font-weight: 500;
}

@media (max-width: 575.98px) {
  .breadcrumb {
    font-size: 0.8rem;
    padding-top: 0.25rem;
    padding-bottom: 0.75rem;
  }
}

/* Каталог: сайдбар с категориями */
.catalog-sidebar-sticky {
  position: sticky;
  top: 1rem;
}

.catalog-nav-list {
  padding-left: 0;
  list-style: none;
}

.catalog-nav-list .nav-item {
  margin-bottom: 0.125rem;
}

.catalog-nav-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  color: var(--yt-gray);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.catalog-nav-link:hover {
  background-color: rgba(154, 205, 50, 0.12);
  color: var(--yt-dark-green);
}

.catalog-nav-link.active {
  background-color: rgba(154, 205, 50, 0.2);
  color: var(--yt-dark-green);
  font-weight: 600;
}

.catalog-nav-sublist {
  padding-left: 1rem;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  list-style: none;
}

.catalog-nav-sublist .nav-item {
  margin-bottom: 0.125rem;
}

.catalog-nav-sublink {
  font-size: 0.9375rem;
  padding: 0.35rem 0.5rem;
}

/* Аккордеон категорий */
.catalog-accordion .accordion-item {
  margin-bottom: 0.125rem;
}

.catalog-accordion-header,
.catalog-accordion-header-single {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: normal;
}

.catalog-accordion-header-inner {
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  width: 100%;
}

.catalog-accordion-link {
  display: block;
  text-decoration: none;
  font-size: 1rem;
  font-weight: normal;
}

.catalog-accordion-toggle {
  color: var(--yt-gray) !important;
  text-decoration: none !important;
  min-width: 1.75rem;
}

.catalog-accordion-toggle:hover {
  color: var(--yt-dark-green) !important;
}

.catalog-accordion-toggle .accordion-toggle-icon {
  display: inline-block;
  transition: transform 0.2s ease;
}

.catalog-accordion-toggle .accordion-toggle-icon::before {
  content: "";
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-bottom: 0.15rem;
}

.catalog-accordion-toggle[aria-expanded="true"] .accordion-toggle-icon::before {
  transform: rotate(-135deg);
  margin-bottom: -0.1rem;
}

.catalog-accordion-header-single .catalog-accordion-link {
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
}

.catalog-accordion .accordion-body {
  padding-left: 1.25rem;
  padding-right: 0.75rem;
}

/* Выдвижная панель категорий на мобиле — те же стили ссылок */
#catalogCategoriesOffcanvas .catalog-nav-link {
  padding: 0.6rem 0.75rem;
}

/* Каталог: карточка товара */
.catalog-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Видео в описании товара: адаптивно вписываем iframe в ширину блока */
.product-description {
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.product-description iframe {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  margin: 0.75rem 0;
  box-sizing: border-box;
}

.product-description img,
.product-description video,
.product-description embed,
.product-description object {
  max-width: 100% !important;
  height: auto;
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 991.98px) {
  /* Компактный хэдер на мобиле */
  .site-header {
    padding: 0.5rem 0;
  }

  .header-content {
    min-height: 50px;
  }

  .header-left {
    width: 42px;
  }

  .header-logo-img {
    height: 34px;
  }

  .header-logo {
    max-width: min(44vw, 220px);
  }

  .site-title {
    font-size: 1rem;
  }

  /* Скрыть текст "Личный кабинет" на мобиле, оставить только иконки */
  .account-link {
    font-size: 0.85rem;
  }

  /* Компактный бургер в хэдере */
  .header-navbar-toggler {
    padding: 0.2rem 0.4rem;
  }

  /* Компактные иконки на мобиле */
  .header-icon {
    width: 22px;
    height: 22px;
  }

  .cart-badge {
    font-size: 0.65rem;
    min-width: 16px;
    height: 16px;
  }
}

@media (max-width: 575.98px) {
  /* Еще более компактный хэдер на очень маленьких экранах */
  .site-title {
    font-size: 0.9rem;
  }

  .header-actions {
    gap: 0.5rem;
  }

  .header-logo-img {
    height: 28px;
  }

  .header-logo {
    max-width: min(55vw, 190px);
  }

  /* Компактные иконки на маленьких экранах */
  .header-icon {
    width: 20px;
    height: 20px;
  }

  .catalog-card .card-body {
    padding: 0.6rem;
  }

  .catalog-card .card-title {
    font-size: 0.9rem;
    margin-bottom: 0.35rem !important;
  }
}

/* Стрелки карусели товара: делаем контрастными на светлом фоне */
.carousel-control-prev-icon,
.carousel-control-next-icon {
  filter: none;
  opacity: 1;
}

.carousel-control-prev-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%239acd32'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
}

.carousel-control-next-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%239acd32'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 1 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

.carousel-indicators [data-bs-target] {
  background-color: rgba(154, 205, 50, 0.45);
}

.carousel-indicators .active {
  background-color: var(--yt-accent);
}

/* Скрыть бейдж корзины, если количество равно 0 */
.cart-badge:empty,
.cart-badge[data-count="0"] {
  display: none;
}

/* Улучшения для offcanvas на мобиле */
@media (max-width: 991.98px) {
  .offcanvas {
    max-width: 280px;
  }
}

/* Личный кабинет: аккордеоны в стиле сайта */
.account-accordion .accordion-item {
  border: 1px solid rgba(45, 58, 45, 0.2);
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.account-accordion .accordion-item:last-child {
  margin-bottom: 0;
}

.account-accordion .accordion-button {
  background-color: rgba(45, 58, 45, 0.06);
  color: var(--yt-dark-green);
  font-weight: 600;
  border: none;
  box-shadow: none;
  padding: 0.75rem 1rem;
}

.account-accordion .accordion-button:hover {
  background-color: rgba(45, 58, 45, 0.1);
  color: var(--yt-dark-green);
}

.account-accordion .accordion-button:not(.collapsed) {
  background-color: rgba(154, 205, 50, 0.15);
  color: var(--yt-dark-green);
  box-shadow: none;
}

.account-accordion .accordion-button:focus {
  box-shadow: 0 0 0 0.2rem rgba(154, 205, 50, 0.25);
  border-color: transparent;
}

.account-accordion .accordion-button::after {
  filter: none;
  opacity: 0.7;
}

.account-accordion .accordion-body {
  background-color: #fff;
  border-top: 1px solid rgba(45, 58, 45, 0.1);
  padding: 1rem;
}

/* Корзина: кнопки количества − число + */
.cart-qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.375rem);
  background-color: var(--bs-body-bg, #fff);
}

.cart-qty-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--yt-gray, #4a4a4a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.cart-qty-btn:hover {
  background-color: var(--bs-light, #f8f9fa);
  color: var(--yt-dark-green, #2d3a2d);
}

.cart-qty-btn:first-child {
  border-right: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.375rem) 0 0 var(--bs-border-radius, 0.375rem);
}

.cart-qty-btn:last-child {
  border-left: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0 var(--bs-border-radius, 0.375rem) var(--bs-border-radius, 0.375rem) 0;
}

.cart-qty-value {
  min-width: 2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* Корзина: подсветка строк в соответствии с палитрой */
.cart-table.table-hover > tbody > tr:hover > * {
  background-color: rgba(154, 205, 50, 0.06);
}

/* Корзина: мобильная вёрстка (карточки без заголовков) */
@media (max-width: 767.98px) {
  .cart-table-wrap {
    overflow-x: visible;
  }

  .cart-table,
  .cart-table tbody,
  .cart-table th {
    display: block;
  }

  .cart-table thead,
  .cart-table .cart-table-head {
    display: none !important;
  }

  .cart-table tbody tr.cart-item-row {
    display: grid;
    grid-template-columns: 80px 1fr auto auto;
    grid-template-rows: auto auto;
    gap: 0 0.75rem;
    align-items: center;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    -webkit-tap-highlight-color: transparent;
  }

  .cart-table tbody tr.cart-item-row:hover,
  .cart-table tbody tr.cart-item-row:active {
    background-color: transparent;
  }

  .cart-table tbody tr.cart-item-row td {
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
  }

  .cart-table tbody tr.cart-item-row td::before {
    display: none;
  }

  .cart-cell-photo {
    grid-column: 1;
    grid-row: 1;
  }

  .cart-cell-photo a {
    display: block;
  }

  .cart-item-img {
    max-width: 80px;
    max-height: 60px;
    width: auto;
    height: auto;
    border-radius: var(--bs-border-radius, 0.375rem);
  }

  .cart-item-img-placeholder {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    border-radius: var(--bs-border-radius, 0.375rem);
  }

  .cart-cell-product {
    grid-column: 2 / -1;
    grid-row: 1;
    min-width: 0;
  }

  .cart-cell-product a {
    min-width: 0;
  }

  .cart-cell-qty {
    grid-column: 2;
    grid-row: 2;
  }

  .cart-cell-qty .cart-quantity-form {
    margin: 0;
  }

  .cart-cell-total {
    grid-column: 3;
    grid-row: 2;
    justify-content: flex-end;
    font-size: 1.05rem;
  }

  .cart-cell-remove {
    grid-column: 4;
    grid-row: 2;
    justify-content: flex-end;
  }

  .cart-cell-remove .cart-remove-form {
    margin: 0;
  }
}

/* Варианты доставки CDEK: выбранный тариф в цвет основной кнопки */
.cdek-tariff-item.btn-primary {
  background-color: var(--yt-bronze);
  border-color: var(--yt-bronze);
  color: #fff;
}

.cdek-tariff-item.btn-primary .text-body-secondary {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* Модальное окно об использовании cookie */
.cookie-consent-modal .modal-content {
  background-color: var(--yt-bg-dark);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.cookie-consent-modal .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.cookie-consent-modal .modal-title {
  color: var(--yt-accent);
  font-weight: 600;
}

.cookie-consent-modal .cookie-consent-link {
  color: var(--yt-accent);
  text-decoration: underline;
}

.cookie-consent-modal .cookie-consent-link:hover {
  color: var(--yt-accent-hover);
}

.cookie-consent-modal .cookie-consent-accept-btn {
  background-color: var(--yt-bronze);
  border-color: var(--yt-bronze);
  color: #fff;
  font-weight: 500;
}

.cookie-consent-modal .cookie-consent-accept-btn:hover {
  background-color: var(--yt-bronze-light);
  border-color: var(--yt-bronze-light);
  color: #fff;
}
