/* ===== RESET ===== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f1f3f5;
  color: #1f2933;
}

/* ===== HEADER ===== */
.header {
  background: #000000;
  border-bottom: 1px solid #e5e7eb;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
  padding: 0 20px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.logo span {
  font-weight: 400;
  color: #16a34a;
}

.phone {
  font-size: 14px;
  color: #ffffff;
}

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

/* ===== PRODUCT CARD ===== */
.product-page {
  margin-top: 30px;
  background: #ffffff;
  border-radius: 14px;
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

/* ===== GALLERY ===== */
.gallery-wrapper {
  position: relative;
}

.slides {
  border-radius: 14px;
  overflow: hidden;
}

.slide {
  display: none;
  width: 100%;
}

.slide.active {
  display: block;
}


.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.arrow.left { left: 12px; }
.arrow.right { right: 12px; }

/* ===== INFO ===== */
.product-info h1 {
  margin: 0 0 10px;
  font-size: 24px;
  line-height: 1.35;
}

.rating {
  color: #f59e0b;
  font-size: 14px;
  margin-bottom: 12px;
}

.price-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 0;
}

.old-price {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 16px;
}

.price {
  font-size: 36px;
  font-weight: 700;
  color: #dc2626;
}

.discount {
  background: #dc2626;
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 14px;
}

.availability {
  color: #16a34a;
  font-size: 16px;   
  font-weight: 600;  
  margin-bottom: 14px;
}

.stock-warning {
  color: #b91c1c;    
  font-size: 14px;
  margin-bottom: 14px;
}

.buy-btn {
  background: #16a34a;
  color: #fff;
  border: none;
  padding: 16px 48px; 
  font-size: 18px;    
  border-radius: 999px;
  cursor: pointer;
  transition: 0.2s ease;
}

.buy-btn:hover {
  background: #15803d;
}

/* ===== DESCRIPTION ===== */
.description {
  margin-top: 24px;
  background: #ffffff;
  border-radius: 14px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,.05);
}

.description h2 {
  margin-top: 0;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
}

.modal-box {
  background: #ffffff;
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: 16px;
  position: relative;
  z-index: 2;
}

/* ===== FORM ===== */
.field {
  margin-bottom: 16px;
  position: relative;
}

.field input {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
}

.field input:focus {
  outline: none;
  border-color: #16a34a;
}

/* ===== ERRORS ===== */
.error-field input {
  border-color: #dc2626;
  background: #fef2f2;
}

.error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
}

/* ===== BUTTONS ===== */
.submit-btn,
#okBtn {
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 14px;
  font-size: 16px;
  background: #16a34a;
  color: #fff;
  cursor: pointer;
  transition: 0.2s ease;
}

.submit-btn:hover,
#okBtn:hover {
  background: #15803d;
}

/* ===== AUTOCOMPLETE ===== */
.autocomplete {
  position: relative;
}

.dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 10px;
  margin-top: 6px;
  border: 1px solid #e5e7eb;
  max-height: 180px;
  overflow-y: auto;
  z-index: 20;
}

.dropdown div {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
}

.dropdown div:hover {
  background: #f0fdf4;
}

.dropdown:has(div) {
  display: block;
}

/* ===== SUCCESS ===== */
.success {
  display: none;
}

.success.show {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.97);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 16px;
  animation: successIn 0.35s ease;
}

.success-message {
  font-size: 18px;
  line-height: 1.7;       
  margin-bottom: 24px;    
}

@keyframes successIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}


.dropdown {
  display: none; 
}

