/* ==========
   1. Header
   ========== */

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: rgba(249, 250, 251, 0.96);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #bbf7d0 0, #22c55e 40%, #16a34a 100%);
  color: #022c22;
  font-size: 16px;
}

.logo__text {
  letter-spacing: 0.02em;
}

/* ==========
   2. Navigation
   ========== */

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav__link {
  position: relative;
  font-size: 0.9rem;
  color: var(--sg-color-text-muted);
  padding: 4px 0;
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(to right, #22c55e, #16a34a);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--sg-transition-fast);
}

.nav__link:hover::after,
.nav__link:focus-visible::after,
.nav__link--active::after {
  transform: scaleX(1);
}

.nav__link--active {
  color: var(--sg-color-text);
  font-weight: 600;
}

/* ==========
   3. Header actions / CTA
   ========== */

.header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1.3;
  border: 1px solid transparent;
  background-color: transparent;
  color: inherit;
  transition: background-color var(--sg-transition-fast),
              border-color var(--sg-transition-fast),
              box-shadow var(--sg-transition-fast),
              transform var(--sg-transition-fast);
}

.btn__icon {
  font-size: 1rem;
}

.btn__text {
  white-space: nowrap;
}

.btn--primary {
  background: radial-gradient(circle at 20% 0, #bbf7d0 0, #22c55e 40%, #16a34a 100%);
  color: #022c22;
  box-shadow: var(--sg-shadow-md);
}

.btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--sg-shadow-soft);
}

.btn--outline {
  border-color: var(--sg-color-border);
  background-color: #ffffff;
}

.btn--outline:hover {
  border-color: var(--sg-color-border-strong);
  background-color: #f9fafb;
}

.btn--large {
  padding-inline: 18px;
  height: 44px;
}

/* ==========
   3.5. CTA Pulse Animation (Trust & Attention)
   ========== */

@keyframes btn-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
  }
}

.btn--primary.btn--large {
  animation: btn-pulse 2.5s ease-in-out infinite;
  position: relative;
}

.btn--primary.btn--large::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  z-index: -1;
  opacity: 0.3;
  filter: blur(8px);
}

/* Trust badge styles for purchase button */
.btn--purchase .btn__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.btn__text-main {
  font-weight: 600;
  line-height: 1.2;
}

.btn__text-sub {
  font-size: 0.7rem;
  opacity: 0.9;
  font-weight: 500;
}

.btn--purchase .btn__icon {
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  padding: 4px;
}

/* Header CTA button styles */
.btn--header-cta {
  padding: 6px 12px;
  height: auto;
}

.btn--header-cta .btn__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0px;
}

.btn--header-cta .btn__text-main {
  font-weight: 600;
  line-height: 1.2;
  font-size: 0.85rem;
}

.btn--header-cta .btn__text-sub {
  font-size: 0.65rem;
  opacity: 0.95;
  font-weight: 500;
}

.btn--header-cta .btn__icon {
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  padding: 3px;
  margin-right: 6px;
}

/* ==========
   4. Breadcrumbs
   ========== */

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--sg-color-text-muted);
}

.breadcrumb__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.breadcrumb__icon {
  font-size: 0.95rem;
}

.breadcrumb__separator {
  color: #cbd5f5;
}

.breadcrumb__current {
  color: var(--sg-color-text);
  font-weight: 500;
}

