/* ================= ИДЕАЛЬНЫЙ ПАРЯЩИЙ СКРОЛЛБАР ================= */
::-webkit-scrollbar {
    width: 12px;  /* Делаем шире для невидимой рамки */
    height: 12px;
}

::-webkit-scrollbar-track {
    background-color: var(--bg-main); /* Жестко сливаем с фоном */
    border: none;
}

/* Сам ползунок (эффект парения) */
::-webkit-scrollbar-thumb {
    background-color: rgba(136, 136, 136, 0.4);
    border-radius: 10px;
    border: 3px solid var(--bg-main); /* Прозрачная окантовка цветом фона */
    background-clip: padding-box; /* Заставляем фон не залезать под рамку */
    transition: background-color 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(136, 136, 136, 0.7);
}

/* Угол пересечения скроллбаров */
::-webkit-scrollbar-corner {
    background-color: var(--bg-main);
}

/* ЖЕСТКИЙ ФИКС ГЛАВНОГО ОКНА */
html::-webkit-scrollbar-track, 
body::-webkit-scrollbar-track {
    background-color: var(--bg-main) !important;
}

/* Для Firefox (он не поддерживает сложные фокусы с рамками) */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(136, 136, 136, 0.5) var(--bg-main);
}

/* ================= ТЕМЫ И ПЕРЕМЕННЫЕ ================= */
:root {
    color-scheme: light dark;
    --bg-main: #f0f2f5;
    --bg-surface: #ffffff;
    --bg-header: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #737373;
    --border-color: #e4e6eb;
    --accent-color: #00bcd4;
    --accent-hover: #0097a7;
    --price-color: #1a1a1a;
    --shadow: 0 4px 15px rgba(0,0,0,0.06);
    --danger: #ff4757;
    --success: #2ed573;
    --order-color: #f39c12;
    --modal-bg: rgba(0,0,0,0.6);
}

[data-theme="dark"] {
    --bg-main: #0a0c10;
    --bg-surface: #161b22;
    --bg-header: #010409;
    --text-main: #e6edf3;
    --text-muted: #8b949e;
    --border-color: #30363d;
    --accent-color: #00e5ff;
    --accent-hover: #33ebff;
    --price-color: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.4);
    --order-color: #f1c40f;
    --modal-bg: rgba(0,0,0,0.8);
}

/* ================= ФИКСЫ ДЛЯ IPHONE И SAFARI ================= */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, select, textarea, button {
    font-family: inherit;
}

@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important; 
    }
}

/* ================= БАЗА ================= */
* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji"; 
    transition: background-color 0.2s, color 0.2s, border-color 0.2s; 
}

/* Убрал двойной скролл из-за конфликта html/body */
html {
    background-color: var(--bg-main);
    -webkit-overflow-scrolling: touch;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden; /* Скрытие по X оставляем ТОЛЬКО для body */
    width: 100%;
    min-height: 100dvh;
    position: relative;
}

/* ================= ШАПКА ================= */
.header {
    position: sticky; top: 0; background-color: var(--bg-header); border-bottom: 1px solid var(--border-color);
    padding: 10px 30px; 
    display: flex; align-items: center; justify-content: space-between; z-index: 1000;
    height: 70px; width: 100%; 
}

.logo { display: flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.logo img { height: 40px; object-fit: contain; }

.main-nav { 
    display: flex; gap: 22px; margin-left: 25px; flex-shrink: 0; 
}
.nav-link {
    background: none; border: none; color: var(--text-main); font-size: 14px; font-weight: 600;
    cursor: pointer; padding: 5px 0; position: relative; white-space: nowrap;
}
.nav-link::after { content: ''; position: absolute; bottom: -5px; left: 0; right: 0; height: 2px; background-color: var(--accent-color); transform: scaleX(0); transition: 0.3s; }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); }
.nav-link.active { color: var(--accent-color); }

