/* ========================================
   PinZap — Custom Styles (extracted + enhanced)
   ======================================== */

/* Original custom styles */
.hero-bg {
    background-size: cover;
    background-position: center;
    transition: background-image 0.3s ease-in-out;
}

/* Hero background enhancements */
#hero-banner {
    position: relative;
    min-height: 520px;
}

/* Subtle orange glows that work on top of the photo */
#hero-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 25% 35%, rgba(249, 115, 22, 0.12) 0%, transparent 55%),
        radial-gradient(circle at 75% 65%, rgba(249, 115, 22, 0.09) 0%, transparent 60%);
    pointer-events: none;
    mix-blend-mode: screen;
}

/* Bottom vignette for better text readability near search */
#hero-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 160px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.55), transparent);
    pointer-events: none;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.faq-item.active .faq-answer {
    max-height: 220px;
    padding-top: 1rem;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.catalog-item {
    transition: all 0.2s ease;
}

.toast {
    animation: slideUp 0.3s ease forwards;
}

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

.section-title {
    position: relative;
    display: inline-block;
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: #f97316;
    border-radius: 3px;
}

.gallery-thumb {
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gallery-thumb:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    border-color: #fed7aa;
}

.gallery-thumb.active {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.25);
}

/* Main image in product modal - zoom hint */
#modalMainImg {
    transition: transform 0.2s ease;
    max-height: 100%; /* controlled by the column container + overall modal max-h */
}

#modalMainImg:hover {
    transform: scale(1.015);
}

/* Lightbox image safety */
#lightboxImg {
    max-width: 95vw;
    max-height: 90vh;
}

/* Temporary highlight for search results */
.catalog-item {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Красивая подсветка при поиске */
.search-result-highlight {
    animation: searchHighlightPulse 2.6s ease-out forwards;
    box-shadow: 0 0 0 4px rgb(251 146 60 / 0.3);
    position: relative;
    z-index: 10;
}

@keyframes searchHighlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgb(251 146 60 / 0.5);
        transform: scale(1.02);
    }
    30% {
        box-shadow: 0 0 0 8px rgb(251 146 60 / 0.25);
    }
    70% {
        box-shadow: 0 0 0 12px rgb(251 146 60 / 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgb(251 146 60 / 0);
        transform: scale(1);
    }
}

.sticky-mobile-bar {
    display: none;
}

@media (max-width: 768px) {
    .sticky-mobile-bar {
        display: flex;
    }
}

/* Carousel */
.carousel-container {
    display: flex;
    transition: transform 0.4s ease-in-out;
    will-change: transform;
    padding-right: 2rem; /* prevents the right edge of the last card from being cropped by the overflow-hidden parent */
}

/* ========================================
   Wishlist Enhancements
   ======================================== */

.wishlist-heart {
    transition: transform 0.2s ease, color 0.2s ease;
}

.wishlist-heart:hover {
    transform: scale(1.15);
}

.wishlist-heart.active {
    color: #f97316;
}

.wishlist-card {
    transition: all 0.2s ease;
}

.wishlist-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.wishlist-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.wishlist-empty i {
    font-size: 3rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.wishlist-badge {
    transition: all 0.2s ease;
}

/* Product card heart */
.card-heart {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.92);
    border-radius: 9999px;
    padding: 6px 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    z-index: 10;
    cursor: pointer;
}

.card-heart i {
    font-size: 15px;
    color: #64748b;
    transition: color 0.2s ease;
}

.card-heart.active i {
    color: #f97316;
}

/* Бейджи «Новинка» / «В наличии» на фото карточек */
.catalog-item .relative,
#recentCarousel .relative {
  position: relative !important;
}

.card-badges {
  position: absolute !important;
  top: 0.5rem !important;
  left: 0.5rem !important;
  right: 3rem !important;
  z-index: 12 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.35rem !important;
  pointer-events: none !important;
}

.card-badge {
  display: inline-block !important;
  font-size: 0.625rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  padding: 0.2rem 0.45rem !important;
  border-radius: 9999px !important;
  letter-spacing: 0.02em !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
}

.card-badge-new {
  background: #f97316 !important;
  color: #ffffff !important;
}

.card-badge-stock {
  background: #16a34a !important;
  color: #ffffff !important;
}

.card-badge-out {
  background: #dc2626 !important;
  color: #ffffff !important;
}

img.pinzap-lazy {
  background: #f3f4f6;
  opacity: 0.35;
  transition: opacity 0.25s ease;
}

img.pinzap-lazy-loaded {
  opacity: 1;
}

/* Модалка «Наш склад и адрес» */
#addressModal .address-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  margin-bottom: 1rem !important;
}

#addressModal .address-close-btn,
#addressModal #addressCloseBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  border-radius: 9999px !important;
  background: #111827 !important;
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  font-size: 1.125rem !important;
  padding: 0 !important;
}

#addressModal .address-close-btn:hover,
#addressModal #addressCloseBtn:hover {
  background: #374151 !important;
  color: #ffffff !important;
}

/* Wishlist modal / drawer */
#wishlistModal {
    transition: opacity 0.2s ease;
}

#wishlistContent {
    max-height: 65vh;
    overflow-y: auto;
}

/* Admin table improvements */

/* Main page basic layout fallback (when Tailwind CDN not applying or for reliability) */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

#searchForm {
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 9999px;
  padding: 0.25rem;
  flex: 1;
  max-width: 400px;
  margin: 0 1rem;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  outline: none;
}

#searchForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

#categoryTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.cat-tab {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: white;
  color: #374151;
  transition: all 0.2s;
}

.cat-tab.bg-orange-500 {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

#filterForm {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
}

#filterForm input, #filterForm select {
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

#filterForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Product cards basic styles (complements the grid) */
.catalog-item {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.catalog-item .relative {
  position: relative;
  height: 12rem;
  background: #f3f4f6;
}

.catalog-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-item .p-4 {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.catalog-item h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0.25rem 0 0.5rem;
  cursor: pointer;
}

.catalog-item h4:hover {
  color: #f97316;
}

.catalog-item .text-xs {
  font-size: 0.75rem;
  color: #6b7280;
}

.catalog-item .mt-auto {
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid #f3f4f6;
}

.catalog-item .text-xl {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.catalog-item .text-\[10px\] {
  font-size: 0.625rem;
  color: #9ca3af;
}

.catalog-item .flex.gap-2 button {
  font-size: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
}

.catalog-item .bg-orange-500 {
  background: #f97316;
  color: white;
  border: none;
}

.catalog-item .border {
  border: 1px solid #d1d5db;
  background: white;
}

/* Search results info */
#searchResultsInfo {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* No results */
#noResults {
  text-align: center;
  padding: 2.5rem 0;
  color: #6b7280;
}

#noResults i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
}

/* Basic layout fallback for main page and catalog (in case Tailwind CDN fails to load/process dynamic content) */
#catalogGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  #catalogGrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  #catalogGrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.catalog-item {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.catalog-item:hover {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

.catalog-item .relative {
  position: relative;
}

.catalog-item img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
}

.catalog-item .p-4 {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.catalog-item .text-xs.text-orange-600 {
  color: #ea580c;
  font-size: 0.75rem;
  font-weight: 700;
}

.catalog-item h4 {
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25;
  margin: 0.25rem 0 0.5rem;
  cursor: pointer;
}

.catalog-item h4:hover {
  color: #ea580c;
}

.catalog-item .text-xs.space-y-0.5 {
  font-size: 0.75rem;
  color: #4b5563;
}

.catalog-item .mt-auto .text-xl {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1;
}

.catalog-item .mt-auto .text-\[10px\] {
  font-size: 0.625rem;
  color: #6b7280;
}

.catalog-item button {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
}

.catalog-item .bg-orange-500 {
  background-color: #f97316;
  color: white;
}

.catalog-item .border {
  border: 1px solid #d1d5db;
}

/* Basic page structure */
header, section, footer {
  display: block;
}

.container {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

.grid {
  display: grid;
}

.flex {
  display: flex;
}

@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Header and navigation basic layout */
header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Category tabs as buttons */
#categoryTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.cat-tab {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: white;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-tab.bg-orange-500,
.cat-tab.active {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

/* Filter form layout */
#filterForm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: white;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
}

#filterForm input,
#filterForm select {
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  min-width: 80px;
}

#filterForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Search input in header */
#searchForm {
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 9999px;
  padding: 0.25rem;
  flex: 1;
  max-width: 400px;
  margin: 0 1rem;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  outline: none;
}

#searchForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* Header and navigation basic layout */
header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Category tabs as buttons */
#categoryTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.cat-tab {
  padding: 0.5rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  background: white;
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.cat-tab.bg-orange-500,
.cat-tab.active {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

/* Filter form layout */
#filterForm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: white;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
}

#filterForm input,
#filterForm select {
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  min-width: 80px;
}

#filterForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Search input in header */
#searchForm {
  display: flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 9999px;
  padding: 0.25rem;
  flex: 1;
  max-width: 400px;
  margin: 0 1rem;
}

#searchInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  outline: none;
}

#searchForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* Header and nav basic */
header {
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 0;
}

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

/* Category tabs */
#categoryTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 1rem 0;
}

.cat-tab {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: white;
  color: #374151;
  transition: all 0.2s;
}

.cat-tab.bg-orange-500 {
  background: #f97316;
  color: white;
  border-color: #f97316;
}

/* Filter form */
#filterForm {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: white;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
}

#filterForm input[type="number"],
#filterForm select {
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

#filterForm button {
  background: #f97316;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* Search results info */
#searchResultsInfo {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}
.admin-table-row:hover {
    background-color: #f8fafc;
}

/* ========================================
   RELIABLE FULL-PAGE LAYOUT (NO EXTERNAL TAILWIND CDN)
   Полностью автономный layout на кастомных стилях + FontAwesome.
   Ранее использовался Tailwind Play CDN — теперь удалён для стабильности в RU.
   Все основные компоненты (header, hero, grids, карточки, табы, фильтры, 
   карусели, секции, футер) покрыты здесь.
   ======================================== */

/* Base document */
html, body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #1f2937;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

