body { 
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f8f8f8;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;    
}

header {
    background-color: #f8f8f8;
    width: 100%;
    padding: 0px 0px;    
    position: relative;
    z-index: 1000;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.logo img {
    height: 50px;
    margin-left: 40px;
}

.contact-info {
    text-align: center;
    flex-grow: 1;
}

.contact-info p {
    margin: 5px 0;
    font-size: 14px;
    color: #333;
}

.cart-icon {
    display: flex;
    align-items: center;
    background-color: #DB6E00;
    padding: 6px 10px;
    border-radius: 4px;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    margin-right: 20px;
}

.cart-icon:hover {
    background-color: #A55300;
}

.cart-count {
    background-color: #fff;
    color: #DB6E00;
    border-radius: 50%;
    padding: 2px 6px;
    margin-left: 6px;
    font-size: 12px;
}

nav {
    background-color: #e0e0e0;
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    border-radius: 4px;
}

nav a {
    margin: 0 15px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 16px;
}

nav a:hover {
    color: #A55300;
}

.search-bar {
    display: inline-flex;
    align-items: center;
    margin: 0 15px;
}

.search-bar input {
    padding: 8px;
    width: 200px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-bar button {
    padding: 8px 12px;
    border: none;
    background-color: #DB6E00;
    color: #fff;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}

.search-bar button:hover {
    background-color: #A55300;
}

.main-content {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    overflow-x: hidden;
}

.sidebar { 
    width: 250px;
    color: #333;    
    transition: transform 0.3s ease;
}

.sidebar-categories {
    background-color: #f8f8f8;
    padding: 9px 0px;
    border-radius: 4px;    
}

.sidebar h2 { 
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.category { 
    margin: 1px 0px;
    position: relative;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #e0e0e0;
}

.category a { 
    color: #333;
    text-decoration: none;
    display: block;
    padding: 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: bold;  
}

.category a:hover { 
    background-color: #c0c0c0;
}

.dropdown-arrow {
    margin-right: 10px;
    font-size: 12px;
    color: #333;
}

.subcategory-list { 
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background-color: #e0e0e0;
    min-width: 200px;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    z-index: 2000;
}

.category:hover .subcategory-list { 
    display: block;
}

.subcategory {
    position: relative;   
}

.subcategory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;   
}

.subcategory a { 
    color: #333;
    text-decoration: none;
    display: block;
    padding: 8px;
    border-radius: 4px;
    font-weight: normal;
}

.subcategory a:hover { 
    background-color: #d0d0d0;
}

.content { 
    padding: 10px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.content h1 { 
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 16px;
}

.content h2 { 
    font-size: 20px;
    font-weight: bold;
    margin: 16px 0 12px;
}

.breadcrumbs { 
    margin-bottom: 12px;
    margin-left: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumbs a { 
    color: #333;
    text-decoration: none;
    font-weight: bold;
    margin-right: 5px;
}

.breadcrumbs a:hover { 
    color: #DB6E00;
}

.sort-bar {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-bar label {
    font-size: 14px;
    font-weight: bold;
}

.sort-bar select {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

@media (min-width: 769px) {
    .sort-bar {
        justify-content: flex-end;
    }
}

.grid { 
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    overflow: hidden;
}

.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.tile { 
    background-color: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    visibility: visible;
    opacity: 1;
    text-decoration: none;
    min-height: 280px;
}

.tile a {
    text-decoration: none;
}

.tile:hover {
    -webkit-transform: scale(1.05); /* For older WebKit browsers */
    -moz-transform: scale(1.05);    /* For older Firefox */
    transform: scale(1.05);         /* Standard */
}

.tile img { 
    max-width: 100%;
    width: 100%;
    object-fit: contain;
    margin-bottom: 8px;
    border-radius: 4px;
    display: block;
}

.tile h3 { 
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #000;
}

.tile p { 
    margin: 4px 0;
    color: #555;
    font-size: 14px;
}

.tile form {
    margin-top: auto;
}

.in-cart {
    color: #DB6E00 !important;
    font-weight: bold;
    margin: 8px 0;
    font-size: 14px;
}

.product-card { 
    background-color: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gallery { 
    display: flex;
    margin-bottom: 12px;
    flex-direction: row;
    align-items: flex-start;
}

.gallery img { 
    border-radius: 4px;
}

.gallery-img { 
    cursor: pointer;
    margin: 0 4px;
}

.gallery-img.active { 
    border: 2px solid #DB6E00;
}

.thumbnail { 
    width: 48px;
    height: 48px;
    object-fit: cover;
    margin-bottom: 8px;
    border-radius: 4px;
}

.main-img { 
    max-width: 600px;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.add-to-cart { 
    background-color: #DB6E00;
    color: #fff;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 14px;
}

.add-to-cart:hover { 
    background-color: #A55300;
}

input[type="number"] {
    height: 27px;
    box-sizing: border-box;
}

.promo-images {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.promo-images img {
    width: 100%;
    max-width: 100%;
    border-radius: 4px;
    display: block;
}

.slideshow {
    width: 100%;
    height: 250px;
    position: relative;
    overflow: hidden;
    background: #000;
    margin: 0px 0px 20px 0px;
    border-radius: 4px;
}

.slideshow-item {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    animation: slideanim 70s infinite;
    pointer-events: none;
}

.slideshow-item:nth-child(1),
.slideshow-item:nth-child(1) img {
    -webkit-animation-delay: 0s; /* For older WebKit browsers */
    -moz-animation-delay: 0s;    /* For older Firefox */
    animation-delay: 0s;         /* Standard */
}

.slideshow-item:nth-child(2),
.slideshow-item:nth-child(2) img {
    -webkit-animation-delay: 10s;
    -moz-animation-delay: 10s;
    animation-delay: 10s;
}

.slideshow-item:nth-child(3),
.slideshow-item:nth-child(3) img {
    -webkit-animation-delay: 20s;
    -moz-animation-delay: 20s;
    animation-delay: 20s;
}

.slideshow-item:nth-child(4),
.slideshow-item:nth-child(4) img {
    -webkit-animation-delay: 30s;
    -moz-animation-delay: 30s;
    animation-delay: 30s;
}

.slideshow-item:nth-child(5),
.slideshow-item:nth-child(5) img {
    -webkit-animation-delay: 40s;
    -moz-animation-delay: 40s;
    animation-delay: 40s;
}

.slideshow-item:nth-child(6),
.slideshow-item:nth-child(6) img {
    -webkit-animation-delay: 50s;
    -moz-animation-delay: 50s;
    animation-delay: 50s;
}

.slideshow-item:nth-child(7),
.slideshow-item:nth-child(7) img {
    -webkit-animation-delay: 60s;
    -moz-animation-delay: 60s;
    animation-delay: 60s;
}

.slideshow-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: zoom 70s infinite;
}

.slideshow-item-text {
    max-width: 100%;
    position: absolute;
    bottom: 200px;
    left: 20px;
    background-color: rgba(255,255,255,0.5);
    color: #000;
    padding: 1px 10px;
    font-family: Verdana, sans-serif;
}

.slideshow-item-text h5 {
    font-size: 22px;
    margin: 0 0 10px 0;
    color: #BFE2FF;
}

.slideshow-item-text p {
    font-size: 15px;
    margin-bottom: 10px;
}

@keyframes slideanim {
    7.15% {
        opacity: 1;
        pointer-events: auto;
    }
    14.3% {
        opacity: 1;
        pointer-events: auto;
    }
    21.5% {
        opacity: 0;
    }
}

@keyframes zoom {
    28.5% {
        transform: scale(1.3);
    }
}

@media screen and (max-width: 1100px) {
    .slideshow-item-text {
        max-width: 75%;
    }
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .subcategories-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media screen and (max-width: 456px) {
    .slideshow-item-text {
        bottom: 0;
        left: 0;
        max-width: 100%;
    }
    .slideshow-item-text h5 {
        font-size: 18px;
    }
    .slideshow-item-text p {
        font-size: 13px;
    }
}

footer {
    background-color: #e0e0e0;
    padding: 20px;
    text-align: center;
    color: #333;
    font-size: 14px;
    margin-top: auto;
    width: 100%;
}

footer p {
    margin: 5px 0;
}

.menu-toggle {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    color: #333;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 2000;
}

.close-menu {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
    }
    .logo img {
        margin-left: 50px;
    }
    .contact-info {
        text-align: left;
        margin: 10px 0;
    }
    .cart-icon {
        position: absolute;
        top: 10px;
        right: 50px;
        margin-right: 0;
    }
    nav {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 20px;
    }
    nav a {
        display: block;
        margin: 5px 0;
    }
    .search-bar {
        width: auto;
        margin: 10px 0;
    }
    .search-bar input {
        width: auto;
    }
    .menu-toggle {
        display: block;
    }
    .close-menu {
        display: block;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
        background-color: #f0f0f0;
        transform: translateX(-100%);
        z-index: 1000;
        overflow-y: auto;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .sidebar-categories {
        background-color: #e0e0e0;
        padding: 20px;
        border-radius: 0;
    }
    .subcategory-list {
        display: block;
        position: static;
        box-shadow: none;
        background-color: transparent;
        padding: 0;
        margin-left: 10px;
    }
    .category:hover .subcategory-list {
        display: block;
    }
    .content {
        padding: 0px;
        margin-top: 0px;
    }
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .subcategories-grid {
        margin-bottom: 24px;
    }
    .subcategories-grid .tile {
        flex: 0 1 160px;
    }
    .tile {
        min-height: 200px;
    }
    .content h1 {
        font-size: 20px;
    }
    .content h2 {
        font-size: 18px;
    }
    .cart-icon {
        padding: 5px 8px;
        font-size: 12px;
    }
    .cart-count {
        padding: 1px 5px;
        font-size: 10px;
    }
    .promo-images img {
        max-width: 140px;
    }
}

@media (max-width: 480px) {
    .main-content {
        flex-direction: column;
    }
    .sidebar {
        box-sizing: border-box;
        width: 100%;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        transform: translateX(-100%);
        overflow-y: auto;
        overflow-x: hidden;
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .subcategories-grid {
        margin-bottom: 16px;
    }
    .subcategories-grid .tile {
        flex: 0 1 100%;
        max-width: 200px;
        margin: 8px auto;
    }
    .tile {
        min-height: 180px;
    }
    .tile img {
        max-height: 120px;
    }
    .tile h3 {
        font-size: 12px;
    }
    .tile p, .in-cart {
        font-size: 11px;
    }
    .content {
        padding: 12px;
    }
    .content h1 {
        font-size: 18px;
    }
    .content h2 {
        font-size: 16px;
    }
    .main-img {
        max-width: 100%;
    }
    .thumbnail {
        width: 40px;
        height: 40px;
    }
    .add-to-cart {
        padding: 5px 10px;
        font-size: 12px;
    }
    .cart-icon {
        right: 12px;
    }
    .gallery {
        flex-direction: column;
    }
    .gallery-img {
        margin: 4px 0;
    }
    .promo-images img {
        max-width: 100%;
    }
    .search-bar input {
        width: 100%;
    }
}

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #A55300, #D97706);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  z-index: 1000;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.back-to-top {
  opacity: 0.8; /* полупрозрачная в обычном состоянии */
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.back-to-top:hover {
  opacity: 1; /* полностью непрозрачная при наведении */
  background: linear-gradient(135deg, #924B00, #C16D05);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4), inset 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.back-to-top svg {
  display: block;
  margin: auto;
}

@media (max-width: 768px) {
  .back-to-top {
    width: 42px;
    height: 42px;
    bottom: 20px;
    right: 20px;
  }
  .back-to-top svg {
    width: 20px;
    height: 20px;
  }
}

.highlight {
    background-color: yellow;    /* Подсветка поиска */
    font-weight: bold;
}

.sidebar .search-bar {
    margin: 10px 12px;          /* меньше отступов по бокам и сверху/снизу */
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.12);
    display: flex;              /* важно! */
    height: 36px;               /* общая фиксированная высота */
    align-items: stretch;       /* растягиваем детей по высоте */
}

.sidebar .search-bar input {
    flex: 1;                    /* занимает всё доступное место */
    height: 100%;
    padding: 0 12px;
    font-size: 14px;
    border: none;
    outline: none;
    box-sizing: border-box;
}

.sidebar .search-bar {
    margin: 10px 12px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.12);
    display: flex;
    height: 32px;               /* ← основная высота, можно попробовать 30px */
    align-items: stretch;
}

.sidebar .search-bar input {
    flex: 1;
    padding: 0 10px;            /* ← убрали вертикальный padding */
    margin: 0;
    height: 100%;
    line-height: 32px;          /* помогает выровнять текст по центру */
    font-size: 13px;            /* чуть меньше шрифт — выглядит аккуратнее */
    border: none;
    outline: none;
    box-sizing: border-box;
}

.sidebar .search-bar button {
    width: 70px;
    height: 100%;
    padding: 0;
    margin: 0;
    background: #DB6E00;
    color: white;
    border: none;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.sidebar .search-bar button:hover {
    background: #c55e00;
}

/* Если нужно ещё ниже */
@media (max-width: 400px) {
    .sidebar .search-bar {
        height: 30px;
    }
    .sidebar .search-bar input {
        font-size: 12.5px;
        line-height: 30px;
    }
    .sidebar .search-bar button {
        font-size: 12.5px;
    }
}

/* Дополнительные стили для безопасности и производительности */
/* Предотвращение переполнения контента */
.content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Оптимизация для быстрой загрузки */
.tile img {
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
}

/* Улучшенная доступность */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Улучшенные стили для форм */
input, select, textarea, button {
    font-family: inherit;
    font-size: 100%;
}

/* Оптимизация для touch devices */
.tile {
    touch-action: manipulation;
}