/* ================= ПОИСК (МОНОЛИТНЫЙ ДИЗАЙН) ================= */
.search-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 700px; /* Чтобы на огромных экранах не растягивался на километр */
    margin: 0 auto;
    box-shadow: var(--shadow);
    border-radius: 8px;
}

.search-bar input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-right: none; /* Сливаемся с кнопками */
    border-radius: 8px 0 0 8px;
    background-color: var(--bg-surface);
    color: var(--text-main);
    outline: none;
    font-size: 16px;
    min-width: 0;
    transition: border-color 0.2s;
}

.search-bar button {
    background-color: var(--bg-surface);
    border: 2px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background-color 0.2s;
}

.search-bar button:hover {
    background-color: var(--bg-main);
}

/* Кнопка поиска (лупа) */
.search-bar .search-btn-submit {
    border-left: none;
    border-right: none; /* Сливаемся с крестиком */
    padding: 0 15px;
}

/* Кнопка закрытия (крестик) */
.search-bar .search-btn-close {
    border-left: 1px solid var(--border-color); /* Тонкий разделитель между кнопками */
    border-radius: 0 8px 8px 0;
    padding: 0 15px;
    color: var(--text-muted);
}
.search-bar .search-btn-close:hover {
    color: var(--danger);
}

/* Подсветка всей рамки при фокусе на инпуте */
.search-bar input:focus {
    border-color: var(--accent-color);
}
.search-bar input:focus ~ button {
    border-color: var(--accent-color);
}
.actions { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
.icon-btn { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); width: 40px; height: 40px; border-radius: 8px; display: flex; justify-content: center; align-items: center; cursor: pointer; font-size: 18px; position: relative; transition: 0.2s; }
.icon-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }

.hamburger { display: none; background: none; border: none; font-size: 28px; color: var(--text-main); cursor: pointer; }

/* ================= КОНТЕЙНЕР ================= */
.container { max-width: 1400px; margin: 0 auto; padding: 40px 20px; width: 100%; }
.view-section { display: none; animation: fadeIn 0.3s ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.section-header { font-size: 28px; font-weight: 700; margin-bottom: 25px; color: var(--text-main); }

/* ================= О НАС (ГЛАВНАЯ) ================= */
.hero-bento { margin-bottom: 50px; }
.bento-header { text-align: center; margin-bottom: 30px; }
.bento-header img { height: 80px; margin-bottom: 15px; border-radius: 12px; }
.bento-header h1 { font-size: 32px; margin-bottom: 10px; color: var(--text-main); }
.bento-header .lead { font-size: 16px; color: var(--text-muted); max-width: 600px; margin: 0 auto; line-height: 1.5; }

.bento-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.bento-card { background: var(--bg-surface); padding: 25px; border-radius: 16px; border: 1px solid var(--border-color); text-align: center; transition: 0.3s; }
.bento-card:hover { transform: translateY(-5px); border-color: var(--accent-color); box-shadow: var(--shadow); }
.bento-icon { font-size: 40px; margin-bottom: 15px; }
.bento-card h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-main); }
.bento-card p { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

.modern-details { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; overflow: hidden; transition: 0.3s; }
.modern-details summary { padding: 20px; font-size: 16px; font-weight: bold; cursor: pointer; color: var(--accent-color); outline: none; list-style: none; display: flex; justify-content: space-between; align-items: center; background: var(--bg-main); transition: 0.2s; }
.modern-details summary:hover { background: var(--border-color); }
.modern-details summary::-webkit-details-marker { display: none; }
.modern-details[open] summary { border-bottom: 1px solid var(--border-color); }
.details-content { padding: 25px; line-height: 1.6; color: var(--text-muted); font-size: 15px; }
.details-content ul { padding-left: 20px; margin-bottom: 20px; }
.details-content li { margin-bottom: 8px; }
.warning-box { background: rgba(0, 188, 212, 0.1); border-left: 4px solid var(--accent-color); padding: 15px; border-radius: 4px; margin: 20px 0; color: var(--text-main); font-size: 14px; }

/* ================= КАРУСЕЛИ ================= */
.carousel-container { position: relative; margin-bottom: 60px; width: 100%; }
.carousel-track { display: flex; gap: 20px; overflow-x: auto; scroll-behavior: smooth; padding-bottom: 15px; scroll-snap-type: x mandatory; width: 100%; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 45px; height: 45px; border-radius: 50%; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); font-size: 20px; cursor: pointer; z-index: 10; box-shadow: var(--shadow); }
.carousel-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }
.carousel-btn.left { left: -20px; } .carousel-btn.right { right: -20px; }

