@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-color: #f6f6f9;
  --surface-color: #ffffff;
  --text-color: #000000;
  --text-secondary: #8a8a8a;
  --primary-color: #2C2D30;
  --accent-cyan: #4cc7cf;
  --border-color: #f0f0f4;
  --container-width: 1440px;
  --transition: all 0.2s ease;
}

[data-theme='dark'] {
  --bg-color: #121212;
  --surface-color: #1e1e1e;
  --text-color: #ffffff;
  --text-secondary: #a0a0a0;
  --border-color: #2d2d2d;
}

body {
  font-family: 'Exo 2', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.4;
}

a:focus, a:active, button:focus, button:active, .btn:focus, .btn:active:focus, .btn.active:focus, .btn.focus, .btn:active.focus, .btn.active.focus {
  outline: none !important;
  box-shadow: none !important;
}

.container {
  max-width: var(--container-width);
}

/* Banner aligns with the main content block (no 100vw breakout — that included
   the scrollbar width and pushed the banner past the page on the right). */
.banner-section {
  width: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-color);
}

/* Banner image: full-width, real <img> (no cover-crop / fixed height), so the
   image — including its baked-in text — is shown whole and centred. */
.banner-swiper { width: 100%; }
.banner-swiper .swiper-slide { display: flex; align-items: center; justify-content: center; }
.banner-img { display: block; width: 100%; height: auto; }

/* Sub-navigation tabs under the banner (driven by each banner's title) */
.sub-nav-wrapper { border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.sub-nav-scroll {
  display: flex;
  justify-content: center;
  gap: 25px;
  overflow-x: auto;
  white-space: nowrap;
  padding: 15px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sub-nav-scroll::-webkit-scrollbar { display: none; }
.sub-nav-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  padding: 5px 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.sub-nav-btn:hover { color: var(--text-color); }
.sub-nav-btn.active {
  color: var(--text-color);
  font-weight: 700;
  border-bottom-color: var(--text-color);
}

/* Header Integration */
.header {
  background-color: var(--surface-color);
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header-top { padding: 15px 0; border-bottom: 1px solid var(--border-color); }

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

/* Bootstrap's .container clearfix (::before/::after) becomes phantom flex items
   here and pushes the logo / first nav item off the container edge. Kill them
   so the logo and the «Категории» button line up with the content edge. */
.header-top-container::before,
.header-top-container::after,
.nav-container::before,
.nav-container::after { display: none; }

.logo-link h1 {
  font-size: 28px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-color);
  letter-spacing: -1.5px;
  margin: 0;
}

/* OpenCart Search Bar Styling */
.search-wrapper {
  flex: 1;
  max-width: 700px;
  position: relative;
}

.search-wrapper .search-bar, 
.search-wrapper input[name='search'] {
  width: 100%;
  height: 42px;
  background-color: #f1f1f4;
  border-radius: 6px;
  padding: 0 45px 0 15px;
  border: none;
  font-size: 14px;
  color: #000;
  font-weight: 500;
}

[data-theme='dark'] .search-wrapper input[name='search'] {
  background-color: #2c2c2e;
  color: #fff;
}

.search-icon-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #888;
  background: none;
  border: none;
}

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 30px; }

.header-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-color);
  text-decoration: none;
}

.badge-wrapper { position: relative; display: flex; align-items: center; }

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--accent-cyan);
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 10px;
  font-weight: 700;
}

/* Navigation Tier */
.header-bottom { background-color: var(--primary-color); color: #fff; }
.nav-container { display: flex; align-items: center; height: 56px; }

.all-categories-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  color: #fff;
  padding-right: 20px;
}

