/* ============================================================
   PRODUCT.CSS — СТИЛИ ДЛЯ СТРАНИЦЫ КАТАЛОГА
   ============================================================ */

/* ===== ГЕРОЙ ===== */
.catalog-hero {
    background: #1b1816;
    padding: 70px 20px 60px;
    text-align: center;
    width: 100%;
    position: relative;
    overflow: hidden;
}
.catalog-hero::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(245,159,21,0.06) 0%, transparent 70%);
    border-radius: 50%;
}
.catalog-hero-inner { max-width: 900px; margin: 0 auto; position: relative; z-index: 1; }
.catalog-hero h1 {
    color: #f59f15;
    font-size: clamp(2.8rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 16px;
    font-family: Arial, Helvetica, sans-serif;
}
.catalog-hero .subtitle {
    color: rgba(255,255,255,0.75);
    font-size: 1.15rem;
    max-width: 750px;
    margin: 0 auto 8px;
    line-height: 1.7;
}
.catalog-hero .subtitle-second {
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    max-width: 650px;
    margin: 0 auto 30px;
    line-height: 1.6;
}
.btn-download {
    display: inline-block;
    background: #f59f15;
    color: #ffffff;
    padding: 14px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 2px solid #f59f15;
    box-shadow: 0 4px 20px rgba(245,159,21,0.3);
    margin: 0 8px;
}
.btn-download.outline {
    background: transparent;
    color: #f59f15;
    box-shadow: none;
}
.btn-download:hover { transform: translateY(-4px); box-shadow: 0 8px 40px rgba(245,159,21,0.4); }
.btn-download.outline:hover { background: #f59f15; color: #ffffff; }

/* ===== ОСНОВНОЙ КОНТЕЙНЕР ===== */
.catalog-wrapper {
    display: flex;
    max-width: 1440px;
    margin-top: 120px;
    margin-bottom: 120px;
    padding: 0 20px 40px;
    gap: 30px;
    align-items: flex-start;
}

/* ===== ЛЕВАЯ ПАНЕЛЬ ===== */
.catalog-sidebar {
    flex: 0 0 280px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    padding: 20px 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}
.catalog-sidebar::-webkit-scrollbar { width: 4px; }
.catalog-sidebar::-webkit-scrollbar-thumb { background: #f59f15; border-radius: 10px; }
.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 0 20px 16px;
    color: #1b1816;
    border-bottom: 2px solid #f2ece8;
    margin-bottom: 8px;
}
.category-tree { list-style: none; padding: 0; margin: 0; }
.category-tree li { list-style: none; }
.category-item {
    display: block;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    color: #1b1816;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    position: relative;
}
.category-item:hover { background: #f9f5f2; border-left-color: #f59f15; }
.category-item.active { background: #f9f5f2; border-left-color: #f59f15; color: #f59f15; }
.category-item .arrow { float: right; transition: transform 0.3s; color: #8c8784; }
.category-item .arrow.open { transform: rotate(90deg); }
.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    background: #faf8f7;
}
.subcategory-list.open { max-height: 800px; }
.subcategory-list li .category-item {
    padding-left: 40px;
    font-weight: 400;
    font-size: 0.95rem;
    border-left-color: transparent;
}
.subcategory-list li .category-item:hover { background: #f0ebe7; border-left-color: #f59f15; }
.subcategory-list li .category-item.active { background: #f0ebe7; border-left-color: #f59f15; }

/* ===== ПРАВАЯ ЧАСТЬ ===== */
.catalog-content { flex: 1; min-width: 0; }
.breadcrumb { font-size: 0.9rem; color: #8c8784; padding: 10px 0 16px; }
.breadcrumb span { color: #1b1816; font-weight: 500; }
.breadcrumb .sep { margin: 0 8px; }

/* ===== СЕТКА ===== */
.catalog-grid {
    display: grid;
    gap: 0;
    border: 1px solid #e0dbd7;
    background: #e0dbd7;
    margin-bottom: 120px;
}
.catalog-grid.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.catalog-grid.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

.grid-item {
    background: #ffffff;
    aspect-ratio: 1 / 1;
    max-height: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    border-right: 1px solid #e0dbd7;
    border-bottom: 1px solid #e0dbd7;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.catalog-grid.grid-cols-2 .grid-item:nth-child(2n) { border-right: none; }
.catalog-grid.grid-cols-3 .grid-item:nth-child(3n) { border-right: none; }

.grid-item:hover { background: #f9f5f2; z-index: 1; box-shadow: inset 0 0 0 2px #f59f15; }
.grid-item img {
    width: 300px;
    height: 300px;
    object-fit: contain;
    margin-bottom: 12px;
    flex-shrink: 0;
    background: #f2ece8;
    border-radius: 8px;
    padding: 8px;
}
.grid-item .item-title { font-weight: 600; font-size: 1rem; color: #1b1816; line-height: 1.3; word-break: break-word; }
.grid-item .item-sub { font-size: 0.8rem; color: #8c8784; margin-top: 4px; }

.grid-item.category-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    aspect-ratio: 1 / 1;
}
.grid-item.category-grid-item .item-title { margin-top: auto; padding-bottom: 20px; }

.grid-item.product-item {
    aspect-ratio: auto;
    padding: 16px 16px 0;
    cursor: default;
    justify-content: flex-start;
}
.grid-item.product-item:hover { box-shadow: none; background: #ffffff; }
.grid-item.product-item img { width: 100px; height: 100px; margin-bottom: 8px; flex-shrink: 0; }
.grid-item.product-item .product-info {
    margin-top: auto;
    padding-bottom: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.grid-item.product-item .product-info .item-title { font-size: 1rem; font-weight: 600; }
.grid-item.product-item .product-info .item-sub { font-size: 0.8rem; color: #8c8784; margin: 2px 0 4px; }
.grid-item.product-item .product-info .price { font-weight: 700; color: #f59f15; font-size: 1.2rem; margin: 8px 0 4px; }
.grid-item.product-item .btn-order-sm {
    background: #f59f15;
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 4px;
}
.grid-item.product-item .btn-order-sm:hover { background: #5c3100; transform: scale(1.05); }

.product-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.product-actions .btn-order-sm { flex: 1 1 auto; min-width: 80px; }
.btn-cart { background: #2c3e50 !important; }
.btn-cart:hover { background: #1a252f !important; }

/* ===== МОДАЛЬНОЕ ОКНО ДЛЯ ТОВАРА ===== */
.product-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}
.product-modal {
    background: #ffffff;
    border-radius: 20px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    padding: 24px;
}
.product-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.product-modal-back {
    background: none;
    border: none;
    font-size: 1rem;
    color: #1b1816;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}
.product-modal-back:hover { background: #f2ece8; }
.product-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #8c8784;
    padding: 4px 8px;
    transition: color 0.2s;
}
.product-modal-close:hover { color: #1b1816; }
.product-modal-body { display: flex; gap: 30px; flex-wrap: wrap; }
.product-modal-left { flex: 0 0 300px; display: flex; justify-content: center; align-items: center; }
.product-modal-left img { max-width: 100%; max-height: 300px; object-fit: contain; background: #f2ece8; border-radius: 12px; padding: 16px; }
.product-modal-right { flex: 1; min-width: 250px; }
.product-modal-right h2 { font-size: 1.8rem; margin: 0 0 8px; color: #1b1816; }
.product-modal-right .product-modal-price { font-size: 1.6rem; font-weight: 700; color: #f59f15; margin: 12px 0 16px; }
.product-modal-right .product-modal-desc { font-size: 1rem; color: #4a4643; margin-bottom: 20px; line-height: 1.5; }
.product-modal-specs h3 {
    font-size: 1.2rem;
    margin: 20px 0 12px;
    color: #1b1816;
    border-bottom: 2px solid #f59f15;
    padding-bottom: 6px;
}
.product-modal-specs table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.product-modal-specs table td { padding: 8px 10px; border-bottom: 1px solid #e0dbd7; }
.product-modal-specs table td:first-child { font-weight: 600; color: #4a4643; width: 40%; }
.product-modal-specs table td:last-child { color: #1b1816; }
.modal-order-btn {
    background: #f59f15;
    color: #fff;
    border: none;
    padding: 12px 36px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 20px;
}
.modal-order-btn:hover { background: #5c3100; transform: scale(1.02); }

/* ===== ИКОНКА КОРЗИНЫ ===== */
#cartIcon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #f59f15;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(245,159,21,0.4);
    z-index: 999;
    font-size: 28px;
    transition: all 0.3s ease;
}
#cartIcon:hover { transform: scale(1.1); box-shadow: 0 8px 30px rgba(245,159,21,0.6); }
#cartBadge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* ============================================================
   ПОЛЗУНОК КАТАЛОГ / ПРАЙС
   ============================================================ */
.mode-toggle-container { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.toggle-wrapper {
    background: #e0dbd7;
    padding: 4px;
    border-radius: 30px;
    width: 260px;
    position: relative;
    display: flex;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    user-select: none;
}
.toggle-wrapper input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-label {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s;
    padding: 10px 0;
    user-select: none;
    font-family: Arial, Helvetica, sans-serif;
}
.slider-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background-color: #f59f15;
    border-radius: 30px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 1;
    box-shadow: 0 2px 8px rgba(245,159,21,0.4);
}
#modeSwitch:checked ~ .slider-bg { transform: translateX(100%); }
#modeSwitch:checked ~ .label-price { color: #ffffff; }
#modeSwitch:not(:checked) ~ .label-catalog { color: #ffffff; }

/* ============================================================
   ПРАЙС-ТАБЛИЦА
   ============================================================ */
.price-content { display: none; }
.price-content.show { display: block; }
.catalog-content { display: block; }
.catalog-content.hide { display: none; }

#priceTable {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-radius: 12px;
    overflow: hidden;
    font-size: 0.9rem;
}
#priceTable thead th {
    background: #1b1816;
    color: #ffffff;
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#priceTable tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f2ece8;
    vertical-align: middle;
}
#priceTable tbody tr:last-child td { border-bottom: none; }
#priceTable tbody tr:nth-child(even) { background-color: #faf8f7; }
#priceTable tbody tr:nth-child(odd) { background-color: #ffffff; }
.category-header-row {
    background-color: #f59f15 !important;
    color: #ffffff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}
.category-header-row td { padding: 10px 16px !important; background-color: #f59f15 !important; color: #ffffff !important; }
#priceTable tbody tr[data-articul] { cursor: pointer; transition: background 0.2s; }
#priceTable tbody tr[data-articul]:hover { background-color: #ffecd6 !important; }
.price-cell { font-weight: 700; color: #1b1816; white-space: nowrap; }
.price-cell.empty { color: #8c8784; font-weight: 400; }

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */

@media (max-width: 1024px) {
    .catalog-grid.grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .catalog-grid.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .catalog-grid .grid-item:nth-child(2n) { border-right: none; }
    .catalog-grid .grid-item:nth-child(3n) { border-right: 1px solid #e0dbd7; }
    .catalog-grid.grid-cols-2 .grid-item:nth-child(2n) { border-right: none; }
    .catalog-grid.grid-cols-3 .grid-item:nth-child(3n) { border-right: 1px solid #e0dbd7; }
    .catalog-grid.grid-cols-3 .grid-item:nth-child(2n) { border-right: none; }
    .grid-item { max-height: 400px; }
}

@media (max-width: 768px) {
    .catalog-wrapper { flex-direction: column; padding: 0 12px 30px; margin-top: 60px; margin-bottom: 60px; }
    .catalog-sidebar {
        flex: none;
        width: 100%;
        position: static;
        max-height: none;
        padding: 12px 0;
    }
    .catalog-grid { margin-bottom: 80px; }
    .catalog-grid.grid-cols-2, .catalog-grid.grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
    .catalog-grid .grid-item:nth-child(2n) { border-right: none; }
    .catalog-grid .grid-item:nth-child(3n) { border-right: 1px solid #e0dbd7; }
    .catalog-grid .grid-item:nth-child(2n) { border-right: none; }
    .grid-item img { width: 60px; height: 60px; }
    .grid-item .item-title { font-size: 0.85rem; }
    .grid-item.product-item img { width: 70px; height: 70px; }
    .grid-item { max-height: 400px; }
    .product-actions .btn-order-sm { min-width: 60px; font-size: 0.7rem; padding: 4px 12px; }
    .catalog-hero { padding: 50px 20px 40px; }
    .catalog-hero h1 { font-size: 2.2rem; }
    .catalog-hero .subtitle { font-size: 1rem; }
    .catalog-hero .subtitle-second { font-size: 0.9rem; }
    .btn-download { padding: 12px 28px; font-size: 0.9rem; margin: 4px; }
}

@media (max-width: 480px) {
    .catalog-wrapper { padding: 0 10px 20px; margin-top: 40px; margin-bottom: 40px; }
    .catalog-hero { padding: 30px 12px 24px; }
    .catalog-hero h1 { font-size: 1.6rem; }
    .catalog-hero .subtitle { font-size: 0.85rem; }
    .catalog-hero .subtitle-second { font-size: 0.8rem; }
    .btn-download { padding: 10px 20px; font-size: 0.8rem; margin: 4px; display: block; width: 100%; text-align: center; }

    .catalog-sidebar { padding: 8px 0; }
    .sidebar-title { font-size: 1rem; padding: 0 15px 12px; }
    .category-item { padding: 10px 15px; font-size: 0.9rem; }
    .subcategory-list li .category-item { padding-left: 25px; font-size: 0.85rem; }

    .catalog-grid { margin-bottom: 40px; }
    .catalog-grid.grid-cols-2, .catalog-grid.grid-cols-3 { grid-template-columns: 1fr 1fr; }
    .grid-item {
        aspect-ratio: auto;
        min-height: 140px;
        padding: 10px;
        max-height: 350px;
    }
    .mode-toggle-container {justify-content: center;}
    .catalog-content{width: 100%;}
    .catalog-wrapper{justify-content: center;}
    .grid-item img { width: 50px; height: 50px; margin-bottom: 6px; }
    .grid-item.category-grid-item { aspect-ratio: auto; min-height: 120px; }
    .grid-item.product-item { padding: 10px 10px 0; }
    .grid-item.product-item img { width: 60px; height: 60px; }
    .grid-item.product-item .product-info { padding-bottom: 12px; }
    .grid-item.product-item .product-info .price { font-size: 1rem; }
    .product-actions { flex-direction: column; gap: 4px; }
    .product-actions .btn-order-sm { width: 100%; }

    .toggle-wrapper { width: 180px; }
    .toggle-label { font-size: 0.7rem; padding: 6px 0; }

    #priceTable { font-size: 0.7rem; }
    #priceTable thead th, #priceTable tbody td { padding: 6px 8px; }
    .price-modal { padding: 24px 20px; margin: 10px; }
    .price-modal .detail-label { width: 70px; font-size: 0.85rem; }
    .price-modal h2 { font-size: 1.1rem; }

    .product-modal-body { flex-direction: column; }
    .product-modal-left { flex: 1 1 auto; }
    .product-modal-left img { max-height: 200px; }
    .product-modal-right h2 { font-size: 1.4rem; }
    .product-modal-right .product-modal-price { font-size: 1.3rem; }
    .product-modal-specs table td { padding: 6px 8px; font-size: 0.85rem; }
}

/* ===== ИНФОРМАЦИЯ О ЦЕНАХ ===== */
.price-info {
    font-size: 0.95rem;
    color: #8c8784;
    padding: 8px 0 16px;
    border-bottom: 1px solid #f2ece8;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .price-info {
        font-size: 0.85rem;
        padding: 6px 0 12px;
        margin-bottom: 14px;
    }
}

@media (max-width: 480px) {
    .price-info {
        font-size: 0.75rem;
        padding: 4px 0 10px;
        margin-bottom: 10px;
    }
}

/* ===== ИНФОРМАЦИЯ О ЦЕНАХ ===== */
.price-info {
    font-size: 0.95rem;
    color: #8c8784;
    padding: 8px 0 16px;
    border-bottom: 1px solid #f2ece8;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .price-info {
        font-size: 0.85rem;
        padding: 6px 0 12px;
        margin-bottom: 14px;
    }
}

@media (max-width: 480px) {
    .price-info {
        font-size: 0.75rem;
        padding: 4px 0 10px;
        margin-bottom: 10px;
    }
}