/* ================= КАТАЛОГ (ЛЕВЫЙ САЙДБАР + СЕТКА) ================= */
.catalog-layout { display: flex; gap: 30px; align-items: flex-start; }
.sidebar { 
    width: 280px; 
    flex-shrink: 0; 
    background: var(--bg-surface); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 25px; 
    position: sticky; 
    top: 90px; /* Отступаем от фиксированной шапки */
    max-height: calc(100vh - 110px); /* Ограничиваем высоту экраном */
    overflow-y: auto; /* Включаем ОБЩИЙ скролл для всей панели */
}
.filter-block { margin-bottom: 25px; display: none; } 
.filter-block.active { display: block; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 15px; }
.filter-block.active:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.filter-title { font-size: 16px; font-weight: bold; margin-bottom: 15px; }
.filter-header { padding: 10px 0; font-weight: bold; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: var(--text-main); user-select: none; transition: 0.2s; }
.filter-header:hover { color: var(--accent-color); }
.price-inputs { display: flex; gap: 10px; align-items: center; }
.price-inputs input { width: 100%; padding: 8px; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-main); color: var(--text-main); }

.products-grid { flex-grow: 1; display: grid; grid-template-columns: 1fr; gap: 20px; width: 100%; }

.product-card { 
    display: flex; flex-direction: row; align-items: stretch; padding: 20px; text-align: left; gap: 25px; 
    background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); transition: transform 0.2s, box-shadow 0.2s; 
    cursor: pointer; position: relative;
}
[data-theme="dark"] .product-card { box-shadow: 0 4px 15px rgba(0,0,0,0.4); }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); border-color: var(--accent-color); }
[data-theme="dark"] .product-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.6); }

.product-card .prod-img { width: 160px; height: 160px; margin-bottom: 0; flex-shrink: 0; background: var(--bg-main); border-radius: 8px; padding: 10px; display: flex; justify-content: center; align-items: center; font-size: 60px; }
.product-card .prod-details { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    min-width: 0; /* КРИТИЧЕСКИ ВАЖНО: не дает тексту разорвать карточку */
}
.product-card .prod-bottom { width: 220px; flex-shrink: 0; flex-direction: column; justify-content: center; align-items: flex-end; border-left: 1px solid var(--border-color); padding-left: 25px; margin-top: 0; display: flex; }
.product-card .price-col { align-items: flex-end; margin-bottom: 15px; width: 100%; text-align: right; display: flex; flex-direction: column; }

.old-price { font-size: 13px; color: var(--text-muted); text-decoration: line-through; margin-bottom: 2px; }
.prod-price { font-size: 20px; font-weight: bold; color: var(--price-color); }
.order-status { font-size: 12px; color: var(--order-color); font-weight: bold; margin-top: 4px; }

.fav-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--border-color); transition: 0.2s; padding-bottom: 2px;}
.fav-btn.active { color: var(--danger); }
.fav-btn:hover:not(.active) { color: var(--text-muted); }

/* ================= СТРАНИЦА ТОВАРА ================= */
.back-btn { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; margin-bottom: 20px; display: flex; align-items: center; gap: 5px; }
.back-btn:hover { color: var(--accent-color); }
.product-page-layout { display: flex; gap: 40px; margin-bottom: 60px; }
.product-gallery { flex: 1; max-width: 450px; position: relative; }