/* ==========
   5. Product card (listings & home)
   ========== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: var(--sg-radius-lg);
  background-color: #ffffff;
  box-shadow: var(--sg-shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
  transition: box-shadow var(--sg-transition-fast),
              transform var(--sg-transition-fast),
              border-color var(--sg-transition-fast),
              background-color var(--sg-transition-fast);
  overflow: hidden;
}

.product-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 50%, #22c55e 100%);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity var(--sg-transition-fast);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  background-color: #fafdfb;
}

.product-card:hover::before {
  opacity: 1;
}

.product-card__image {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  background: radial-gradient(circle at 20% 0, #f1f5f9 0, #e5e7eb 40%, #d1d5db 100%);
}

.product-card__image img {
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-card__title {
  font-size: 0.98rem;
  font-weight: 600;
}

.product-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.product-card__rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.star {
  font-size: 0.8rem;
  color: #e5e7eb;
}

.star--filled {
  color: #facc15;
}

.product-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.product-card__price {
  font-weight: 600;
}

.product-card__delivery {
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.product-card__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.product-card__actions-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ecfdf3 0%, #f0fdf4 100%);
  color: #166534;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(34, 197, 94, 0.2);
  transition: all var(--sg-transition-fast);
}

.product-card:hover .product-card__actions-cta {
  background: linear-gradient(135deg, #dcfce7 0%, #dcfce7 100%);
  border-color: rgba(34, 197, 94, 0.4);
}

.product-card__actions-icon {
  font-size: 0.85rem;
}

/* ==========
   6. Buttons in cards / wishlist
   ========== */

.btn--wishlist {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--sg-color-border);
  background-color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--wishlist:hover {
  border-color: #f97316;
  background-color: #fff7ed;
}

/* ==========
   7. Product page layout (frame only)
   ========== */

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
}

.product__gallery {
  min-width: 0;
}

.product__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product__title {
  font-size: 1.6rem;
  font-weight: 700;
}

.product__purchase {
  padding: 14px;
  border-radius: var(--sg-radius-lg);
  background-color: #ffffff;
  box-shadow: var(--sg-shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.stock-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.stock-badge--in-stock {
  background-color: #ecfdf3;
  color: #166534;
}

.delivery-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--sg-color-text-muted);
}