body.bg-gray-50 { background: #f8fafc; }

/* Containers and spacing system (most used) */
.container,
.container.mx-auto {
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
@media (min-width: 640px) {
  .container, .container.mx-auto { padding-left: 1.5rem; padding-right: 1.5rem; }
}

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }
.mb-4, .mb-6, .mb-8, .mb-10 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1, .mt-2, .mt-4, .mt-6 { margin-top: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Flex & Grid core (covers all the flex/grid used in header, hero, catalog, sections) */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: .5rem; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }

/* Responsive grids used in HTML */
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-end { align-items: flex-end; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:block { display: block; }
}
@media (min-width: 768px) {
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .md\:flex-row { flex-direction: row; }
  .md\:py-24 { padding-top: 6rem; padding-bottom: 6rem; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .lg\:flex { display: flex; }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .lg\:grid-cols-8 { grid-template-columns: repeat(8, minmax(0,1fr)); }
}

/* Visibility helpers used heavily */
.hidden { display: none !important; }
@media (min-width: 640px) { .sm\:block { display: block; } }
@media (min-width: 768px) { .md\:flex { display: flex; } }
@media (min-width: 1024px) { .lg\:flex { display: flex; } }

/* Header — dark slate version (matches the actual HTML) */
header,
header.bg-slate-900 {
  background: #0f172a !important;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  border-bottom: 1px solid #1e2937;
}
header .container,
header .container.mx-auto {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .5rem 1rem;
}
header a, header button { color: inherit; }

/* Logo area */
#site-logo-text { color: #f97316; font-weight: 900; letter-spacing: .05em; }
#site-logo-container img { max-height: 42px; width: auto; }

/* Top right controls */
header .bg-orange-500 { background: #f97316; }
header .bg-white { background: #fff; color: #374151; }
header .text-orange-400 { color: #fb923c; }
header .text-orange-500 { color: #f97316; }

/* HERO */
#hero-banner {
  position: relative;
  color: #fff;
  padding-top: 4rem;
  padding-bottom: 4rem;
  text-align: center;
  background-size: cover;
  background-position: center;
}
#hero-banner h1 { font-size: 2rem; font-weight: 800; line-height: 1.1; margin: 1rem 0; }
@media (min-width: 768px) { #hero-banner h1 { font-size: 3rem; } }
#hero-banner .bg-white {
  background: #fff;
  color: #1f2937;
  border-radius: 9999px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);
}

/* Quick request card */
section .bg-white.rounded-xl.shadow-xl,
#filterForm {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .05), 0 4px 6px -4px rgb(0 0 0 / .05);
}

/* Brands grid */
#brandsGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: .75rem;
}
@media (min-width: 640px) { #brandsGrid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (min-width: 768px) { #brandsGrid { grid-template-columns: repeat(5, minmax(0,1fr)); } }
@media (min-width: 1024px) { #brandsGrid { grid-template-columns: repeat(6, minmax(0,1fr)); } }
@media (min-width: 1280px) { #brandsGrid { grid-template-columns: repeat(8, minmax(0,1fr)); } }

/* Recent carousel (horizontal scroll snap) */
#recentCarousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
#recentCarousel::-webkit-scrollbar { display: none; }
#recentCarousel > div {
  min-width: 220px;
  max-width: 240px;
  flex-shrink: 0;
  scroll-snap-align: start;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* CATALOG SECTION */
#catalog { padding-top: 4rem; padding-bottom: 4rem; }
#catalog h2 { font-size: 1.875rem; font-weight: 800; color: #111827; }
#catalog .text-gray-500 { color: #6b7280; }

/* Category tabs (reinforce + active state) */
#categoryTabs, .flex.flex-wrap.justify-center.gap-2 {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1rem;
}
.cat-tab {
  padding: .5rem 1.25rem;
  border-radius: 9999px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  transition: all .2s ease;
  white-space: nowrap;
}
.cat-tab.bg-orange-500,
.cat-tab.active,
.cat-tab[style*="orange"] {
  background: #f97316 !important;
  color: #fff !important;
  border-color: #f97316 !important;
}

/* Price + sort bar */
.flex.flex-wrap.justify-center.items-end.gap-3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

/* Catalog grid — the most important for "12 товаров" */
#catalogGrid,
#catalogGrid.grid,
div#catalogGrid.grid.grid-cols-1 {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1.5rem !important;
}
@media (min-width: 640px) {
  #catalogGrid,
  div#catalogGrid.grid.grid-cols-1 {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }
}
@media (min-width: 1024px) {
  #catalogGrid,
  div#catalogGrid.grid.grid-cols-1 {
    grid-template-columns: repeat(4, minmax(0,1fr)) !important;
  }
}

/* Show more */
#showMoreCatalogWrapper {
  margin-top: 1.5rem;
  text-align: center;
}
#showMoreCatalogBtn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1.5rem;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 1rem;
  font-size: .875rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all .2s;
}
#showMoreCatalogBtn:hover {
  background: #fff7ed;
  border-color: #fdba74;
}

/* Stats section (dark) */
section.bg-slate-900 {
  background: #0f172a;
  color: #fff;
}
section.bg-slate-900 .bg-slate-800\/40 {
  background: rgba(30, 41, 59, .4);
  border: 1px solid #1e2937;
  border-radius: .75rem;
  padding: 1rem;
}
section.bg-slate-900 .text-orange-500 { color: #f97316; }

/* FAQ */
#faqContainer { max-width: 48rem; margin: 0 auto; }

.faq-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
  transition: box-shadow 0.2s ease;
}

.faq-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.faq-item button {
  font-size: 0.95rem;
  color: #111827;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
}

.faq-item button:hover {
  background: #f9fafb;
}

.faq-item .faq-icon {
  color: #f97316;
  transition: transform 0.2s ease;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
}

.faq-item.active .faq-answer {
  max-height: 200px;
  padding: 0.75rem 1.25rem 1rem;
}

.faq-answer p {
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.5;
  margin: 0;
}

/* News & Reviews carousels */
.carousel-container {
  display: flex;
  gap: 1.5rem;
  padding-right: 2rem; /* prevents right-side cropping of last card */
  /* overflow hidden is on the parent wrapper in HTML, do not set here or it can clip the translated content */
}

/* Extra safety: the news/reviews grids need room on the right when using transform carousel inside overflow-hidden parent */
#newsGrid, #reviewsGrid {
  padding-right: 1rem;
}

/* Section styling for news/reviews/faq to match the clean white card aesthetic of the quick form */
#news section,
#reviews section {
  background: #f8fafc;
}

#faqContainer {
  background: #fff;
  border-radius: 1rem;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
}
.news-card, .review-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem;
  min-width: 260px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.news-card:hover, .review-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.news-card .text-xs.text-gray-400,
.review-card .text-xs {
  font-size: 0.75rem;
  color: #6b7280;
}

.news-card h4,
.review-card p {
  font-size: 0.95rem;
  line-height: 1.4;
}

.news-card h4 {
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}

.review-card .text-amber-500 {
  color: #f59e0b;
  letter-spacing: -0.5px;
}

.review-card .mt-3 {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: #4b5563;
}

/* Footer */
footer,
footer.bg-slate-900 {
  background: #0f172a;
  color: #9ca3af;
  border-top: 4px solid #f97316;
}
footer .text-white { color: #fff; }
footer a:hover { color: #fff; }

/* Common text & button utilities that appear in HTML/JS */
.text-3xl { font-size: 1.875rem; font-weight: 800; }
.font-extrabold { font-weight: 800; }
.font-bold { font-weight: 700; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.text-orange-500 { color: #f97316; }
.text-orange-600 { color: #ea580c; }
.bg-orange-500 { background: #f97316; color: #fff; }
.bg-orange-600 { background: #ea580c; }
.rounded-2xl { border-radius: 1rem; }
.rounded-xl { border-radius: .75rem; }
.rounded-full { border-radius: 9999px; }
.shadow, .shadow-sm, .shadow-md { box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.border { border: 1px solid #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.hover\:bg-orange-50:hover { background: #fff7ed; }
.hover\:bg-gray-50:hover { background: #f9fafb; }
.transition { transition: all .2s ease; }

/* Buttons in catalog cards and elsewhere */
button, .btn {
  cursor: pointer;
  font-weight: 600;
}
button.bg-orange-500, .bg-orange-500 { background: #f97316; color: #fff; border: none; }
button.border, .border { border: 1px solid #d1d5db; background: #fff; }

/* Make sure cards always look like cards even if Tailwind classes not processed */
.catalog-item {
  display: flex !important;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  transition: box-shadow .2s, transform .2s;
}
.catalog-item:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1); }
.catalog-item img { width: 100%; height: 12rem; object-fit: cover; display: block; }
.catalog-item .p-4 { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.catalog-item h4 { font-size: .9375rem; font-weight: 700; margin: .25rem 0 .5rem; cursor: pointer; }
.catalog-item h4:hover { color: #ea580c; }

/* Search results banner */
#searchResultsInfo {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  padding: .5rem 1rem;
  border-radius: .5rem;
  margin-bottom: 1rem;
  font-size: .875rem;
}

/* No results */
#noResults { text-align: center; padding: 2.5rem 0; color: #6b7280; }

/* Promo banner — компактная выразительная полоска */
#promoBanner {
  max-width: 72rem;
}

.promo-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  flex-wrap: wrap !important;
  padding: 0.85rem 1.25rem !important;
  border-radius: 1rem !important;
  background: linear-gradient(135deg, #c2410c 0%, #ea580c 35%, #f97316 70%, #fb923c 100%) !important;
  color: #fff !important;
  box-shadow: 0 8px 28px rgba(234, 88, 12, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.promo-bar__content {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.promo-bar__badge {
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0.35rem 0.65rem !important;
  border-radius: 9999px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  font-size: 0.6875rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
}

.promo-bar__lines {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 1rem !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

.promo-bar__title {
  color: #fff !important;
  font-weight: 800 !important;
}

.promo-bar__sep {
  opacity: 0.75 !important;
  font-weight: 400 !important;
}

.promo-bar__text {
  color: rgba(255, 255, 255, 0.92) !important;
  font-weight: 600 !important;
}

.promo-bar__timer {
  flex-shrink: 0 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
  font-size: 0.9375rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  padding: 0.45rem 0.75rem !important;
  border-radius: 0.65rem !important;
  background: rgba(15, 23, 42, 0.35) !important;
  color: #fff !important;
  white-space: nowrap !important;
}

.promo-bar__timer::before {
  content: '⏱ ';
  opacity: 0.85;
}

@media (max-width: 640px) {
  .promo-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
    padding: 0.75rem 1rem !important;
  }
  .promo-bar__timer {
    align-self: flex-end !important;
    font-size: 0.875rem !important;
  }
  .promo-bar__lines {
    font-size: 0.9375rem !important;
  }
}

#promoBanner .rounded-2xl {
  border-radius: 1rem;
  background: linear-gradient(to right, #fff7ed, #fff);
  border: 1px solid #fed7aa;
}

/* Small polish */
.section-title:after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: #f97316;
  border-radius: 3px;
}

/* Print / misc safety */
* { box-sizing: border-box; }

/* ========================================
   ADDITIONAL TAILWIND UTILITY FALLBACKS (to replace CDN completely)
   These cover classes used in the static HTML (header, hero, forms, etc.)
   and JS-rendered content.
   ======================================== */

/* Dark header (bg-slate-900 text-white) */
header.bg-slate-900,
header[class*="bg-slate-900"] {
  background-color: #0f172a !important;
  color: #fff !important;
  position: sticky !important;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  border-bottom: 1px solid #1e2937;
}

header.bg-slate-900 .text-white,
header.bg-slate-900 a,
header.bg-slate-900 button {
  color: #fff;
}

header.bg-slate-900 .text-gray-400 { color: #9ca3af; }
header.bg-slate-900 .text-orange-400 { color: #fb923c; }
header.bg-slate-900 .text-orange-500 { color: #f97316; }

/* Layout utilities used heavily */
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-50 { z-index: 50; }
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }

.relative { position: relative; }
.z-10 { z-index: 10; }

.max-w-4xl { max-width: 56rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-2xl { max-width: 42rem; }

.mx-auto { margin-left: auto; margin-right: auto; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-16 { padding-top: 4rem; padding-bottom: 4rem; }

.pt-8 { padding-top: 2rem; }
.pb-2 { padding-bottom: 0.5rem; }

.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }

.-mt-10 { margin-top: -2.5rem; }

.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }

.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }

.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.ml-auto { margin-left: auto; }
.sm\:ml-0 { margin-left: 0; }

.hidden { display: none !important; }
.lg\:flex { display: flex; }
.sm\:block { display: block; }

/* Text utilities */
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-\[10px\] { font-size: 0.625rem; }
.text-\[11px\] { font-size: 0.6875rem; }

.font-semibold { font-weight: 600; }
.font-extrabold { font-weight: 800; }

.text-gray-200 { color: #e5e7eb; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }

.text-white { color: #fff; }

/* Backgrounds and buttons used in header/hero */
.bg-slate-800 { background-color: #1e2937; }
.bg-slate-900 { background-color: #0f172a; }

.bg-white { background-color: #fff; }
.bg-gray-50 { background-color: #f8fafc; }

.bg-orange-500 { background-color: #f97316; }
.bg-orange-600 { background-color: #ea580c; }

.hover\:bg-orange-600:hover { background-color: #ea580c; }
.hover\:bg-orange-400:hover { color: #fb923c; }

.shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
.shadow-xl { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); }

.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

.border { border-width: 1px; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }

.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.w-full { width: 100%; }
.w-9 { width: 2.25rem; }
.w-10 { width: 2.5rem; }

.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }

.min-w-\[16px\] { min-width: 16px; }

.max-w-\[120px\] { max-width: 120px; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.uppercase { text-transform: uppercase; }
.tracking-widest { letter-spacing: 0.1em; }

.leading-tight { line-height: 1.25; }

.cursor-pointer { cursor: pointer; }

.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

.whitespace-nowrap { white-space: nowrap; }

/* Quick request form inner labels etc. */
.block { display: block; }
.text-\[10px\] { font-size: 0.625rem; }

.focus\:border-orange-500:focus { border-color: #f97316; }
.outline-none { outline: 2px solid transparent; outline-offset: 2px; }

/* Gradient for promo (used in HTML) */
.bg-gradient-to-r { background-image: linear-gradient(to right, var(--tw-gradient-stops)); }
.from-orange-50 { --tw-gradient-from: #fff7ed; --tw-gradient-to: rgb(255 247 237 / 0); --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); }
.to-white { --tw-gradient-to: #fff; }

/* Misc used in hero and forms */
.bg-transparent { background-color: transparent; }
.text-gray-700 { color: #374151; }

/* Responsive adjustments (basic) */
@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-end { align-items: flex-end; }
  .sm\:justify-between { justify-content: space-between; }
  .sm\:ml-0 { margin-left: 0; }
  .sm\:block { display: block; }
}

@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:rounded-full { border-radius: 9999px; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:py-24 { padding-top: 6rem; padding-bottom: 6rem; }
  .md\:p-8 { padding: 2rem; }
  .md\:w-\[320px\] { width: 320px; }
  .md\:self-stretch { align-self: stretch; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex; }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* End additional utilities */

/* ========================================
   HERO SEARCH PILL AND QUICK REQUEST FORM - explicit nice styles
   So the top "найти запчасть" and "оставить запрос" look good without Tailwind.
   ======================================== */

#hero-banner .bg-white {
  background: #fff;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 48rem;
  margin: 0 auto;
  margin-bottom: 2rem;
  padding: 0.5rem;
}

@media (min-width: 768px) {
  #hero-banner .bg-white {
    flex-direction: row;
    align-items: center;
    border-radius: 9999px;
  }
}

#hero-banner #searchInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
  color: #374151;
}

#hero-banner button[onclick*="Catalog.search"] {
  background: #f97316;
  color: #fff;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 0.75rem;
  transition: background-color 0.2s;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  width: 100%;
}

@media (min-width: 768px) {
  #hero-banner button[onclick*="Catalog.search"] {
    border-radius: 9999px;
    width: auto;
  }
}

#hero-banner button[onclick*="Catalog.search"]:hover {
  background: #ea580c;
}

/* Quick request form - the white card */
section.container.mx-auto.px-4.-mt-10 > div {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  padding: 1.5rem;
  max-width: 64rem;
  margin: 0 auto;
}

@media (min-width: 768px) {
  section.container.mx-auto.px-4.-mt-10 > div {
    padding: 2rem;
  }
}

section.container.mx-auto.px-4.-mt-10 h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section.container.mx-auto.px-4.-mt-10 h3 i {
  color: #f97316;
}

#filterForm {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  #filterForm {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  #filterForm {
    grid-template-columns: repeat(4, 1fr);
  }
}

#filterForm label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

#filterForm input,
#filterForm select {
  width: 100%;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

#filterForm button[type="submit"] {
  width: 100%;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

#filterForm button[type="submit"]:hover {
  background: #1e2937;
}

/* ========================================
   MODAL POSITIONING - force center so they don't "уезжают вниз"
   Covers product modal, login, admin, etc.
   ======================================== */

#productModal,
#loginModal,
#adminModal,
#cartModal,
#addressModal,
#imageLightbox,
#wishlistModal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 70 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.6) !important;
  padding: 1rem !important;
}

#productModal > div,
#loginModal > div,
#adminModal > div,
#cartModal > div,
#addressModal > div,
#imageLightbox > div,
#wishlistModal > div {
  background: #fff !important;
  border-radius: 1rem !important;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25) !important;
  max-height: 95vh !important;
  overflow: auto !important;
  margin: 0 auto !important;
}

/* Cart specific for side drawer look (if justify-end is used) */
#cartModal > div {
  max-width: 28rem !important;
  margin-left: auto !important;
  margin-right: 0 !important;
  height: 100% !important;
  border-radius: 0 !important;
  box-shadow: -10px 0 30px rgba(0,0,0,0.3) !important;
}

/* ========================================
   HEADER ELEMENTS - ensure logo text, wishlist, Avito/Drom are visible and styled
   ======================================== */

#site-logo-text {
  color: #f97316 !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  display: block !important;
}

#site-logo-text-wrapper {
  display: block !important;
}

button[onclick*="Wishlist.openModal"] {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  color: #4b5563 !important;
  padding: 0.5rem 0.625rem !important;
  border-radius: 0.75rem !important;
}

button[onclick*="Wishlist.openModal"] i {
  color: #e11d48 !important;
}

a[id^="site-avito-top"] {
  background: #00A046 !important;
  color: #fff !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

a[id^="site-drom-top"] {
  background: #C8102E !important;
  color: #fff !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.375rem !important;
}

/* ========================================
   BASIC BODY AND LAYOUT TO PREVENT "НИЧЕГО НЕ ЗАГРУЖАЕТСЯ"
   ======================================== */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f8fafc;
  color: #1f2937;
  margin: 0;
  line-height: 1.5;
}

.container {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.grid {
  display: grid;
}

.flex {
  display: flex;
}

.hidden {
  display: none !important;
}

.rounded-2xl {
  border-radius: 1rem;
}

.bg-white {
  background: #fff;
}

.shadow-xl {
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.text-orange-500 {
  color: #f97316;
}

.font-bold {
  font-weight: 700;
}

/* Catalog grid basic */
#catalogGrid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

@media (min-width: 640px) {
  #catalogGrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  #catalogGrid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Catalog item basic card */
.catalog-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.05);
}

.catalog-item img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  display: block;
}

.catalog-item .p-4 {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* End rebuild utilities */

/* ========================================
   FORCE MAIN CONTENT VISIBLE AND HID E ADMIN/MODALS PROPERLY
   To fix the "nothing but the modal" issue.
   The main catalog, hero, header must be the default view.
   Admin and product modals only overlay when explicitly opened.
   ======================================== */

/* Force main body content to be visible and not covered */
body {
  background: #f8fafc !important;
  color: #1f2937 !important;
  overflow: visible !important;
}

/* Main structural elements - make sure they display and are not hidden or dimmed by default */
header,
#hero-banner,
section,
footer,
#catalog,
#brandsGrid,
#recentCarousel,
#catalogGrid,
#newsGrid,
#reviewsGrid,
#faqContainer {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background: inherit !important;
  color: inherit !important;
}

/* The admin modal must be hidden by default */
#adminModal {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#adminModal:not(.hidden) {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

/* Product modal - proper centered white card, ensure inner structure visible */
#productModal {
  display: none !important;
}

#productModal:not(.hidden) {
  display: flex !important;
}

#productModal > div {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
  max-width: 56rem !important; /* max-w-4xl */
  width: 100% !important;
  max-height: 95vh !important;
  overflow: hidden !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Make the two-column layout work (image left, info right) */
@media (min-width: 768px) {
  #productModal > div {
    flex-direction: row !important;
  }
}

#productModal .md\:w-1\/2 {
  width: 100% !important;
}

@media (min-width: 768px) {
  #productModal .md\:w-1\/2 {
    width: 50% !important;
  }
}

#productModal .md\:w-1\/2:first-child {
  background: #f3f4f6 !important; /* gray-100 */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  max-height: 60vh !important;
}

@media (min-width: 768px) {
  #productModal .md\:w-1\/2:first-child {
    max-height: 80vh !important;
    align-self: stretch !important;
  }
}

#productModal img#modalMainImg {
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

/* Right side content */
#productModal .md\:w-1\/2:last-child {
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

#productModal .flex-1.min-h-0.overflow-y-auto {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 0.5rem !important;
}

/* Text elements inside */
#productModal #modalBrand {
  color: #ea580c !important; /* orange-600 */
  font-size: 0.75rem !important;
  font-weight: 700 !important;
}

#productModal #modalTitle {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  margin-top: 0.25rem !important;
  color: #111827 !important;
}

#productModal #modalCompatibility,
#productModal .text-gray-500 {
  color: #6b7280 !important;
  font-size: 0.875rem !important;
}