.gallery-btn { 
    background: transparent !important; color: var(--accent-color) !important; border: none !important; 
    font-size: 50px !important; line-height: 1; padding: 0 15px !important; 
    text-shadow: 0 2px 8px rgba(0,0,0,0.4); outline: none; z-index: 10; transition: color 0.2s;
    position: absolute; top: 50%; margin-top: -25px !important; cursor: pointer;
}
.gallery-btn.left { left: 5px; }
.gallery-btn.right { right: 5px; }
.gallery-btn:hover { color: var(--text-main) !important; }

.main-photo { position: relative; width: 100%; height: 400px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 100px; margin-bottom: 15px; overflow: hidden; touch-action: pan-y; }

.fav-btn-absolute { position: absolute; top: 15px; right: 15px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 50%; width: 45px; height: 45px; display: flex; justify-content: center; align-items: center; font-size: 22px; cursor: pointer; box-shadow: var(--shadow); transition: 0.2s; z-index: 15; }
.fav-btn-absolute:hover { transform: scale(1.1); }

.product-info { flex: 2; }
.product-info h1 { font-size: 32px; margin-bottom: 15px; }
.product-info .price { font-size: 36px; font-weight: bold; color: var(--accent-color); }
.product-desc { font-size: 16px; line-height: 1.6; color: var(--text-muted); margin: 25px 0; padding: 20px; background: transparent !important; border: none !important; }
.contact-btn { background: var(--accent-color); color: #000; font-weight: bold; font-size: 16px; padding: 15px 30px; border: none; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; }
.contact-btn:hover { background: var(--accent-hover); }

.word-break-safe { word-wrap: break-word !important; word-break: break-word !important; overflow-wrap: anywhere !important; hyphens: auto; }

/* Стили комплектации (Бандлы) */
.bundle-pill {
    display: inline-flex; align-items: center; padding: 8px 14px; 
    background: var(--bg-surface); border: 1px solid var(--border-color); 
    border-radius: 20px; cursor: pointer; transition: 0.2s; user-select: none;
    font-size: 14px; color: var(--text-main); font-weight: 600; margin-bottom: 8px;
}
.bundle-pill:hover:not(.disabled):not(.locked) { border-color: var(--accent-color); }
.bundle-pill.active-bundle { background: rgba(0, 188, 212, 0.05); border-color: var(--accent-color); }
.bundle-pill .bundle-check-icon { display: none; color: var(--accent-color); font-weight: bold; margin-right: 6px; }
.bundle-pill.active-bundle .bundle-check-icon { display: inline-block; }
.bundle-pill.disabled { opacity: 0.5; cursor: not-allowed; color: var(--text-muted); text-decoration: line-through; }
.bundle-pill.locked { cursor: default; opacity: 0.9; }

#accessories-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important; gap: 15px; }
.acc-card { flex-direction: column !important; justify-content: center !important; align-items: center !important; padding: 25px 15px !important; text-align: center !important; height: 100%; }

/* ================= МОДАЛКА ================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--modal-bg); backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 9999; }
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
.modal-box { background: var(--bg-surface); padding: 30px; border-radius: 16px; width: 90%; max-width: 400px; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.5); text-align: center; position: relative; }
.modal-close { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 24px; color: var(--text-muted); cursor: pointer; }
.social-btns { display: flex; flex-direction: column; gap: 15px; margin-top: 20px; }
.social-btn { padding: 15px; border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; text-decoration: none; color: white; display: flex; align-items: center; justify-content: center; gap: 10px; }
.vk-btn { background: #0077FF; } 

/* ================= ЛАЙТБОКС (ЖЕЛЕЗОБЕТОННЫЙ) ================= */
body.lightbox-open { overflow: hidden !important; }

.lightbox-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.95); z-index: 999999; 
    display: none; opacity: 0; transition: 0.2s; 
}
.lightbox-overlay.active { display: block; opacity: 1; }