.dropdown div { cursor:pointer; padding:12px; font-size:14px; }
.dropdown div:hover { background:#f0fdf4; }


/* ===== MOBILE ===== */
@media (max-width: 768px) {
  .product-page {
    grid-template-columns: 1fr;
    padding: 24px;
  }
}

.product-summary {
  margin: 16px 0;
  font-size: 16px;
  line-height: 1.5;
}

.product-summary .rating {
  color: #f59e0b;
  margin-bottom: 8px;
  font-weight: 600; 
}

.product-summary .price-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.product-summary .old-price {
  text-decoration: line-through;
  color: #9ca3af;
  font-size: 16px;
}

.product-summary .price {
  font-size: 32px;
  font-weight: 700;
  color: #dc2626;
}

.product-summary .discount {
  background: #dc2626;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 14px;
}

.product-summary .availability {
  color: #16a34a;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
}

.product-summary .features li {
  margin-bottom: 6px;
  font-size: 14px;
}

.logo a {
  text-decoration: none;
  color: inherit;
  font-weight: inherit;
  display: inline-block;
}

.logo a span {
  font-weight: bold;
  color: #ff6600;
}


.search-container {
    flex: 1; 
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 600px; 
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border-radius: 8px; 
    border: 1px solid #ccc;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.search-input:focus {
    outline: none;
    border-color: #007BFF;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.search-box::after {
    content: "\1F50D"; /* 🔍 */
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
    pointer-events: none;
}

.field textarea {
  width: 100%;
  min-height: 80px;       
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  resize: vertical;       
  font-family: inherit;
}

.field textarea:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22,163,74,0.2);
}

.error-field textarea {
  border-color: #dc2626;
  background: #fef2f2;
}

.field textarea + .error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
}

/* Блок категории над товаром, по центру */
.product-category {
    text-align: center;        /* Центрируем текст */
    margin: 20px 0;            /* Отступ сверху и снизу */
    font-size: 18px;           /* Размер текста */
    font-weight: 600;          /* Полужирный */
}

.product-category a {
    text-decoration: none;
    color: #000;               /* черный текст */
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.product-category a:hover {
    color: #fff;               /* текст становится белым */
    background: #000;          /* фон черный */
}


/* Блок категории над товаром, по центру */
.product-category {
    text-align: center;        /* Центрируем текст */
    margin: 20px 0;            /* Отступ сверху и снизу */
    font-size: 18px;           /* Размер текста */
    font-weight: 600;          /* Полужирный */
}

.product-category a {
    text-decoration: none;
    color: #0077cc;
    transition: color 0.2s;
}

.product-category a:hover {
    color: #005fa3;
    text-decoration: underline;
}

/* === Сайдбар категорий слева === */
.sidebar-categories {
    position: absolute;
    top: 150px; /* отступ от верха, под header */
    left: 20px;
    width: 220px;
    font-family: inherit;
}

/* Основные категории вертикально */
.sidebar-categories .main-categories {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Пункт основной категории */
.sidebar-categories .main-categories > li {
    position: relative;
    margin-bottom: 10px;
}

.sidebar-categories .main-categories > li span {
    display: block;
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar-categories .main-categories > li span:hover {
    background: #000; /* черный цвет при наведении */
    color: #fff;
}

/* Подкатегории */
.sidebar-categories .sub-categories {
    display: none;
    list-style: none;
    margin: 4px 0 0 0;
    padding: 0;
    min-width: 100%; /* минимум ширина как у родителя */
    box-sizing: border-box;
}

.sidebar-categories .sub-categories li a {
    display: block;
    padding: 6px 14px;
    text-decoration: none;
    color: #333;
    border-left: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.2s ease;
    min-width: 100%; /* чтобы ширина подкатегорий совпадала или больше */
}

.sidebar-categories .sub-categories li a:hover {
    background: #000; /* черный цвет на hover */
    color: #fff;
    border-left: 2px solid #005fa3;
}

/* ===== Адаптив ===== */
@media (max-width: 1650px) {
    .sidebar-categories {
        position: static; /* теперь блок становится обычным, сверху */
        width: 100%;
        margin-bottom: 20px;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .sidebar-categories .main-categories {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
    }

    .sidebar-categories .main-categories > li {
        margin-bottom: 0;
    }

    .sidebar-categories .main-categories > li span {
        padding: 6px 10px;
        font-size: 14px;
    }

    .sidebar-categories .sub-categories {
        position: absolute;
        top: 100%;
        left: 0;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        border-radius: 4px;
        z-index: 100;
        min-width: max-content; /* ширина подкатегорий зависит от контента, минимум как родитель */
    }
}

@media (max-width: 768px) {
    .sidebar-categories {
        display: none; /* на мобильных убираем сайдбар */
    }

    .product-page {
        grid-template-columns: 1fr; /* карточка товара на всю ширину */
        padding: 24px;
    }
}