#productModal #modalPrice {
  font-size: 1.875rem !important;
  font-weight: 900 !important;
  margin-bottom: 1rem !important;
}

#productModal #modalSpecs {
  background: #f8fafc !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem !important;
}

#productModal button.bg-orange-500 {
  background: #f97316 !important;
  color: white !important;
  font-weight: 700 !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.75rem !important;
  flex: 1 !important;
}

/* Gallery */
#productModal #modalGallery {
  position: absolute !important;
  bottom: 0.75rem !important;
  left: 0.75rem !important;
  right: 0.75rem !important;
  display: flex !important;
  gap: 0.5rem !important;
  background: rgba(255,255,255,0.9) !important;
  padding: 0.5rem !important;
  border-radius: 0.75rem !important;
}

#productModal .gallery-thumb {
  width: 3.5rem !important;
  height: 3.5rem !important;
  object-fit: cover !important;
  border-radius: 0.5rem !important;
  border: 2px solid transparent !important;
  cursor: pointer !important;
}

/* General modal content safety */
#productModal .text-2xl,
#productModal .text-3xl,
#productModal .font-extrabold,
#productModal .font-black {
  color: #111827 !important;
}

/* Make sure the dark overlay only applies when the modal is intentionally open */
#productModal:not(.hidden) {
  background: rgba(0, 0, 0, 0.6) !important;
}

/* Admin tabs and content - only style when admin is open */
#adminModal:not(.hidden) .border-b {
  border-bottom: 1px solid #e5e7eb !important;
}

#adminModal:not(.hidden) button:not(.admin-btn):not([id^="btnTab"]) {
  padding: 0.25rem 0.5rem !important;
  margin-right: 0.25rem !important;
  border-radius: 0.25rem !important;
  font-size: 0.75rem !important;
}

#adminModal:not(.hidden) button.text-orange-500,
#adminModal:not(.hidden) button[style*="orange"] {
  color: #f97316 !important;
  border-bottom: 2px solid #f97316 !important;
}

/* Ensure the main catalog grid and cards are visible and styled */
#catalogGrid {
  display: grid !important;
  grid-template-columns: repeat(1, 1fr) !important;
  gap: 1.5rem !important;
  padding: 1rem !important;
}

@media (min-width: 640px) {
  #catalogGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  #catalogGrid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

.catalog-item {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.75rem !important;
  overflow: hidden !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
  display: flex !important;
  flex-direction: column !important;
}

.catalog-item img {
  width: 100% !important;
  height: 12rem !important;
  object-fit: cover !important;
}

.catalog-item .p-4 {
  padding: 1rem !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Make the hero and quick form visible */
#hero-banner {
  min-height: 400px !important;
  background-size: cover !important;
  background-position: center !important;
  color: white !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

section.container.mx-auto.px-4.-mt-10 {
  margin-top: -2.5rem !important;
  position: relative !important;
  z-index: 10 !important;
}

/* Hide any unwanted overlays by default */
.sticky-mobile-bar {
  display: none !important;
}

@media (max-width: 768px) {
  .sticky-mobile-bar {
    display: flex !important;
  }
}

/* Ensure the main page is not permanently darkened */
body:not(:has(#productModal:not(.hidden))):not(:has(#adminModal:not(.hidden))):not(:has(#loginModal:not(.hidden))):not(:has(#cartModal:not(.hidden))) {
  background: #f8fafc !important;
}

/* Extra force for main content visibility in case of overlay issues.
   Note: do NOT set display:block on grids/carousels here, or they collapse to 1 col.
   Specific grid/flex rules below handle them. */
#hero-banner,
section,
header,
footer,
#recentCarousel,
#faqContainer {
  position: relative !important;
  z-index: 1 !important;
  background-color: #f8fafc !important;
  color: #1f2937 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Brands grid - force multi-column responsive grid (was collapsing to 1 col because of broad display:block in visibility block) */
#brandsGrid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 0.75rem !important;
  max-width: 72rem !important;
  margin: 0 auto !important;
}

@media (min-width: 640px) {
  #brandsGrid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 768px) {
  #brandsGrid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1024px) {
  #brandsGrid {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
}

@media (min-width: 1280px) {
  #brandsGrid {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
}

/* Brand cards inside #brandsGrid - make them look like proper cards (flex col, centered logo + name, hover) */
#brandsGrid > div {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 1rem !important;
  padding: 1rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

#brandsGrid > div:hover {
  background: #fff7ed !important; /* approx orange-50 */
  border-color: #fed7aa !important;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1) !important;
}

#brandsGrid > div img,
#brandsGrid > div > div:first-child {
  margin-bottom: 0.5rem !important;
  max-width: 56px !important;
  max-height: 56px !important;
}

#brandsGrid > div span {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: #374151 !important;
  line-height: 1.2 !important;
}

/* Additional common layout fixes for "и тд" (other grids/cards/sections that might still be off) */
#newsGrid,
#reviewsGrid {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 1.5rem !important;
  padding-bottom: 1rem !important;
  scroll-snap-type: x mandatory !important;
}