.lightbox-close { 
    position: absolute; top: 15px; right: 20px; z-index: 10005; 
    font-size: 45px; color: white; background: none; border: none; cursor: pointer; 
    line-height: 1; padding: 10px; text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.lightbox-img-wrapper { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    display: flex; justify-content: center; align-items: center; 
    z-index: 10001; overflow: hidden;
}
.lightbox-img { 
    max-width: 95vw; max-height: 80vh; 
    object-fit: contain; transition: transform 0.15s ease-out; 
    cursor: grab; user-select: none; -webkit-user-drag: none;
}
.lightbox-img:active { cursor: grabbing; }

.lightbox-thumbnails-wrapper {
    position: absolute; bottom: 20px; left: 0; width: 100%; height: 80px;
    display: flex; gap: 12px; justify-content: center; align-items: center;
    overflow-x: auto; padding: 0 20px; z-index: 10005;
    scrollbar-width: none; -ms-overflow-style: none;
}
.lightbox-thumbnails-wrapper::-webkit-scrollbar { display: none; }
.lightbox-thumb {
    width: 60px; height: 60px; border-radius: 8px; border: 2px solid transparent; 
    opacity: 0.5; cursor: pointer; transition: 0.2s; object-fit: cover; flex-shrink: 0; background: var(--bg-main);
}
.lightbox-thumb.active { border-color: var(--accent-color); opacity: 1; transform: scale(1.1); }

.lightbox-nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); color: white; border: none; width: 50px; height: 50px; border-radius: 50%;
    font-size: 20px; cursor: pointer; z-index: 10005; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(2px);
}
.lightbox-nav-btn:hover { background: rgba(255,255,255,0.3); }
.lightbox-nav-btn.left { left: 20px; }
.lightbox-nav-btn.right { right: 20px; }

/* Миниатюры товара */
.thumbnails-container { width: 100%; max-width: 100%; margin-top: 10px; position: relative; }
.thumbnails-wrapper { 
    width: 100%; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; -ms-overflow-style: none; padding: 5px 0;
    -webkit-mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
    mask-image: linear-gradient(to right, transparent, black 20px, black calc(100% - 20px), transparent);
}
/* Жестко убиваем скроллбары в горизонтальных лентах карточки товара */
.thumbnails-wrapper::-webkit-scrollbar,
.carousel-track::-webkit-scrollbar,
.mobile-categories-carousel::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    -webkit-appearance: none;
}
.thumbnails { display: flex; gap: 10px; width: max-content; padding: 0 20px; }
.thumb { width: 70px; height: 70px; flex-shrink: 0; background: var(--bg-surface); border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 30px; transition: 0.2s;}
.thumb.active { border-color: var(--accent-color); transform: scale(1.05); }

/* ================= КАРУСЕЛЬ КАТЕГОРИЙ (МОБИЛКИ) ================= */
.mobile-categories-carousel { display: none; }
.mobile-filters-btn { display: none; width: 100%; padding: 12px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 8px; margin-bottom: 15px; font-weight: bold; color: var(--text-main); cursor: pointer; text-align: center; }

@media (max-width: 1050px) {
    .mobile-categories-carousel {
        display: flex; gap: 12px; overflow-x: auto; padding-bottom: 15px; margin-bottom: 25px;
        scroll-snap-type: x mandatory; scrollbar-width: none; -ms-overflow-style: none;
    }
    .mobile-categories-carousel::-webkit-scrollbar { display: none; }
    .carousel-cat-btn {
        background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 12px;
        padding: 12px 20px; font-size: 15px; font-weight: 600; color: var(--text-main); white-space: nowrap;
        scroll-snap-align: start; box-shadow: var(--shadow); cursor: pointer; transition: 0.2s; outline: none;
    }
    .carousel-cat-btn:active { border-color: var(--accent-color); color: var(--accent-color); }
    
    .product-card { flex-direction: column; padding: 15px; gap: 15px; }
    .product-card .prod-img { width: 100%; height: 150px; margin-right: 0; }
    .product-card .prod-details { 
        flex-grow: 1; 
        display: flex; 
        flex-direction: column; 
        justify-content: flex-start; 
        min-width: 0; /* КРИТИЧЕСКИ ВАЖНО: не дает тексту разорвать карточку */
    }
    .product-card .prod-bottom { width: 100%; border-left: none; padding-left: 0; margin-top: 0; align-items: center; flex-direction: row; justify-content: space-between; }
    .product-card .price-col { align-items: flex-start; margin-bottom: 0; text-align: left; }
}