.purchase-actions {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========
   8. Tagline features row (icons)
   ========== */

.product__features {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.feature {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background-color: #ffffff;
  font-size: 0.8rem;
}

/* ========== 9. Tabs Shell (Fixed Logic) ========== */

.tab__radio {
  display: none !important; /* Полностью скрываем инпуты */
}

.product__tabs {
  margin-top: 32px;
}

.tabs__header {
  display: flex;
  gap: 4px;
  background-color: #f1f5f9;
  padding: 4px;
  border-radius: var(--sg-radius-md);
  margin-bottom: 16px;
  /* Для мобилок: разрешаем горизонтальный скролл, если табы не влезают */
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs__header::-webkit-scrollbar {
  display: none;
}

.tab__label {
  flex: 1 0 auto; /* Не даем табам сжиматься на мобилках */
  padding: 10px 16px;
  text-align: center;
  border-radius: var(--sg-radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--sg-color-text-muted);
  cursor: pointer;
  transition: all var(--sg-transition-fast);
  white-space: nowrap;
}

/* Скрываем все панели по умолчанию */
.tab__pane {
  display: none;
  padding: 24px;
  animation: fadeIn 0.2s ease-in-out;
}

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

/* ГЛАВНАЯ ЛОГИКА: Показываем панель, чья радиокнопка выбрана */
#tab-desc:checked ~ .tabs__content #tab-desc-content,
#tab-specs:checked ~ .tabs__content #tab-specs-content,
#tab-reviews:checked ~ .tabs__content #tab-reviews-content,
#tab-delivery:checked ~ .tabs__content #tab-delivery-content {
  display: block;
}

/* Подсветка активного таба (лейбла) */
#tab-desc:checked ~ .tabs__header [for="tab-desc"],
#tab-specs:checked ~ .tabs__header [for="tab-specs"],
#tab-reviews:checked ~ .tabs__header [for="tab-reviews"],
#tab-delivery:checked ~ .tabs__header [for="tab-delivery"] {
  background-color: #ffffff;
  color: var(--sg-color-primary);
  box-shadow: var(--sg-shadow-sm);
}

/* Адаптив для мобилок */
@media (max-width: 640px) {
  .tab__pane {
    padding: 16px;
  }
  .tab__label {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}


/* ==========
   10. Specs grid (характеристики)
   ========== */

.specs__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 18px;
}

.spec__item {
  padding: 8px 10px;
  border-radius: 10px;
  background-color: #f9fafb;
  border: 1px dashed rgba(226, 232, 240, 0.9);
}

.spec__name {
  font-size: 0.78rem;
  color: var(--sg-color-text-muted);
  margin-bottom: 2px;
}

.spec__value {
  font-size: 0.9rem;
}

/* ==========
   11. Footer
   ========== */

.footer {
  margin-top: 40px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  background-color: #ffffff;
}

.footer__inner {
  padding: 18px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--sg-color-text-muted);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ==========
   13. Search Modal
   ========== */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-overlay--open {
  opacity: 1;
  visibility: visible;
}

.search-modal {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  width: min(680px, calc(100% - 32px));
  max-height: calc(100vh - 160px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.search-modal--open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.search-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.search-modal__icon {
  font-size: 1.25rem;
  color: #22c55e;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  color: #0f172a;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1.1rem;
}

.search-modal__close:hover {
  background: #f3f4f6;
  border-color: #22c55e;
  color: #16a34a;
}

.search-modal__shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  font-size: 0.75rem;
  color: #6b7280;
  font-family: inherit;
}

.search-modal__body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-status {
  padding: 14px 20px;
  font-size: 0.9rem;
  text-align: center;
  color: #6b7280;
  background: #f9fafb;
}

.search-status--loading {
  color: #2563eb;
}

.search-status--error {
  color: #dc2626;
  background: #fef2f2;
}

.search-status--warning {
  color: #d97706;
  background: #fffbeb;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.search-results__count {
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 500;
}

.search-results__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  text-align: center;
  color: #6b7280;
}

.search-results__icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.search-results__empty p {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.search-results__hint {
  font-size: 0.85rem;
  color: #9ca3af;
}

.search-result-item {
  display: flex;
  gap: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  margin-bottom: 10px;
  transition: all 0.15s ease;
  cursor: pointer;
}

.search-result-item:hover,
.search-result-item:focus {
  border-color: #22c55e;
  background: #f0fdf4;
  outline: none;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

.search-result-item__image {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #f3f4f6;
}

.search-result-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-result-item__content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-result-item__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.search-result-item__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
  margin: 0;
}

.search-result-item__title mark {
  background: #fef3c7;
  color: #92400e;
  padding: 0 2px;
  border-radius: 2px;
}

.search-result-item__score {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
}

.search-result-item__desc {
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-item__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

.search-result-item__price {
  font-size: 0.9rem;
  font-weight: 700;
  color: #16a34a;
}

.search-result-item__price.out-of-stock {
  color: #d97706;
}

.search-result-item__category {
  font-size: 0.75rem;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search trigger button in header */
.search-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 1.1rem;
  margin-right: 8px;
}

.search-trigger:hover {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #16a34a;
}

.search-trigger__shortcut {
  position: absolute;
  bottom: -20px;
  right: 0;
  font-size: 0.65rem;
  color: #9ca3af;
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 4px;
}

/* ==========
   14. Responsive
   ========== */

@media (max-width: 960px) {
  .header__inner {
    gap: 10px;
  }

  .nav {
    gap: 10px;
  }

  .product {
    grid-template-columns: 1fr;
  }

  .search-modal {
    top: 60px;
    width: min(600px, calc(100% - 24px));
    max-height: calc(100vh - 120px);
  }
}

@media (max-width: 640px) {
  .header__inner {
    padding-block: 8px;
  }

  .nav {
    display: none;
  }

  .product-card__image img {
    height: 170px;
  }

  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .search-modal {
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .search-modal--open {
    transform: none;
  }

  .search-modal__header {
    padding: 12px 16px;
  }

  .search-modal__shortcut {
    display: none;
  }

  .search-result-item__image {
    width: 60px;
    height: 60px;
  }
}