#newsGrid > div,
#reviewsGrid > div {
  flex: 0 0 280px !important;
  scroll-snap-align: start !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 1rem !important;
  padding: 1rem !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

/* Recent arrivals carousel (#recentCarousel) - must be horizontal scroll, not 1 column */
#recentCarousel {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 1rem !important;
  padding-bottom: 1rem !important;
  scroll-snap-type: x mandatory !important;
  -webkit-overflow-scrolling: touch !important;
}

#recentCarousel > div {
  min-width: 220px !important;
  max-width: 240px !important;
  flex-shrink: 0 !important;
  scroll-snap-align: start !important;
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
}

#recentCarousel > div .relative {
  height: 10rem !important;
}

#recentCarousel > div img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Fix for product modal opening as empty window: force the inner layout to two columns (image left, info right), make content visible with white bg, dark text, proper sizes. */
#productModal > div {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
  max-width: 56rem !important;
  width: 100% !important;
  max-height: 95vh !important;
  overflow: hidden !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
}

@media (min-width: 768px) {
  #productModal > div {
    flex-direction: row !important;
  }
}

#productModal .md\:w-1\/2 {
  width: 50% !important;
  display: block !important;
}

#productModal .md\:w-1\/2:first-child {
  background: #f3f4f6 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  height: 300px !important;
}

@media (min-width: 768px) {
  #productModal .md\:w-1\/2:first-child {
    height: auto !important;
    align-self: stretch !important;
  }
}

#productModal #modalMainImg {
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

#productModal .md\:w-1\/2:last-child {
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

#productModal .flex-1.min-h-0.overflow-y-auto {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 0.5rem !important;
}

#productModal #modalBrand {
  color: #ea580c !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
}

#productModal #modalTitle {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  margin-top: 0.25rem !important;
  color: #111827 !important;
}

#productModal #modalCompatibility,
#productModal .text-gray-500 {
  color: #6b7280 !important;
  font-size: 0.875rem !important;
}

#productModal #modalSpecs {
  display: block !important;
  background: #f8fafc !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem !important;
}

#productModal #modalPrice {
  font-size: 1.875rem !important;
  font-weight: 900 !important;
  margin-bottom: 1rem !important;
}

#productModal button.bg-orange-500 {
  background: #f97316 !important;
  color: white !important;
  font-weight: 700 !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.75rem !important;
}

#productModal .border {
  border: 1px solid #d1d5db !important;
  background: #fff !important;
  padding: 0.5rem !important;
  border-radius: 0.5rem !important;
}

/* Gallery thumbnails small at bottom, not big bar */
#productModal #modalGallery {
  display: flex !important;
  position: absolute !important;
  bottom: 0.5rem !important;
  left: 0.5rem !important;
  right: 0.5rem !important;
  background: rgba(255,255,255,0.9) !important;
  padding: 0.25rem !important;
  border-radius: 0.5rem !important;
  gap: 0.25rem !important;
  z-index: 10 !important;
}

#productModal .gallery-thumb {
  width: 2.5rem !important;
  height: 2.5rem !important;
  object-fit: cover !important;
  border-radius: 0.25rem !important;
  border: 2px solid transparent !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

/* Hide the "Увеличенное фото товара" bar if it's appearing as a full width element */
#productModal .text-sm:has(.fa-camera),
#productModal [class*="Увеличенное фото товара"] {
  display: none !important;
}

/* Force product modal inner panels to be visible and laid out correctly (two columns on desktop) */
#productModal > div > div:first-child,
#productModal > div > div:last-child {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

#productModal .md\:w-1\/2 {
  width: 100% !important;
}

@media (min-width: 768px) {
  #productModal .md\:w-1\/2 {
    width: 50% !important;
    float: left !important;
  }
  #productModal .md\:w-1\/2:last-child {
    float: right !important;
  }
}

#productModal #modalGallery {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 0.25rem !important;
  position: static !important;
  background: none !important;
  padding: 0.25rem 0 !important;
  margin-top: 0.5rem !important;
}

#productModal .gallery-thumb {
  width: 2rem !important;
  height: 2rem !important;
  flex-shrink: 0 !important;
}

/* Additional modal inner content fixes to prevent "empty window" */
#productModal .flex-1,
#productModal .mt-auto,
#productModal .pt-4,
#productModal .border-t,
#productModal .flex.gap-2 {
  display: block !important;
}

#productModal #modalSpecs {
  display: block !important;
}

#productModal button,
#productModal .border {
  display: inline-block !important;
  visibility: visible !important;
}

/* Product modal fixes: force the modal to show full structure when open, not empty window.
   Left: image area with gallery.
   Right: info, specs, price, buttons.
   Use !important to override any conflicts from other rules or Tailwind. */
#productModal {
  display: none !important;
}

#productModal:not(.hidden) {
  display: flex !important;
}

#productModal > div {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-radius: 1rem !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
  max-width: 56rem !important;
  width: 100% !important;
  max-height: 95vh !important;
  overflow: hidden !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
}

@media (min-width: 768px) {
  #productModal > div {
    flex-direction: row !important;
  }
}

#productModal .md\:w-1\/2 {
  width: 50% !important;
  display: block !important;
}

#productModal .md\:w-1\/2:first-child {
  background: #f3f4f6 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  height: 300px !important;
}

@media (min-width: 768px) {
  #productModal .md\:w-1\/2:first-child {
    height: auto !important;
    align-self: stretch !important;
  }
}

#productModal #modalMainImg {
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

#productModal .md\:w-1\/2:last-child {
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}

#productModal .flex-1.min-h-0.overflow-y-auto {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding-right: 0.5rem !important;
}

#productModal #modalBrand {
  color: #ea580c !important;
  font-size: 0.75rem !important;
  font-weight: 700 !important;
}

#productModal #modalTitle {
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  margin-top: 0.25rem !important;
  color: #111827 !important;
}

#productModal #modalCompatibility,
#productModal .text-gray-500 {
  color: #6b7280 !important;
  font-size: 0.875rem !important;
}

#productModal #modalSpecs {
  display: block !important;
  background: #f8fafc !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem !important;
}

#productModal #modalPrice {
  font-size: 1.875rem !important;
  font-weight: 900 !important;
  margin-bottom: 1rem !important;
}

#productModal button.bg-orange-500 {
  background: #f97316 !important;
  color: white !important;
  font-weight: 700 !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.75rem !important;
}

#productModal .border {
  border: 1px solid #d1d5db !important;
  background: #fff !important;
  padding: 0.5rem !important;
  border-radius: 0.5rem !important;
}

/* Gallery as small thumbnails at bottom left, not a full bar across */
#productModal #modalGallery {
  display: flex !important;
  position: absolute !important;
  bottom: 0.5rem !important;
  left: 0.5rem !important;
  right: 0.5rem !important;
  background: rgba(255,255,255,0.9) !important;
  padding: 0.25rem !important;
  border-radius: 0.5rem !important;
  gap: 0.25rem !important;
  z-index: 10 !important;
}

#productModal .gallery-thumb {
  width: 2.5rem !important;
  height: 2.5rem !important;
  object-fit: cover !important;
  border-radius: 0.25rem !important;
  border: 2px solid transparent !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

/* Hide any misplaced "Увеличенное фото товара" bar if it appears as text */
#productModal [class*="Увеличенное фото товара"] {
  display: none !important;
}

/* Force address modal hidden by default and main content visible so the main page shows first, not the modal */
#addressModal {
  display: none !important;
}

#addressModal:not(.hidden) {
  display: flex !important;
}

#hero-banner, section, #catalogGrid, footer {
  visibility: visible !important;
  opacity: 1 !important;
}

#hero-banner, section, #catalogGrid {
  display: block !important;
  z-index: 1 !important;
}

/* Header — тёмная шапка, flex внутри container; НЕ перебивать светлым фоном */
header,
header.bg-slate-900 {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  background-color: #0f172a !important;
  color: #fff !important;
  z-index: 50 !important;
}

header .container,
header > div {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  background: transparent !important;
  color: inherit !important;
}

/* Ensure sections have breathing room */
section {
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
}

section.bg-white {
  background: #fff !important;
}

section.bg-gray-100 {
  background: #f3f4f6 !important;
}

section.bg-slate-50 {
  background: #f8fafc !important;
}

/* Force the catalog section and grid to be visible and styled as a proper grid */
#catalog {
  display: block !important;
  padding: 2rem 0 !important;
  background: #f8fafc !important;
}

#catalogGrid {
  display: grid !important;
  grid-template-columns: repeat(1, 1fr) !important;
  gap: 1.5rem !important;
  padding: 1rem !important;
}

@media (min-width: 640px) {
  #catalogGrid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  #catalogGrid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

.catalog-item {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.75rem !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

.catalog-item img {
  width: 100% !important;
  height: 12rem !important;
  object-fit: cover !important;
  background: #f1f5f9 !important;
}

.catalog-item .p-4 {
  padding: 1rem !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Force hero and quick form to be visible */
#hero-banner {
  display: block !important;
  min-height: 400px !important;
  color: white !important;
  background-image: linear-gradient(rgba(15, 23, 42, 0.68), rgba(15, 23, 42, 0.78)), url('assets/hero-bg.jpg') !important;
  background-size: cover !important;
  background-position: center 30% !important;
}

section.container.mx-auto.px-4.-mt-10 {
  display: block !important;
  margin-top: -2.5rem !important;
  position: relative !important;
  z-index: 10 !important;
  background: transparent !important;
}

/* Make sure the main body content is not hidden behind any default overlays */
body {
  background-color: #f8fafc !important;
  color: #1f2937 !important;
}

/* Additional safety: if any modal backdrop is somehow applied, main content stays on top when modals are hidden */
body > header,
body > #hero-banner,
body > section,
body > footer {
  position: relative !important;
  z-index: 5 !important;
}

/* Address modal content styles (without Tailwind) */
#addressModal .space-y-4 > div {
  margin-bottom: 1rem;
}

#addressModal .uppercase {
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

#addressModal .font-semibold {
  font-weight: 600;
  color: #1f2937;
  font-size: 1rem;
}

#addressModal .text-gray-600 {
  color: #4b5563;
  font-size: 0.875rem;
}

#addressModal .pt-2 {
  padding-top: 0.5rem;
}

#addressModal .flex.gap-2 {
  display: flex;
  gap: 0.5rem;
}

#addressModal .pt-1 {
  padding-top: 0.25rem;
}

/* Make catalog grid always show as grid even if empty or partial JS */
#catalogGrid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
  gap: 1.5rem !important;
  padding: 1rem 0 !important;
  min-height: 200px !important;
}

.catalog-item {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.75rem !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}

.catalog-item img {
  width: 100% !important;
  height: 12rem !important;
  object-fit: cover !important;
  background: #f1f5f9 !important;
}

.catalog-item .p-4 {
  padding: 1rem !important;
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Basic card for when JS hasn't populated yet */
#catalogGrid:empty::after {
  content: "Каталог загружается... Если ничего не появляется - обновите страницу (Ctrl+Shift+R) или проверьте консоль.";
  grid-column: 1 / -1;
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
}


/* ========================================
   MODAL FIXES (prevent "уезжает вниз")
   Strong positioning for login, admin, product modals.
   ======================================== */

#loginModal,
#adminModal,
#productModal,
#imageLightbox,
#wishlistModal,
#cartModal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 70 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background-color: rgba(0, 0, 0, 0.7) !important;
  padding: 1rem !important;
}

#loginModal > div,
#adminModal > div {
  background: #fff !important;
  border-radius: 1rem !important;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25) !important;
  max-width: 24rem !important;
  width: 100% !important;
  max-height: 90vh !important;
  overflow: auto !important;
  margin: 0 auto !important; /* ensure not shifted */
}

#productModal > div {
  background: #fff !important;
  border-radius: 1rem !important;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25) !important;
  max-width: 56rem !important;
  width: 100% !important;
  max-height: 95vh !important;
  overflow: auto !important;
  margin: 0 auto !important;
}

/* Ensure inner content doesn't shift */
#loginModal form,
#adminModal .bg-white,
#productModal .bg-white {
  display: block !important;
}

/* ========================================
   TOP HERO SEARCH + QUICK FORM FIXES
   Make "найти запчасть" pill and "оставить запрос" card look clean.
   ======================================== */