/* ================= АДАПТИВНОСТЬ И МЕДИА-ЗАПРОСЫ ================= */
.mobile-search-wrapper { 
    display: none; 
    position: absolute; 
    top: 100%; 
    left: 0; 
    width: 100%; 
    padding: 15px 30px; 
    background-color: var(--bg-header); 
    border-bottom: 1px solid var(--border-color); 
    box-shadow: var(--shadow);
    z-index: 998;
}

.mobile-search-wrapper.active { 
    display: block; 
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { 
    from { opacity: 0; transform: translateY(-10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

@media (max-width: 1425px) {
    .header { padding: 10px 15px !important; height: 60px !important; display: flex !important; justify-content: space-between !important; align-items: center !important; }
    .main-nav { position: fixed !important; top: 60px !important; right: -100% !important; width: 280px !important; height: calc(100vh - 60px) !important; background: var(--bg-surface) !important; flex-direction: column !important; align-items: flex-start !important; padding: 20px !important; margin: 0 !important; transition: right 0.3s ease !important; z-index: 999 !important; box-shadow: -5px 10px 20px rgba(0,0,0,0.5) !important; overflow-y: auto !important; }
    .main-nav.open { right: 0 !important; }
    .main-nav .nav-link { width: 100% !important; text-align: left !important; padding: 15px 0 !important; font-size: 18px !important; border-bottom: 1px solid var(--border-color) !important; }
    .logo img { height: 35px !important; }
    .actions { display: flex !important; align-items: center !important; gap: 15px !important; z-index: 1005 !important; position: relative !important; }
    .hamburger { display: block !important; font-size: 30px !important; background: transparent !important; border: none !important; color: var(--text-main) !important; cursor: pointer !important; padding: 0 !important; margin: 0 !important; line-height: 1 !important; }
}

@media (max-width: 768px) {
    .catalog-layout { flex-direction: column !important; gap: 15px !important; }
    .mobile-filters-btn { display: block !important; width: 100%; margin-bottom: 5px !important; text-align: center; }
    #category-sidebar { display: none; width: 100% !important; background: var(--bg-surface) !important; padding: 15px !important; border: 1px solid var(--border-color) !important; border-radius: 8px !important; margin-bottom: 10px !important; position: relative !important; box-shadow: none !important; }
    #category-sidebar.open { display: block !important; animation: fadeIn 0.2s ease; z-index: 100; margin-bottom: 20px; }
    
    .product-page-layout { flex-direction: column !important; gap: 20px !important; }
    .product-gallery { max-width: 100% !important; width: 100% !important; padding: 0 !important; }
    .main-photo { height: 400px !important; }
    .product-info { padding-top: 10px !important; }
    
    .lightbox-nav-btn { display: none; }
    .lightbox-img { max-height: 70vh; }
    .lightbox-thumbnails-wrapper { bottom: 10px; justify-content: center; }
        #catalog-toolbar {
        justify-content: center !important;
    }


    /* Делаем так, чтобы поиск выезжал прямо из-под шапки */
    #search-wrapper {
        position: absolute !important; /* Привязываемся к шапке */
        top: 100% !important;          /* Ровно под нижней границей шапки */
        left: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        background: var(--bg-header);
        padding: 15px 20px !important;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        z-index: 990; /* Чуть ниже самой шапки, чтобы выезжал "из-под" неё */
    }

    /* Анимация: падение сверху вниз */
    #search-wrapper[style*="display: block"] {
        animation: searchSlideDown 0.25s cubic-bezier(0.175, 0.885, 0.32, 1) forwards !important;
    }

    @keyframes searchSlideDown {
        from { transform: translateY(-100%); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    /* На всякий случай блокируем схлопывание навигации */
    #nav-wrapper {
        display: flex !important;
        opacity: 1 !important;
    }

    @keyframes searchSlideUp {
        from { transform: translate(-50%, 100px); opacity: 0; }
        to { transform: translate(-50%, 0); opacity: 1; }
    }

    /* Не даем шапке ломаться (исчезать), когда скрипт пытается скрыть меню */
    #nav-wrapper {
        display: flex !important;
        opacity: 1 !important;
    }
}

@media (min-width: 769px) {
    .container { max-width: 96% !important; padding-left: 20px !important; padding-right: 20px !important; }
    #category-sidebar { background: transparent !important; border: none !important; padding: 0 !important; width: 260px !important; box-shadow: none !important; margin-right: 30px; flex-shrink: 0; display: block !important; }
    .catalog-layout { gap: 40px !important; flex-direction: row !important; }
}

/* Скрытый реальный чекбокс */
.filter-checkbox {
    display: none;
}

/* Кастомный квадрат */
.filter-custom-check {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    border: 2px solid var(--border-color); /* Обводка как у всех кнопок */
    background: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

/* Состояние при клике: голубой фон */
.filter-checkbox:checked + .filter-custom-check {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
}

/* Белая галочка внутри */
.filter-checkbox:checked + .filter-custom-check::after {
    content: '✓';
    color: #ffffff !important; /* Теперь всегда белая */
    font-size: 14px;
    font-weight: bold;
}


/* Убираем "дырки" вокруг фоток на всех устройствах */
.product-card .prod-img {
    padding: 0 !important;
    overflow: hidden; /* Чтобы фотка не вылезала за скругленные края контейнера */
}

/* Делаем идеальный квадрат на экранах телефонов и планшетов */
@media (max-width: 1050px) {
    .product-card .prod-img {
        width: 100%;
        height: auto !important; /* Убиваем старую фиксированную высоту 150px */
        aspect-ratio: 1 / 1; /* Магия CSS: ширина равна высоте */
    }
}

/* Заголовок "Описание:" в списке */
.desc-header {
    font-size: 13px; /* Тот же размер, что и у текста */
    font-weight: 600; /* Аккуратный полужирный вместо "жирного" 800 */
    color: var(--text-muted); /* Мягкий цвет, сливающийся с дизайном */
    margin-top: 12px;
    margin-bottom: 4px;
    /* Мы убрали uppercase и letter-spacing, чтобы текст выглядел естественно */
}

/* Основной текст описания в списке */
.card-list-desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 6; /* На ПК даем больше места */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

/* Адаптив для мобилок */
@media (max-width: 1050px) {
    .card-list-desc {
        -webkit-line-clamp: 3; /* Сжимаем, чтобы не занимать весь экран */
    }
    .desc-header {
        margin-top: 8px;
    }
}

/* Делаем страницу товара адаптивной сеткой */
.product-page-layout {
    display: grid !important;
    grid-template-columns: 450px 1fr;
    gap: 30px 40px;
    margin-bottom: 40px; /* Уменьшили общий отступ снизу */
}

/* Описание занимает обе колонки */
.product-description-full {
    grid-column: 1 / -1;
}

.desc-heading {
    font-size: 22px;
    margin-bottom: 12px; /* Уменьшенный зазор после заголовка */
    color: var(--text-main);
}

/* Стилизация пузыря описания */
.desc-bubble {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    line-height: 1.6;
    /* Легкий оттенок для выделения */
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .desc-bubble {
    background: rgba(255, 255, 255, 0.03); /* В темной теме чуть светлее фона */
}

.product-desc {
    margin: 0 !important; /* Убираем лишние отступы внутри пузыря */
    padding: 0 !important;
}

/* Адаптив для мобилок */
@media (max-width: 850px) {
    .product-page-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    .product-gallery {
        max-width: 100% !important;
    }
}

/* Убираем лишнее место, если аксессуаров нет */
#accessories-grid:empty + .section-header,
#accessories-grid[style*="display: none"] {
    margin-top: 0 !important;
    padding-top: 0 !important;
}