/* Category Dropdown Styling */
.category-dropdown-menu {
  min-width: 240px;
  padding: 10px 0;
  margin-top: 0;
  border-radius: 0 0 8px 8px;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

[data-theme='dark'] .category-dropdown-menu {
  background-color: #1e1e1e;
  border-color: #2d2d2d;
}

.category-dropdown-menu li a {
  padding: 10px 20px;
  display: block;
  color: var(--text-color);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s;
}

.category-dropdown-menu li a:hover {
  background-color: var(--bg-color);
  color: var(--accent-cyan);
}

.dropdown-submenu {
  position: relative;
}

.dropdown-submenu > .dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
  border-radius: 0 8px 8px 8px;
}

.dropdown-submenu:hover > .dropdown-menu {
  display: block;
}

.dropdown-submenu > a:after {
  content: "\f105";
  font-family: 'FontAwesome';
  float: right;
  margin-top: 3px;
}

.nav-list { display: flex; gap: 18px; padding-left: 20px; flex: 1; }
.nav-link { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.9); text-decoration: none; }
.nav-link:hover { color: #fff; }

.theme-toggle-btn { color: rgba(255,255,255,0.6); background: none; border: none; padding: 5px; cursor: pointer; }
.theme-toggle-btn:hover { color: #fff; }

/* Category Module Sidebar Styling */
.category-menu-block {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 0;
  margin-bottom: 20px;
}
.category-item {
  display: block;
  padding: 10px 20px;
  color: var(--text-color);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.2s;
  font-size: 14px;
}
.category-item.active {
  color: var(--accent-cyan);
  font-weight: 500;
  border-left: 3px solid var(--accent-cyan);
  background: rgba(0, 229, 255, 0.05);
}
.category-children {
  padding: 5px 0;
}
.category-child {
  display: block;
  padding: 8px 20px 8px 40px;
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
  font-size: 13px;
}
.category-child.active {
  color: var(--accent-cyan);
  font-weight: 500;
}
.category-child .dot {
  position: absolute;
  left: 25px;
  top: 15px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.5;
}
.category-child .dot.active {
  background: var(--accent-cyan);
  opacity: 1;
}

/* Product Grid Styling.
   :not([class*="col-"]) keeps this CSS-grid container behaviour off the legacy
   vendor markup, where `product-grid` is a per-item Bootstrap column. */
.product-grid:not([class*="col-"]) { display: grid; grid-template-columns: repeat(5, 1fr); gap: 20px; padding: 20px 0; }
.product-card {
  background-color: var(--surface-color);
  padding: 25px 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.product-image-container { height: 160px; display: flex; align-items: center; justify-content: center; margin-bottom: 20px; }
.product-image-container a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.product-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.product-name { font-size: 14px; margin-bottom: 20px; min-height: 40px; }
.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.current-price { font-size: 18px; font-weight: 600; }
.cart-plus-btn { color: var(--accent-cyan); background: none; border: none; cursor: pointer; }

/* Product Page Styles */
.product-detail { padding: 40px 0; background-color: var(--surface-color); margin-bottom: 20px; }
.product-gallery { margin-bottom: 30px; }
.main-image { width: 100%; display: flex; align-items: center; justify-content: center; background: transparent; padding: 10px; }
.main-image img { max-width: 100%; max-height: 500px; object-fit: contain; border-radius: 12px; }
.thumbnails-list { display: flex; gap: 10px; margin-top: 15px; overflow-x: auto; }
.thumb-item { width: 80px; height: 80px; border: 1px solid var(--border-color); border-radius: 8px; padding: 5px; cursor: pointer; background: transparent; }
.thumb-item.active { border-color: var(--accent-cyan); }
.thumb-item img { width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }

.product-info-panel h1 { font-size: 32px; font-weight: 600; margin-bottom: 10px; }
.product-meta { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }
.product-price-block { margin: 25px 0; }
.price-large { font-size: 36px; font-weight: 700; color: var(--text-color); }
.price-old-large { font-size: 18px; text-decoration: line-through; color: var(--text-secondary); margin-left: 15px; }

.option-group { margin-bottom: 20px; }
.option-label { font-weight: 700; font-size: 14px; margin-bottom: 10px; display: block; }
.radio-options { display: flex; gap: 10px; flex-wrap: wrap; }
.radio-options label { border: 1px solid var(--border-color); padding: 8px 15px; border-radius: 4px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.radio-options input { display: none; }
.radio-options input:checked + span { color: var(--accent-cyan); }
.radio-options label:has(input:checked) { border-color: var(--accent-cyan); background-color: rgba(76, 199, 207, 0.05); }

.cart-controls { display: flex; gap: 15px; align-items: center; margin-top: 30px; }
.qty-input { width: 60px; height: 50px; text-align: center; border: 1px solid var(--border-color); border-radius: 4px; background: var(--bg-color); color: var(--text-color); }
.btn-buy { flex: 1; height: 50px; background-color: var(--accent-cyan); color: #fff; border: none; border-radius: 4px; font-weight: 700; font-size: 16px; text-transform: uppercase; }

/* Category Controls */
.category-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  border-radius: 4px;
}
.compare-link-wrapper {
  flex-grow: 1;
  padding: 0 15px;
}
.filter-controls {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-left: auto;
}
.filter-control-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.filter-control-item label {
  font-size: 13px;
  margin: 0;
  color: var(--text-secondary);
}
.filter-control-item select {
  width: auto;
  height: 32px;
  font-size: 13px;
  padding: 0 10px;
  background: var(--bg-color);
  color: var(--text-color);
  border-color: var(--border-color);
}

.product-tabs { margin-top: 50px; }
.nav-tabs { border-bottom: 2px solid var(--border-color); }
.nav-tabs > li > a { border: none !important; color: var(--text-secondary); font-weight: 600; padding: 15px 25px; }
.nav-tabs > li.active > a { color: var(--text-color); border-bottom: 2px solid var(--accent-cyan) !important; background: none !important; }
.tab-content { padding: 30px 0; font-size: 15px; line-height: 1.6; }

/* OpenCart specific overrides to maintain functionality */
#cart .dropdown-menu { min-width: 320px; padding: 15px; border-radius: 8px; border: 1px solid var(--border-color); }
[data-theme='dark'] #cart .dropdown-menu { background-color: #1e1e1e; color: #fff; }
#cart .dropdown-menu .table { margin-bottom: 0; background: transparent; }
#cart .dropdown-menu .table-striped > tbody > tr:nth-of-type(odd) { background-color: rgba(0, 0, 0, 0.03); }
[data-theme='dark'] #cart .dropdown-menu .table-striped > tbody > tr:nth-of-type(odd) { background-color: rgba(255, 255, 255, 0.03); }
#cart .dropdown-menu .table td, #cart .dropdown-menu .table th { border-color: var(--border-color); vertical-align: middle; }
#cart .img-thumbnail { background-color: transparent; border-color: var(--border-color); }

/* Pagination (centralised here, was inline in category.twig) */
.pagination { margin: 0; }
.pagination > li > a,
.pagination > li > span {
  background: var(--surface-color);
  border-color: var(--border-color);
  color: var(--text-color);
}
.pagination > .active > a,
.pagination > .active > span {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* =========================================================================
   RESPONSIVE LAYER
   Single source of truth for adaptive behaviour. Breakpoints follow the
   Bootstrap 3 grid the theme is built on (xs <768, sm 768, md 992, lg 1200).
   ========================================================================= */

/* ---- Product grid: scale columns down with the viewport ---------------- */
@media (max-width: 1199px) {
  .product-grid:not([class*="col-"]) { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 991px) {
  .product-grid:not([class*="col-"]) { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 767px) {
  .product-grid:not([class*="col-"]) { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 14px 0; }
  .product-card { padding: 16px 14px; }
  .product-image-container { height: 130px; margin-bottom: 14px; }
  .product-name { min-height: 0; margin-bottom: 14px; }
  .current-price { font-size: 16px; }
}
@media (max-width: 360px) {
  .product-grid:not([class*="col-"]) { gap: 10px; }
}

/* ---- Tablet: drop the duplicate horizontal category bar ----------------- */
@media (max-width: 991px) {
  .nav-list { display: none; }
  .nav-container { justify-content: space-between; }
}

/* ---- Mobile header: stack search onto its own full-width row ------------ */
@media (max-width: 767px) {
  .header-top { padding: 10px 0; }
  .header-top-container { flex-wrap: wrap; gap: 12px; }
  .logo-link { order: 1; }
  .header-actions { order: 2; margin-left: auto; gap: 18px; }
  .header-top-container > .search-wrapper { order: 3; flex: 1 1 100%; max-width: 100%; }
  .logo-link h1 { font-size: 22px; letter-spacing: -1px; }
  .nav-container { height: 44px; }
  .all-categories-btn { padding-right: 0; }
}

/* Hide the action text labels on small phones, keep the icons ------------- */
@media (max-width: 480px) {
  .header-actions { gap: 16px; }
  .header-action > span,
  #cart .dropdown-toggle > span { display: none; }
  #cart .dropdown-menu { min-width: 280px; max-width: 92vw; }
}

/* ---- Mobile category dropdown: flatten fly-out submenus into a list ----- */
@media (max-width: 991px) {
  .category-dropdown-menu { max-height: 70vh; overflow-y: auto; }
  .dropdown-submenu > .dropdown-menu {
    position: static;
    left: 0;
    display: block;
    float: none;
    min-width: auto;
    margin: 0;
    padding: 0 0 0 20px;
    border: none;
    box-shadow: none;
    background: transparent;
    border-radius: 0;
  }
  .dropdown-submenu > a:after { display: none; }
}

/* ---- Product detail page ----------------------------------------------- */
@media (max-width: 767px) {
  .product-detail { padding: 20px 0; }
  .product-info-panel { margin-top: 24px; }
  .product-info-panel h1 { font-size: 22px; }
  .price-large { font-size: 28px; }
  .price-old-large { font-size: 15px; }
  .main-image img { max-height: 320px; }
  .product-tabs { margin-top: 30px; }
  .product-tabs .tab-content { padding: 20px 0; }
  /* Let the tab bar scroll horizontally instead of wrapping */
  .product-tabs .nav-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .product-tabs .nav-tabs > li { float: none; }
  .product-tabs .nav-tabs > li > a { padding: 12px 16px; white-space: nowrap; }
  .cart-controls { flex-wrap: wrap; }
  .btn-buy { flex: 1 1 100%; }
}

/* ---- Home / module sections & category controls (override inline px) ---- */
@media (max-width: 767px) {
  .product-section { padding: 28px 0 !important; }
  .section-title { font-size: 22px !important; }
  #product-category .category-info h1 { font-size: 24px !important; }
  .category-controls { flex-direction: column; align-items: stretch; gap: 12px; }
  .compare-link-wrapper { padding: 0; display: none; } /* Hide compare on mobile to save space */
  .filter-controls { width: 100%; justify-content: flex-end; margin-left: 0; }
  .pagination-block { flex-wrap: wrap; gap: 12px; }
}

/* =========================================================================
   MATCH biggeek.ru — layout width & type scale
   Measured on biggeek (1440px viewport): content container 1380px, base font
   16px, section titles 44px, product names 16px, top nav 14px (font: Exo 2).
   ========================================================================= */

/* Base font 16px like biggeek (Bootstrap 3 forces body to 14px) */
body { font-size: 16px; }

/* Wider content container (biggeek ≈ 1380px). Overrides Bootstrap's fixed
   1170px and turns it fluid up to 1380, so it scales smoothly. */
@media (min-width: 1200px) {
  .container { width: auto; max-width: 1380px; }
}

/* Home modules (slideshow, featured…) wrap their content in a NESTED .container
   while already sitting inside #content (a container column). That double
   padding pushed the banner/products ~15px right of the header. Strip the
   redundant side padding so home content lines up with the header & logo. */
#content .container { padding-left: 0; padding-right: 0; }

/* Desktop type scale to match biggeek (wrapped in min-width so the mobile
   overrides above keep winning on phones). */
@media (min-width: 768px) {
  .section-title { font-size: 44px !important; }      /* inline 32px */
  #product-category .category-info h1 { font-size: 40px !important; }
  .product-name a, .product-name { font-size: 16px !important; }  /* inline 14px */
  .nav-link { font-size: 14px; }
  .sub-nav-btn { font-size: 14px; }
}

/* ---- Footer ----------------------------------------------------------- */
footer { padding: 10px 0 30px; color: var(--text-secondary); }
footer .container { text-align: center; }
footer p { margin: 0; font-size: 14px; }

/* ---- Brand carousel: centre logos and give the slides equal height ---- */
.carousel { padding: 10px 0; }
.carousel .swiper-wrapper { align-items: center; }
.carousel .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 90px;
}
.carousel .swiper-slide img {
  max-height: 70px;
  width: auto;
  object-fit: contain;
}
/* Swiper hides these via watchOverflow when there aren't enough logos */
.carousel .swiper-pagination { position: static; margin-top: 12px; }

/* Custom 15% / 85% layout for desktop columns */
@media (min-width: 992px) {
  aside#column-left.col-md-2 {
    width: 15%;
  }
  div#content.col-md-10 {
    width: 85%;
  }
}

/* List View Styling */
.product-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  padding: 20px 0;
}
.product-list .product-card {
  flex-direction: row;
  align-items: center;
  padding: 20px 30px;
}
.product-list .product-image-container {
  width: 200px;
  height: 200px;
  margin-bottom: 0;
  margin-right: 30px;
  flex-shrink: 0;
}
.product-list .product-info {
  flex-direction: row !important;
  align-items: center;
  width: 100%;
}
.product-list .product-name {
  margin-bottom: 0 !important;
  font-size: 18px;
  flex-grow: 1;
}
.product-list .product-name a {
  font-size: 18px !important;
  font-weight: 600 !important;
}
.product-list .product-footer {
  margin-top: 0;
  flex-direction: column;
  align-items: flex-end;
  margin-left: 30px;
  min-width: 150px;
  border-left: 1px solid var(--border-color);
  padding-left: 30px;
}
.product-list .current-price {
  font-size: 22px;
}
.product-list .cart-plus-btn {
  margin-top: 20px;
}

@media (max-width: 767px) {
  .product-list .product-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
  }
  .product-list .product-image-container {
    width: 100%;
    height: 180px;
    margin-right: 0;
    margin-bottom: 15px;
  }
  .product-list .product-info {
    flex-direction: column !important;
    align-items: flex-start;
  }
  .product-list .product-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-left: 0;
    margin-top: 20px;
    padding-left: 0;
    border-left: none;
    width: 100%;
  }
  .product-list .cart-plus-btn {
    margin-top: 0;
  }
}

/* ---- Category Sidebar Mobile ---- */
@media (max-width: 991px) {
  #column-left .category-menu-block {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    border: none;
    border-radius: 0;
    margin: 0 -15px 20px -15px; /* stretch to screen edges */
    padding: 10px 15px;
    background: transparent;
  }
  #column-left .category-item {
    border: 1px solid var(--border-color) !important;
    background: var(--surface-color) !important;
    border-radius: 20px;
    padding: 8px 16px;
    margin-right: 10px;
    display: inline-block;
  }
  #column-left .category-item.active {
    border-color: var(--accent-cyan) !important;
    background: rgba(0, 229, 255, 0.05) !important;
  }
  #column-left .category-children {
    display: none; /* Hide children to keep it clean on mobile */
  }
}

/* ---- Breadcrumbs Mobile ---- */
@media (max-width: 767px) {
  .breadcrumb {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding-bottom: 5px !important;
  }
  .breadcrumb::-webkit-scrollbar {
    display: none;
  }
}