#hero-banner .bg-white.p-2 {
  background: #fff !important;
  padding: 0.5rem !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 0.5rem !important;
  max-width: 48rem !important;
  margin: 0 auto !important;
  margin-bottom: 2rem !important;
}

@media (min-width: 768px) {
  #hero-banner .bg-white.p-2 {
    flex-direction: row !important;
    align-items: center !important;
    border-radius: 9999px !important;
    gap: 0.5rem !important;
  }
}

#hero-banner input#searchInput {
  flex: 1 !important;
  background: transparent !important;
  border: none !important;
  padding: 0.75rem 1rem !important;
  font-size: 0.95rem !important;
  outline: none !important;
  color: #374151 !important;
}

#hero-banner button[onclick*="Catalog.search"] {
  background: #f97316 !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 0.75rem 2rem !important;
  border-radius: 0.75rem !important;
  transition: background 0.2s ease !important;
  white-space: nowrap !important;
  cursor: pointer !important;
  border: none !important;
  font-size: 0.95rem !important;
  width: 100% !important;
}

@media (min-width: 768px) {
  #hero-banner button[onclick*="Catalog.search"] {
    border-radius: 9999px !important;
    width: auto !important;
  }
}

#hero-banner button[onclick*="Catalog.search"]:hover {
  background: #ea580c !important;
}

/* Quick request form card (the white rounded thing below hero) */
section.container.mx-auto.px-4.-mt-10 {
  position: relative !important;
  z-index: 10 !important;
  margin-top: -2.5rem !important;
}

section.container.mx-auto.px-4.-mt-10 > div.bg-white {
  background: #fff !important;
  border-radius: 1rem !important;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1) !important;
  padding: 1.5rem !important;
  max-width: 64rem !important;
  margin: 0 auto !important;
  border: 1px solid #f3f4f6 !important;
}

@media (min-width: 768px) {
  section.container.mx-auto.px-4.-mt-10 > div.bg-white {
    padding: 2rem !important;
  }
}

section.container.mx-auto.px-4.-mt-10 h3 {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin-bottom: 1rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

section.container.mx-auto.px-4.-mt-10 h3 i {
  color: #f97316 !important;
}

/* Form grid inside quick request */
#filterForm {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}

@media (min-width: 640px) {
  #filterForm {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (min-width: 768px) {
  #filterForm {
    grid-template-columns: 1fr 1fr 1fr 1fr !important;
  }
}

#filterForm label {
  display: block !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: #6b7280 !important;
  text-transform: uppercase !important;
  margin-bottom: 0.25rem !important;
}

#filterForm input,
#filterForm select {
  width: 100% !important;
  background: #f8fafc !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.5rem !important;
  padding: 0.625rem 0.75rem !important;
  font-size: 0.875rem !important;
  outline: none !important;
}

#filterForm input:focus,
#filterForm select:focus {
  border-color: #f97316 !important;
}

#filterForm button[type="submit"] {
  width: 100% !important;
  background: #0f172a !important;
  color: #fff !important;
  font-weight: 600 !important;
  padding: 0.625rem 1rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.875rem !important;
  cursor: pointer !important;
  border: none !important;
  transition: background 0.2s !important;
}

#filterForm button[type="submit"]:hover {
  background: #1e2937 !important;
}

/* ========================================
   ADMIN LOGIN MODAL INPUTS (prevent "уезжает" and ensure password works)
   ======================================== */

#loginModal form input {
  width: 100% !important;
  background: #f8fafc !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 0.75rem !important;
  padding: 0.75rem 1rem !important;
  font-size: 0.875rem !important;
  margin-bottom: 0.75rem !important;
  outline: none !important;
}

#loginModal form input:focus {
  border-color: #0f172a !important;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1) !important;
}

#loginModal form button {
  width: 100% !important;
  background: #0f172a !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 0.75rem 1rem !important;
  border-radius: 0.75rem !important;
  font-size: 0.95rem !important;
  cursor: pointer !important;
  border: none !important;
}

#loginError {
  color: #ef4444 !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  margin-bottom: 0.5rem !important;
}

/* Make sure login modal content is centered and not shifted */
#loginModal > div {
  margin: 0 auto !important;
  max-width: 22rem !important;
}

/* ========================================
   CART MODAL (right drawer) - fix for broken display
   The white bar at bottom in the screenshot is the bottom section of the cart modal
   (total + "Оформить через Telegram") that is showing because the drawer styles are incomplete.
   ======================================== */

#cartModal {
  display: none !important; /* default hidden */
}

#cartModal:not(.hidden) {
  display: flex !important;
  background-color: rgba(0, 0, 0, 0.6) !important;
}

#cartModal > div {
  background: #fff !important;
  width: 100% !important;
  max-width: 28rem !important; /* ~ max-w-md */
  height: 100% !important;
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25) !important;
  overflow: hidden !important;
  position: relative !important;
  margin-left: auto !important; /* push to right for the "justify-end" effect */
}

#cartModal h3 {
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  margin: 0 !important;
}

#cartModal .cart-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  flex-shrink: 0 !important;
  padding-bottom: 1rem !important;
  margin-bottom: 0.75rem !important;
  border-bottom: 1px solid #e5e7eb !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background: #ffffff !important;
}

#cartModal #cartCloseBtn,
#cartModal button[data-cart-close],
#cartModal .cart-item-remove {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  z-index: 5 !important;
  position: relative !important;
}

#cartModal .cart-close-btn,
#cartModal #cartCloseBtn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  min-width: 2.5rem !important;
  min-height: 2.5rem !important;
  border-radius: 9999px !important;
  background: #111827 !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  font-size: 1.125rem !important;
  line-height: 1 !important;
  padding: 0 !important;
}

#cartModal .cart-close-btn:hover,
#cartModal #cartCloseBtn:hover {
  background: #374151 !important;
  color: #ffffff !important;
}

#cartModal .cart-item-remove {
  color: #ef4444 !important;
  background: transparent !important;
  border: none !important;
  font-size: 1.25rem !important;
  line-height: 1 !important;
}

#cartModal .cart-item-remove:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

#wishlistModal #wishlistCloseBtn,
#wishlistModal button[data-wishlist-close] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  z-index: 5 !important;
  position: relative !important;
  color: #9ca3af !important;
  background: transparent !important;
  border: none !important;
}

#wishlistModal #wishlistCloseBtn:hover,
#wishlistModal button[data-wishlist-close]:hover {
  color: #374151 !important;
  background: #f3f4f6 !important;
}

#wishlistModal .wishlist-remove-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  min-width: 2rem !important;
  min-height: 2rem !important;
  border: none !important;
  background: transparent !important;
}

#wishlistModal .wishlist-remove-btn:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

#cartModal #cartItemsContainer {
  flex: 1 !important;
  overflow: auto !important;
  margin-bottom: 1rem !important;
}

#cartModal .pt-4.border-t {
  border-top: 1px solid #e5e7eb !important;
  padding-top: 1rem !important;
  margin-top: auto !important;
}

#cartModal .flex.justify-between.font-bold {
  display: flex !important;
  justify-content: space-between !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

#cartModal #cartTotalPrice {
  color: #f97316 !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
}

#cartModal button[onclick*="checkoutToTelegram"] {
  width: 100% !important;
  background: #229ED9 !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 0.875rem 1rem !important;
  border-radius: 0.75rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  border: none !important;
  cursor: pointer !important;
  font-size: 0.95rem !important;
}

#cartModal button[onclick*="checkoutToTelegram"]:hover {
  background: #1a7cb3 !important;
}

/* Items in cart */
#cartModal #cartItemsContainer > div {
  background: #f8fafc !important;
  padding: 0.75rem !important;
  border-radius: 0.75rem !important;
  margin-bottom: 0.5rem !important;
  font-size: 0.875rem !important;
}

/* Hide the sticky mobile bar when any modal (including cart) is open */
body:has(#cartModal:not(.hidden)) .sticky-mobile-bar,
body:has(#productModal:not(.hidden)) .sticky-mobile-bar,
body:has(#loginModal:not(.hidden)) .sticky-mobile-bar,
body:has(#adminModal:not(.hidden)) .sticky-mobile-bar {
  display: none !important;
}

/* Dedicated drawer styles for #cartModal to prevent the broken bottom bar */
#cartModal {
  display: none !important;
}

#cartModal:not(.hidden) {
  display: flex !important;
}

#cartModal > div {
  width: 100% !important;
  max-width: 28rem !important;
  height: 100vh !important;
  background: #fff !important;
  box-shadow: -8px 0 25px rgba(0,0,0,0.25) !important;
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  margin-left: auto !important;
}

#cartModal h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  flex-shrink: 0;
}

#cartModal #cartItemsContainer {
  flex: 1;
  overflow-y: auto;
}

/* ============================================================
   STRONG PRODUCT MODAL OVERRIDES (consolidated, high priority)
   This replaces many previous conflicting blocks.
   Goal: always show full content — main photo on left, gallery thumbs small at bottom of photo area,
   right side: brand/title/specs/OEM/stock/price/buttons visible, no empty window, no stray "Увеличенное фото" bar.
   ============================================================ */

#productModal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0,0,0,0.7) !important;
  z-index: 70 !important;
  display: none !important; /* controlled by .hidden + :not(.hidden) */
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem !important;
}

#productModal:not(.hidden) {
  display: flex !important;
}

#productModal > div {
  background: #ffffff !important;
  border-radius: 16px !important;
  width: 100% !important;
  max-width: 56rem !important;
  max-height: 95vh !important;
  overflow: hidden !important;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}

@media (min-width: 768px) {
  #productModal > div {
    flex-direction: row !important;
  }
}

/* Left column: image area */
#productModal > div > div:first-child {
  position: relative !important;
  background: #f3f4f6 !important;
  min-height: 220px !important;
  max-height: 60vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  flex: 1 1 50% !important;
  width: 100% !important;
}

@media (min-width: 768px) {
  #productModal > div > div:first-child {
    max-height: none !important;
    height: auto !important;
    min-height: 420px !important;
  }
}

#productModal #modalMainImg {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  display: block !important;
  background: #f3f4f6 !important;
}

/* Gallery thumbs — small strip at the BOTTOM of the image area, never a full-width bar */
#productModal #modalGallery {
  position: absolute !important;
  left: 12px !important;
  right: 12px !important;
  bottom: 12px !important;
  display: flex !important;
  gap: 6px !important;
  background: rgba(255,255,255,0.92) !important;
  padding: 6px !important;
  border-radius: 10px !important;
  z-index: 5 !important;
  flex-wrap: wrap !important;
  max-height: 72px !important;
  overflow: auto !important;
}

#productModal .gallery-thumb,
#productModal #modalGallery img {
  width: 44px !important;
  height: 44px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 2px solid transparent !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
  display: inline-block !important;
}

#productModal .gallery-thumb.active,
#productModal #modalGallery img.active {
  border-color: #f97316 !important;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3) !important;
}

/* Right column: text content */
#productModal > div > div:last-child {
  padding: 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  flex: 1 1 50% !important;
  width: 100% !important;
  background: #fff !important;
}

#productModal #modalBrand {
  color: #ea580c !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: block !important;
}

#productModal #modalTitle {
  font-size: 1.35rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  margin-top: 4px !important;
  color: #111827 !important;
  display: block !important;
}

#productModal #modalCompatibility {
  font-size: 13px !important;
  color: #6b7280 !important;
  margin-top: 4px !important;
}

#productModal #modalOem,
#productModal #modalStock {
  font-weight: 600 !important;
}

#productModal #modalSpecs {
  background: #f8fafc !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

#productModal #modalPrice {
  font-size: 1.85rem !important;
  font-weight: 900 !important;
  color: #111827 !important;
  margin-bottom: 12px !important;
  line-height: 1 !important;
}

/* Buttons area always visible at bottom of right column */
#productModal .mt-auto,
#productModal > div > div:last-child > div:last-child {
  margin-top: auto !important;
  padding-top: 14px !important;
  border-top: 1px solid #e5e7eb !important;
  flex-shrink: 0 !important;
}

#productModal button.bg-orange-500,
#productModal .bg-orange-500.text-white {
  background: #f97316 !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 12px 16px !important;
  border-radius: 12px !important;
  width: 100% !important;
}

#productModal .px-4.border.rounded-xl {
  padding: 10px 14px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 12px !important;
}

/* Kill any possible old "Увеличенное фото товара" bar or label inside the product modal */
#productModal [class*="Увеличенное"],
#productModal [alt*="Увеличенное фото"],
#productModal .text-sm:has(.fa-camera),
#productModal div[style*="Увеличенное"],
#productModal span[style*="Увеличенное"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Extra safety for empty states and close button */
#productModal button.absolute {
  z-index: 10 !important;
}

#productModal img {
  background: #f3f4f6 !important;
}

/* ============================================================
   GLOBAL NUCLEAR RULES AGAINST THE STRAY "Увеличенное фото товара" BAR
   This must kill the white bar + arrows no matter which modal it leaks into
   (product, login, admin, cart, address, etc.) and even if old HTML is deployed.
   ============================================================ */

#imageLightbox:not(.flex),
#imageLightbox.hidden {
  display: none !important;
}

#imageLightbox {
  display: none !important;
}

#imageLightbox.flex {
  display: flex !important;
}

/* Kill the exact bad text and any arrow nav that looks like the old lightbox/gallery bar */
body *:not(#imageLightbox):not(#imageLightbox *) {
  /* These will be further reinforced by JS sanitizer */
}

body [alt*="Увеличенное фото товара"]:not(#imageLightbox *) {
  display: none !important;
}

/* Any element containing the visible label text (covers old HTML versions) */
body > * [class*="Увеличенное"],
body > * [id*="Увеличенное"],
body div[style*="Увеличенное фото"],
body span[style*="Увеличенное фото"],
body [class*="lightbox"]:not(#imageLightbox):not(#imageLightbox *):not(#productPageLightbox):not(#productPageLightbox *),
body .gallery-bar,
body .photo-bar {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
}

/* Hide floating arrow buttons (‹ ›) and close X that belong to lightbox when lightbox is not the active full-screen one */
body:not(:has(#imageLightbox.flex)) button,
body:not(:has(#imageLightbox.flex)) .absolute {
  /* Only target small arrow-like controls that are not part of other UI */
}
body:not(:has(#imageLightbox.flex)) button[style*="position: absolute"],
body:not(:has(#imageLightbox.flex)) .left-2,
body:not(:has(#imageLightbox.flex)) .right-2,
body:not(:has(#imageLightbox.flex)) .top-1\/2 {
  /* Conservative: the JS sanitizer is the main hammer */
}

/* When any other modal is open, be extra sure the lightbox is gone */
body:has(#loginModal:not(.hidden)) #imageLightbox,
body:has(#adminModal:not(.hidden)) #imageLightbox,
body:has(#addressModal:not(.hidden)) #imageLightbox,
body:has(#cartModal:not(.hidden)) #imageLightbox {
  display: none !important;
}

/* Final safety: if the bad white bar somehow still renders, make it invisible */
body .text-sm:has(.fa-camera),
body [class*="Увеличенное фото товара"] {
  display: none !important;
}

#cartModal #cartItemsContainer {
  flex: 1 !important;
  overflow: auto !important;
  margin-bottom: 1rem;
  padding-right: 0.5rem;
}

#cartModal .pt-4.border-t {
  flex-shrink: 0;
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
}

#cartModal .flex.justify-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#cartModal button[onclick*="checkoutToTelegram"] {
  background: #229ED9;
  color: white;
  font-weight: 700;
  padding: 0.875rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

#cartModal button[onclick*="checkoutToTelegram"]:hover {
  background: #1a7cb3;
}

/* Style the cart items list */
#cartModal #cartItemsContainer > div {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
}

/* ========================================
   HEADER SPECIFIC FIXES (dark theme + logo + buttons)
   These ensure the header looks correct without Tailwind CDN.
   ======================================== */

/* Enforce dark header */
header,
header.bg-slate-900 {
  background-color: #0f172a !important;
  color: #fff !important;
  border-bottom: 1px solid #1e2937 !important;
}

/* Logo text next to logo */
#site-logo-text {
  color: #f97316 !important;
  font-size: 1.25rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.05em !important;
  display: block !important;
  line-height: 1 !important;
}

#site-logo-text + span,
header .text-\[10px\].text-gray-400 {
  color: #9ca3af !important;
  font-size: 0.625rem !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  display: block !important;
  margin-top: 0.125rem !important;
}

/* Right side controls in header */
header .flex.items-center.space-x-3 {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
}

/* Wishlist button (heart icon) */
button[onclick*="Wishlist.openModal"] {
  background: #fff !important;
  border: 1px solid #e5e7eb !important;
  color: #4b5563 !important;
  padding: 0.625rem !important;
  border-radius: 0.75rem !important;
  transition: all 0.2s ease !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  cursor: pointer !important;
}

button[onclick*="Wishlist.openModal"]:hover {
  background: #fff1f2 !important; /* rose-50 approx */
  border-color: #fda4af !important;
}

button[onclick*="Wishlist.openModal"] i.fa-heart {
  color: #e11d48 !important; /* rose-500 */
  font-size: 1rem !important;
}

/* Wishlist count badge */
#wishlistCount {
  background: #e11d48 !important;
  color: #fff !important;
  font-size: 0.625rem !important;
  font-weight: 700 !important;
  padding: 0.125rem 0.375rem !important;
  border-radius: 9999px !important;
  min-width: 16px !important;
  text-align: center !important;
  display: inline-block !important;
}

/* Avito button */
a[id="site-avito-top"],
a#site-avito-top {
  background-color: #00A046 !important;
  color: #fff !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

a[id="site-avito-top"]:hover,
a#site-avito-top:hover {
  background-color: #008f3d !important;
}

/* Drom button */
a[id="site-drom-top"],
a#site-drom-top {
  background-color: #C8102E !important;
  color: #fff !important;
  padding: 0.375rem 0.75rem !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

a[id="site-drom-top"]:hover,
a#site-drom-top:hover {
  background-color: #a50e25 !important;
}

/* Telegram icon link */
a[id="site-telegram-icon-link"],
a#site-telegram-icon-link {
  background-color: #229ED9 !important;
  color: #fff !important;
  padding: 0.625rem !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.25rem !important;
  height: 2.25rem !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

a[id="site-telegram-icon-link"]:hover,
a#site-telegram-icon-link:hover {
  background-color: #1a7cb3 !important;
}

/* WhatsApp icon link */
a[id="site-whatsapp-icon-link"],
a#site-whatsapp-icon-link {
  background-color: #25D366 !important;
  color: #fff !important;
  padding: 0.625rem !important;
  border-radius: 9999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2.25rem !important;
  height: 2.25rem !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

a[id="site-whatsapp-icon-link"]:hover,
a#site-whatsapp-icon-link:hover {
  background-color: #1da851 !important;
}

#cartModal button[onclick*="checkoutToWhatsApp"] {
  background-color: #25D366 !important;
  color: #fff !important;
}

#cartModal button[onclick*="checkoutToWhatsApp"]:hover {
  background-color: #1da851 !important;
}

/* Cart button already has good orange styles from previous fallbacks */

/* General header inner alignment fix */
header .container,
header > div {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  flex-wrap: wrap !important;
  width: 100% !important;
}

/* Make sure logo link is flex */
#site-logo-link {
  display: flex !important;
  align-items: center !important;
  gap: 0.75rem !important;
  text-decoration: none !important;
}

#site-logo-container {
  display: flex !important;
  align-items: center !important;
  min-width: 48px !important;
  min-height: 48px !important;
}

#site-logo-container img.site-logo-img,
.site-logo-img {
  display: block !important;
  height: 3.5rem !important;
  width: auto !important;
  max-width: 220px !important;
  object-fit: contain !important;
}

#productModal [data-modal-close] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 30 !important;
}

/* Hide text on very small screens if needed, but show the logo text properly */
@media (min-width: 640px) {
  .leading-none.hidden.sm\\:block {
    display: block !important;
  }
}

/* Ensure icons in header have proper color */
header i {
  color: inherit;
}

header i.text-orange-500 {
  color: #f97316 !important;
}

/* Force the logo text wrapper to always be visible next to logo (removed hiding classes) */
#site-logo-text-wrapper {
  display: block !important;
  line-height: 1 !important;
}

/* ============================================================
   v16 — ВОССТАНОВЛЕННЫЙ ФИНАЛЬНЫЙ БЛОК ИЗ РАБОЧЕЙ v14-ВЕРСИИ
   (был утерян при заливке более старого style.css)
   ============================================================ */

/* ===== v3: Modal overlay — flex when open ===== */
.modal-overlay { display: none; }
.modal-overlay:not(.hidden) { display: flex; }
.hidden { display: none !important; }

/* ===== FIX: закрытые модалки должны быть скрыты.
   Выше по файлу есть #loginModal,#adminModal,...{display:flex !important},
   и для loginModal/wishlistModal нет корректирующего :not(.hidden),
   из-за чего окно входа всплывало при каждой загрузке. ID-селектор с .hidden
   (специфичность выше, чем у одиночного #id) гасит это. ===== */
#productModal.hidden,
#loginModal.hidden,
#adminModal.hidden,
#cartModal.hidden,
#addressModal.hidden,
#imageLightbox.hidden,
#wishlistModal.hidden { display: none !important; }

/* Блокировка прокрутки фона, пока открыта любая модалка. */
body:has(.modal-overlay:not(.hidden)) {
  overflow: hidden !important;
}

/* Карточка товара должна быть flex-контейнером */
#productModal > div.bg-white {
  display: flex !important;
}

/* Половина с фото */
#productModal > div.bg-white > div:first-of-type {
  height: min(300px, 38vh) !important;
  flex-shrink: 0 !important;
}

@media (min-width: 768px) {
  #productModal > div.bg-white > div:first-of-type {
    height: auto !important;
    align-self: stretch !important;
    flex: 0 0 50% !important;
  }
  #productModal > div.bg-white > div:last-of-type {
    flex: 1 1 50% !important;
  }
}

/* Возвращаем hero-блоку фоновую фотографию и белый текст: общее правило
   "section { background:#f8fafc !important }" выше закрашивало картинку серым */
section.hero-bg,
#hero-banner.hero-bg {
  background: linear-gradient(rgba(15, 23, 42, 0.68), rgba(15, 23, 42, 0.78)), url('../assets/hero-bg.jpg') !important;
  background-color: #0f172a !important;
  background-size: cover !important;
  background-position: center 30% !important;
  color: #ffffff !important;
  padding: 4rem 1rem !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
}
section.hero-bg h1,
#hero-banner.hero-bg h1 {
  color: #ffffff !important;
  font-size: 2.25rem !important;
}
@media (min-width: 768px) {
  section.hero-bg h1,
  #hero-banner.hero-bg h1 { font-size: 3rem !important; }
}
section.hero-bg .text-gray-200,
#hero-banner.hero-bg .text-gray-200 { color: #e5e7eb !important; }

/* ============================================================
   ЕДИНЫЙ СТИЛЬ ШАПКИ И ПОДВАЛА + ПОЧИНКА ИЗБРАННОГО И ПОИСКА
   ============================================================ */

/* Шапка: тёмная, прилипает при прокрутке */
body > header {
  position: sticky !important;
  top: 0 !important;
  z-index: 50 !important;
  background: #0f172a !important;
  color: #fff !important;
  border-radius: 0 !important;
  margin: 0 !important;
}

/* Адрес (≥768px) и телефон (≥640px) в шапке */
@media (min-width: 768px) {
  header .hidden.md\:flex { display: flex !important; }
}
@media (min-width: 640px) {
  header .hidden.sm\:block { display: block !important; }
}
header #site-phone-link-top { color: #fff !important; }
header #site-phone-link-top:hover { color: #fb923c !important; }

/* Кнопки и ссылки-кнопки в шапке: одна высота, один радиус */
header button,
header a#site-avito-top,
header a#site-drom-top,
header a#site-telegram-icon-link,
header a#site-whatsapp-icon-link {
  height: 40px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 0.75rem !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
header a#site-telegram-icon-link,
header a#site-whatsapp-icon-link { width: 40px !important; }

/* Подвал: в один стиль с шапкой (тёмный, оранжевая линия сверху) */
body > footer {
  background: #0f172a !important;
  color: #9ca3af !important;
  padding: 1.75rem 1rem 1rem !important;
  border-radius: 0 !important;
  margin: 0 !important;
  border-top: 4px solid #f97316 !important;
  font-size: 0.875rem !important;
}
footer h5 {
  color: #ffffff !important;
  font-size: 1rem !important;
  margin-bottom: 0.5rem !important;
}
footer a { color: inherit; }
footer a:hover { color: #ffffff !important; }
footer .grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1.25rem !important;
}
@media (min-width: 768px) {
  footer .grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Нижняя строка подвала: разработка слева, политика справа */
.footer-bottom-bar {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem !important;
  font-size: 0.6875rem !important;
  line-height: 1.4 !important;
  color: #6b7280 !important;
}
@media (min-width: 640px) {
  .footer-bottom-bar {
    flex-direction: row !important;
    align-items: center !important;
  }
  .footer-dev { text-align: left !important; }
  .footer-legal {
    text-align: right !important;
    margin-left: auto !important;
  }
}
.footer-dev a { color: #fb923c !important; }
.footer-dev a:hover { color: #fdba74 !important; }
.footer-legal a { color: #9ca3af !important; }
.footer-legal a:hover { color: #fb923c !important; }
.footer-legal-operator {
  display: block;
  margin-top: 0.15rem;
  color: #4b5563 !important;
  font-size: 0.625rem !important;
}
@media (min-width: 640px) {
  .footer-legal-operator {
    display: inline;
    margin-top: 0;
    margin-left: 0.5rem;
  }
}

/* Строка поиска в hero: мобильный — скруглённый прямоугольник, десктоп — pill */
.hero-search-bar,
#hero-banner .hero-search-bar {
  border-radius: 0.75rem !important;
}
@media (min-width: 768px) {
  .hero-search-bar,
  #hero-banner .hero-search-bar {
    border-radius: 9999px !important;
  }
}


/* На мобильном — столбиком; на десктопе input слева, кнопка справа */
section.hero-bg .bg-white.p-2,
#hero-banner.hero-bg .bg-white.p-2 {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.5rem !important;
}
section.hero-bg .bg-white.p-2 > div {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
}
section.hero-bg .bg-white.p-2 button {
  flex: 0 0 auto !important;
  background: #f97316 !important;
  color: #fff !important;
  font-weight: 700 !important;
  padding: 0.75rem 2rem !important;
  border-radius: 0.75rem !important;
  white-space: nowrap !important;
  width: 100% !important;
}
section.hero-bg .bg-white.p-2 button:hover { background: #ea580c !important; }
@media (min-width: 768px) {
  section.hero-bg .bg-white.p-2,
  #hero-banner.hero-bg .bg-white.p-2 {
    flex-direction: row !important;
    align-items: center !important;
    border-radius: 9999px !important;
  }
  section.hero-bg .bg-white.p-2 button {
    border-radius: 9999px !important;
    width: auto !important;
  }
}

/* Избранное: каркас модалки */
#wishlistModal > div {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  max-width: 48rem !important;
  max-height: 90vh !important;
  background: #fff !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
}
#wishlistModal > div > div:first-child {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 1.25rem !important;
  border-bottom: 1px solid #e5e7eb !important;
  flex-shrink: 0 !important;
}
#wishlistModal > div > div:first-child .flex { display: flex !important; gap: 0.5rem !important; align-items: center !important; }
#wishlistContent {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  padding: 1.25rem !important;
}
#wishlistModal > div > div:last-child {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 0.75rem !important;
  padding: 1.25rem !important;
  border-top: 1px solid #e5e7eb !important;
  flex-shrink: 0 !important;
}

/* Избранное: сетка и карточки */
#wishlistContent .grid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1rem !important;
}
@media (min-width: 768px) {
  #wishlistContent .grid { grid-template-columns: 1fr 1fr !important; }
}
.wishlist-card {
  display: flex !important;
  flex-direction: row !important;
  gap: 1rem !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 1rem !important;
  padding: 1rem !important;
  background: #fff !important;
}
.wishlist-card > div:first-child {
  width: 6rem !important;
  height: 6rem !important;
  flex-shrink: 0 !important;
  border-radius: 0.75rem !important;
  overflow: hidden !important;
  background: #f3f4f6 !important;
}
.wishlist-card > div:first-child img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}
.wishlist-card > div:last-child { flex: 1 1 auto !important; min-width: 0 !important; }
.wishlist-card .justify-between { display: flex !important; justify-content: space-between !important; gap: 0.5rem !important; }
.wishlist-empty { text-align: center !important; padding: 2rem 1rem !important; color: #6b7280; }
.wishlist-empty .fa-heart { font-size: 2.5rem; color: #fda4af; }

/* ============================================================
   БАЗОВОЕ ПОЗИЦИОНИРОВАНИЕ МОДАЛОК
   В самописном CSS нет Tailwind-утилит .fixed/.inset-0, поэтому все
   оверлеи рендерились в потоке страницы ниже экрана. ============================================================ */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 80;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.7);
}
/* Корзина — выезжающая панель справа */
#cartModal { justify-content: flex-end; padding: 0 !important; }
/* Лайтбокс всегда поверх остальных модалок */
#imageLightbox { z-index: 100; background: rgba(0, 0, 0, 0.93); }

/* Нижняя мобильная панель */
@media (max-width: 768px) {
  .sticky-mobile-bar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    z-index: 60;
    box-sizing: border-box;
  }
  body { padding-bottom: 70px; }
}

/* ============================================================
   v13 — НЕДОСТАЮЩИЕ TAILWIND-УТИЛИТЫ + МОБИЛЬНАЯ ВЁРСТКА
   Разметка использует Tailwind-классы, но CDN не подключён.
   ============================================================ */

/* --- Позиционирование --- */
.fixed { position: fixed; }
.absolute { position: absolute; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.top-4 { top: 1rem; }
.right-4 { right: 1rem; }
.bottom-3 { bottom: 0.75rem; }
.left-3 { left: 0.75rem; }
.bottom-5 { bottom: 1.25rem; }
.left-2 { left: 0.5rem; }
.right-2 { right: 0.5rem; }
.-left-3 { left: -0.75rem; }
.-right-3 { right: -0.75rem; }
.top-1\/2 { top: 50%; }
.left-1\/2 { left: 50%; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.-translate-x-1\/2 { transform: translateX(-50%); }

/* --- Flex / grid --- */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.shrink-0 { flex-shrink: 0; }
.min-h-0 { min-height: 0; }
.inline-flex { display: inline-flex; }
.items-end { align-items: flex-end; }
.justify-around { justify-content: space-around; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.gap-1 { gap: 0.25rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }

/* --- Overflow / размеры --- */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.max-w-6xl { max-width: 72rem; }
.max-w-md { max-width: 28rem; }
.max-w-sm { max-width: 24rem; }
.max-w-\[1200px\] { max-width: 1200px; }
.max-h-\[60vh\] { max-height: 60vh; }
.max-h-\[80vh\] { max-height: 80vh; }
.max-h-\[90vh\] { max-height: 90vh; }
.max-h-\[92vh\] { max-height: 92vh; }
.max-h-\[95vh\] { max-height: 95vh; }
.max-h-full { max-height: 100%; }
.max-w-full { max-width: 100%; }
.w-24 { width: 6rem; }
.w-11 { width: 2.75rem; }
.h-11 { height: 2.75rem; }
.object-contain { object-fit: contain; }
.object-cover { object-fit: cover; }
.snap-x { scroll-snap-type: x mandatory; }
.snap-mandatory { scroll-snap-type: x mandatory; }
.scroll-smooth { scroll-behavior: smooth; }
.pointer-events-none { pointer-events: none; }

/* --- Z-index (произвольные) --- */
.z-\[60\] { z-index: 60; }
.z-\[70\] { z-index: 70; }
.z-\[80\] { z-index: 80; }
.z-\[100\] { z-index: 100; }
.z-20 { z-index: 20; }

/* --- Типографика / цвета --- */
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.font-medium { font-weight: 500; }
.font-black { font-weight: 900; }
.text-orange-600 { color: #ea580c; }
.text-rose-500 { color: #f43f5e; }
.border-t { border-top-width: 1px; }
.border-orange-200 { border-color: #fed7aa; }
.border-slate-800 { border-color: #1e2937; }
.bg-orange-50 { background-color: #fff7ed; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-black\/70 { background-color: rgba(0, 0, 0, 0.7); }
.bg-black\/95 { background-color: rgba(0, 0, 0, 0.95); }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9); }
.bg-white\/10 { background-color: rgba(255, 255, 255, 0.1); }
.bg-black\/40 { background-color: rgba(0, 0, 0, 0.4); }
.bg-black\/50 { background-color: rgba(0, 0, 0, 0.5); }
.bg-black\/60 { background-color: rgba(0, 0, 0, 0.6); }
.bg-slate-800\/40 { background-color: rgba(30, 41, 59, 0.4); }
.text-white\/80 { color: rgba(255, 255, 255, 0.8); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.pt-4 { padding-top: 1rem; }
.pb-4 { padding-bottom: 1rem; }
.pr-2 { padding-right: 0.5rem; }
.mb-0\.5 { margin-bottom: 0.125rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-auto { margin-top: auto; }
.-top-1 { top: -0.25rem; }
.-right-1 { right: -0.25rem; }

/* --- Доли ширины --- */
.w-1\/2 { width: 50%; }
.md\:w-1\/2 { width: 100%; }
@media (min-width: 768px) {
  .md\:w-1\/2 { width: 50%; }
  .md\:flex { display: flex; }
  .md\:max-h-\[80vh\] { max-height: 80vh; }
  .md\:self-stretch { align-self: stretch; }
  .md\:left-4 { left: 1rem; }
  .md\:right-4 { right: 1rem; }
  .md\:p-8 { padding: 2rem; }
}

@media (min-width: 640px) {
  .md\:left-4 { left: 1rem; }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-8 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:col-span-1 { grid-column: span 1 / span 1; }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:col-span-3 { grid-column: span 3 / span 3; }
}

/* --- Базовая защита от горизонтального скролла --- */
html {
  overflow-x: hidden;
  max-width: 100%;
}
body {
  overflow-x: hidden;
  max-width: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Карусели новостей/отзывов не должны раздувать страницу */
#newsGrid,
#reviewsGrid,
#recentCarousel {
  max-width: 100%;
}
section .overflow-hidden {
  overflow: hidden;
  max-width: 100%;
}

.news-card,
.review-card {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* --- Мобильная шапка (<768px) --- */
@media (max-width: 767px) {
  header .container.mx-auto {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    gap: 0.375rem !important;
  }

  /* Авито/Drom в шапке — на мобильном скрываем */
  header a#site-avito-top,
  header a#site-drom-top,
  a#site-avito-top,
  a#site-drom-top {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  header a#site-telegram-icon-link,
  header a#site-whatsapp-icon-link {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
  }

  header button[onclick*="Cart.toggleModal"],
  header button[onclick*="Wishlist.openModal"] {
    padding: 0.5rem !important;
    min-width: 36px;
    min-height: 36px;
  }

  header .text-xl {
    font-size: 1.125rem !important;
  }

  header img.h-9 {
    height: 2rem !important;
  }
}

/* --- Hero на мобильном --- */
@media (max-width: 767px) {
  #hero-banner,
  section.hero-bg {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  #hero-banner h1,
  section.hero-bg h1 {
    font-size: 1.5rem !important;
    line-height: 1.25 !important;
    margin-bottom: 0.75rem !important;
  }

  #hero-banner p,
  section.hero-bg p {
    font-size: 0.875rem !important;
    margin-bottom: 1.25rem !important;
  }

  section.container.mx-auto.px-4.-mt-10 {
    margin-top: -1.5rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  section.container.mx-auto.px-4.-mt-10 > div.bg-white {
    padding: 1rem !important;
  }
}

/* --- Каталог и фильтры --- */
@media (max-width: 767px) {
  #catalog {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  #catalog h2 {
    font-size: 1.375rem !important;
  }

  #catalog .flex.flex-wrap.justify-center.items-end {
    flex-direction: column;
    align-items: stretch !important;
  }

  #catalog .flex.flex-wrap.justify-center.items-end > div {
    width: 100%;
  }

  #catalog .flex.items-center.gap-2.bg-white.border {
    justify-content: space-between;
  }

  .cat-tab {
    font-size: 0.8125rem !important;
    padding: 0.4375rem 0.875rem !important;
  }

  #catalogGrid {
    gap: 1rem !important;
  }
}

/* --- Статистика 2×2 --- */
@media (max-width: 767px) {
  .grid.grid-cols-2.md\:grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.75rem !important;
  }

  .grid.grid-cols-2.md\:grid-cols-4 .text-3xl {
    font-size: 1.5rem !important;
  }
}

/* --- Карточка товара: bottom-sheet на мобильном --- */
@media (max-width: 767px) {
  #productModal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  #productModal > div.bg-white,
  #productModal > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 1.25rem 1.25rem 0 0 !important;
    margin: 0 !important;
  }

  #productModal > div.bg-white > div:first-of-type,
  #productModal > div > div:first-of-type {
    height: min(240px, 35vh) !important;
    max-height: 35vh !important;
  }

  #productModal .md\:w-1\/2:last-child,
  #productModal > div > div:last-child {
    padding: 1rem !important;
  }

  #productModal #modalTitle {
    font-size: 1.125rem !important;
  }

  #productModal #modalPrice {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
  }
}

/* --- Корзина: на мобильном на всю ширину --- */
@media (max-width: 767px) {
  #cartModal > div {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }
}

/* --- Нижняя панель: крупные зоны нажатия --- */
@media (max-width: 767px) {
  .sticky-mobile-bar a,
  .sticky-mobile-bar button {
    min-width: 72px;
    padding: 0.25rem 0.5rem;
    -webkit-tap-highlight-color: transparent;
  }

  .sticky-mobile-bar i {
    font-size: 1.25rem !important;
  }

  #toastContainer {
    bottom: 5rem !important;
    left: 1rem !important;
    right: 1rem !important;
  }
}

/* --- Подвал --- */
@media (max-width: 767px) {
  body > footer {
    padding-bottom: 4.5rem !important;
  }

  footer .grid {
    gap: 1rem !important;
  }
}

/* --- Баннер поиска: flex когда виден --- */
#searchResultsInfo:not(.hidden) {
  display: flex !important;
}

/* v14 — скрыть Авито/Drom в шапке на мобильном (финальный override) */
@media (max-width: 767px) {
  header a#site-avito-top,
  header a#site-drom-top {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}

/* v18 — Лайтбокс всегда поверх карточки товара (у неё инлайновый z-index:100) */
#imageLightbox:not(.hidden) {
  z-index: 300 !important;
}

/* ============================================================
   v18 — АДМИН-ПАНЕЛЬ: единый стиль с сайтом
   ============================================================ */

/* Тёмная шапка панели, как шапка сайта */
#adminModal > div {
  border-radius: 1.25rem !important;
  overflow: hidden !important;
}
#adminModal > div > div:first-child {
  background: #0f172a !important;
  color: #fff !important;
  margin: -1.5rem -1.5rem 1rem -1.5rem !important;
  padding: 0.875rem 1.5rem !important;
  border-bottom: 3px solid #f97316 !important;
}

/* Вкладки — «таблетки» */
#adminModal > div > div:first-child button[id^="btnTab"] {
  color: #94a3b8 !important;
  background: transparent !important;
  border: none !important;
  border-radius: 0.75rem !important;
  padding: 0.5rem 0.875rem !important;
  font-size: 0.8125rem !important;
  font-weight: 700 !important;
  transition: all 0.15s ease !important;
  height: auto !important;
}
#adminModal > div > div:first-child button[id^="btnTab"]:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
#adminModal > div > div:first-child button[id^="btnTab"].text-orange-500 {
  color: #fff !important;
  background: #f97316 !important;
  border-bottom: none !important;
}

/* Кнопка «Выйти» в тёмной шапке */
#adminModal > div > div:first-child button[onclick*="Admin.logout"] {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.12) !important;
  border-radius: 0.75rem !important;
  padding: 0.5rem 0.875rem !important;
  height: auto !important;
}
#adminModal > div > div:first-child button[onclick*="Admin.logout"]:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  color: #fff !important;
}

/* Бейдж текущего пользователя в тёмной шапке */
#adminCurrentUserBadge {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #e2e8f0 !important;
}
#adminCurrentUserBadge #adminCurrentUserRole {
  color: #fb923c !important;
}

/* Карточки статистики дашборда */
#adminTabDashboardContent .grid > div {
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
  transition: box-shadow 0.15s ease, transform 0.15s ease !important;
}
#adminTabDashboardContent .grid > div:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1) !important;
  transform: translateY(-1px) !important;
}

/* Статусы заказов */
.order-status-badge {
  display: inline-flex !important;
  align-items: center !important;
  padding: 0.25rem 0.75rem !important;
  border-radius: 9999px !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.02em !important;
}
.order-status-new        { background: #fee2e2 !important; color: #b91c1c !important; }
.order-status-processing { background: #fef3c7 !important; color: #b45309 !important; }
.order-status-done       { background: #d1fae5 !important; color: #047857 !important; }
.order-status-cancelled  { background: #e5e7eb !important; color: #6b7280 !important; }

/* Карточка заказа: подсветка по статусу слева */
.order-card { border-left: 4px solid #e5e7eb !important; }
.order-card[data-status="new"]        { border-left-color: #ef4444 !important; }
.order-card[data-status="processing"] { border-left-color: #f59e0b !important; }
.order-card[data-status="done"]       { border-left-color: #10b981 !important; }

/* v16 — финальные страховки поверх восстановленного блока */
/* Открытые модалки (без .hidden) показываем как flex даже при .hidden{!important} выше */
#productModal:not(.hidden),
#loginModal:not(.hidden),
#adminModal:not(.hidden),
#cartModal:not(.hidden),
#addressModal:not(.hidden),
#imageLightbox:not(.hidden),
#wishlistModal:not(.hidden) {
  display: flex !important;
}
/* Кнопка закрытия карточки товара всегда видима и кликабельна */
#productModal [data-modal-close] {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  z-index: 30 !important;
}


/* ============================================================
   ПОЛИРОВКА АДМИНКИ: комфорт и аккуратность
   ============================================================ */

/* Каркас панели: широкая, фиксированная комфортная высота, внутренние скроллы.
   max-width важен: выше есть правило "#loginModal > div, #adminModal > div { max-width: 24rem }",
   которое сжимало всю админку до ширины окна входа. */
#adminModal > div {
  max-width: 72rem !important;
  width: 100% !important;
  max-height: 94vh !important;
  height: 94vh !important;
}

/* Панель вкладок: липкая, пилюли вместо подчёркиваний */
#adminModal > div > div:first-child {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}
#adminModal button[id^="btnTab"] {
  padding: 0.5rem 0.9rem !important;
  border-radius: 0.75rem !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  color: #475569 !important;
  background: transparent !important;
  border: 1px solid transparent !important;
  transition: background .15s, color .15s !important;
}
#adminModal button[id^="btnTab"]:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
#adminModal button[id^="btnTab"].text-orange-500 {
  background: #fff7ed !important;
  color: #ea580c !important;
  border-color: #fdba74 !important;
}

/* Таблицы: зебра, ховер, шапка */
#adminModal table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc !important;
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b !important;
  padding: 0.6rem 0.5rem !important;
}
#adminModal table tbody tr:nth-child(even) { background: #fafafa; }
#adminModal table tbody tr:hover { background: #fff7ed !important; }
#adminModal table td { padding: 0.55rem 0.5rem !important; vertical-align: middle; }

/* Формы: ровные поля и заметный фокус */
#adminModal input, #adminModal select, #adminModal textarea {
  border-radius: 0.6rem !important;
  border: 1px solid #e2e8f0 !important;
  transition: border-color .15s, box-shadow .15s !important;
}
#adminModal input:focus, #adminModal select:focus, #adminModal textarea:focus {
  outline: none !important;
  border-color: #fb923c !important;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15) !important;
}

/* Блоки форм */
#adminModal form.bg-gray-50 {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 1rem !important;
}

/* Карточки дашборда */
#adminTabDashboardContent .grid > div {
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: transform .12s, box-shadow .12s;
}
#adminTabDashboardContent .grid > div:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

/* Тонкие скроллбары внутри админки */
#adminModal *::-webkit-scrollbar { width: 8px; height: 8px; }
#adminModal *::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#adminModal *::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
#adminModal *::-webkit-scrollbar-track { background: transparent; }

/* Недостающие утилиты прокрутки: разметка использует overflow-auto,
   а в CSS была определена только overflow-y-auto — из-за этого не
   прокручивались вкладки админки и результаты «Поиска по всей базе» */
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-hidden { overflow: hidden; }

/* Сама панель должна быть flex-колонкой. Правило выше
   "#adminModal .bg-white { display:block !important }" сбивало её в block,
   из-за чего вкладки не ограничивались по высоте и не прокручивались. */
#adminModal > div.bg-white {
  display: flex !important;
  flex-direction: column !important;
}

/* Контент вкладок админки: занимает остаток высоты и скроллится внутри */
#adminModal > div { overflow: hidden !important; }
#adminModal > div > div[id^="adminTab"] {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Единый стиль кнопок админки (Tailwind CDN отключён — без этого кнопки «невидимы») */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.admin-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  border-radius: 0.75rem !important;
  border: none !important;
  cursor: pointer;
  white-space: nowrap;
  color: #fff !important;
  text-decoration: none;
  margin: 0 !important;
  transition: background 0.15s, opacity 0.15s;
}
.admin-btn i { pointer-events: none; }
.admin-btn:disabled { opacity: 0.55 !important; cursor: not-allowed !important; }
.admin-btn--primary { background: #f97316 !important; }
.admin-btn--primary:hover:not(:disabled) { background: #ea580c !important; }
.admin-btn--dark { background: #1e293b !important; }
.admin-btn--dark:hover:not(:disabled) { background: #0f172a !important; }
.admin-btn--blue { background: #2563eb !important; }
.admin-btn--blue:hover:not(:disabled) { background: #1d4ed8 !important; }
.admin-btn--red { background: #dc2626 !important; }
.admin-btn--red:hover:not(:disabled) { background: #b91c1c !important; }
.admin-btn--green { background: #059669 !important; }
.admin-btn--green:hover:not(:disabled) { background: #047857 !important; }
.admin-btn--outline {
  background: #fff !important;
  color: #374151 !important;
  border: 1px solid #d1d5db !important;
}
.admin-btn--outline:hover:not(:disabled) { background: #f9fafb !important; }
label.admin-btn { cursor: pointer; }
label.admin-btn input[type="file"] { display: none; }
.admin-panel {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
}
.admin-panel--warm { background: #fef2f2; border-color: #fecaca; }
.admin-panel--cool { background: #eff6ff; border-color: #bfdbfe; }
.admin-panel__title {
  font-weight: 700;
  font-size: 0.875rem;
  color: #1f2937;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.admin-panel__hint {
  font-size: 11px;
  color: #6b7280;
  margin-top: 0.5rem;
}
.admin-panel__status {
  font-size: 0.75rem;
  color: #4b5563;
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

/* SEO-страницы товаров (/p/...) */
.product-seo-page {
  min-height: 100vh;
}

.product-seo-header a {
  text-decoration: none;
  color: inherit;
}

.product-seo-breadcrumbs a {
  text-decoration: none;
}

.product-seo-breadcrumbs a:hover {
  text-decoration: underline;
}

.product-seo-card {
  max-width: 1100px;
  margin: 0 auto;
}

.product-seo-page .container {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.product-seo-main-img {
  transition: transform 0.15s ease;
}

.product-seo-main-img:hover {
  transform: scale(1.01);
}

.product-seo-thumb {
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-seo-thumb-active {
  border-color: #f97316 !important;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.25);
}

.product-page-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.94);
}

.product-page-lightbox.hidden,
#productPageLightbox.hidden {
  display: none !important;
  visibility: hidden !important;
}

#productPageLightbox:not(.hidden) {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.product-page-lightbox__img {
  max-width: min(1200px, 96vw);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 1rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45);
  cursor: zoom-out;
}

.product-page-lightbox__close,
.product-page-lightbox__nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.15s ease;
}

.product-page-lightbox__close:hover,
.product-page-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.product-page-lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  font-size: 1.75rem;
  line-height: 1;
}

.product-page-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  font-size: 2rem;
  line-height: 1;
}

.product-page-lightbox__nav--prev { left: 0.75rem; }
.product-page-lightbox__nav--next { right: 0.75rem; }

.product-page-lightbox__counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.35rem 1rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  pointer-events: none;
}
