/* --- 1. ШРИФТЫ И СБРОС --- */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@700&family=Montserrat:wght@400;600;700;800&display=swap');

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

/* Всегда показывать полосу прокрутки, чтобы контент не прыгал влево-вправо */
html { 
    overflow-y: scroll; 
}

:root {
    --primary: #6c5ce7;
    --accent: #fdcb6e;
    --text-dark: #2d3436;
    --text-light: #636e72;
    --bg-light: #f8f9fa;
    --white: #ffffff;
    --radius: 16px;
    --shadow: 0 8px 25px rgba(0,0,0,0.05);
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
    background-attachment: fixed;
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { 
    text-decoration: none !important; 
    color: inherit; 
    transition: 0.3s; 
}

ul, li { 
    list-style: none !important; 
    margin: 0; 
    padding: 0; 
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* --- 2. ШАПКА (HEADER) --- */
.header {
    background: var(--white);
    padding: 0 !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 70px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    height: 70px;
    gap: 15px; 
}

/* 3 колонки: Лого, Поиск, Контакты */
.header-left { flex: 1; display: flex; align-items: center; }
.header-center { flex: 2; display: flex; justify-content: center; align-items: center; }
.header-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 20px; }

.logo {
    font-family: 'Comfortaa', cursive !important;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.logo span { color: var(--accent); }

/* Поиск */
.search-bar {
    width: 100%;
    max-width: 450px;
    position: relative;
    display: flex;
}

.search-bar input {
    width: 100%;
    height: 40px;
    padding: 0 40px 0 20px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    background: #f8f9fa;
    transition: 0.3s;
}

.search-bar input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-phone { font-weight: 700; font-size: 16px; color: var(--text-dark); white-space: nowrap; }
.burger-menu { display: none; font-size: 24px; cursor: pointer; color: var(--text-dark); margin-left: 15px; }

/* --- 3. МЕНЮ (NAV) --- */
.main-nav {
    background: var(--white);
    border-bottom: 1px solid #eee;
    height: 50px;
    display: flex;
    align-items: center;
}
.main-nav ul { display: flex; justify-content: center; gap: 30px; width: 100%; }
.main-nav a { font-weight: 700; font-size: 13px; text-transform: uppercase; color: var(--text-light); position: relative; padding: 5px 0;}
.main-nav a:hover, .main-nav a.active { color: var(--primary); }
.main-nav a.active::after { content: ''; position: absolute; bottom: -12px; left: 0; width: 100%; height: 3px; background: var(--primary); }

/* --- 4. КАТАЛОГ И КАТЕГОРИИ --- */
.content-wrapper { padding: 40px 0; }
.page-title { font-size: 28px; font-weight: 800; margin-bottom: 20px; }

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.category-card {
    position: relative; height: 240px; border-radius: var(--radius);
    overflow: hidden; cursor: pointer; box-shadow: var(--shadow); background: #fff;
}
.category-card img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.category-card:hover img { transform: scale(1.05); }
.category-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 15px; color: white; text-align: center;
}
.category-overlay h2 { font-family: 'Comfortaa', cursive; font-size: 16px; margin: 0; }

/* Подкатегории (кнопки) */
.subcats-container { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 25px; width: 100%; }
.subcat-btn {
    background: #ffffff; border: 2px solid #e0e0e0; color: var(--text-light);
    padding: 8px 18px; border-radius: 20px; font-size: 13px; font-weight: 700; transition: 0.3s;
}
.subcat-btn:hover { border-color: var(--primary); color: var(--primary); }
.subcat-btn.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }

/* ТОВАРЫ */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 30px; width: 100%; }
.product-card {
    background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(5px);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    display: flex; flex-direction: column; height: 100%; border: 1px solid #f0f0f0; transition: 0.3s;
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 12px 30px rgba(0,0,0,0.1); }
.product-img { height: 240px; width: 100%; flex-shrink: 0; background-color: #f1f2f6; overflow: hidden; }
.product-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.product-card:hover .product-img img { transform: scale(1.05); }

/* Кнопка В корзину (Hover эффект) */
.add-to-cart-btn { transition: 0.3s; }
.add-to-cart-btn:hover { background: #5649c0 !important; transform: translateY(-2px); }

/* --- 5. КОРЗИНА И МОДАЛЬНОЕ ОКНО --- */
.cart-icon { transition: 0.3s; }
.cart-icon:hover { transform: scale(1.1); }
.cart-badge { border: 2px solid white; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 3000; overflow-y: auto; }
.modal-content { background: white; margin: 5% auto; padding: 30px; width: 90%; max-width: 500px; border-radius: 20px; position: relative; box-shadow: 0 15px 40px rgba(0,0,0,0.2); }
.close-modal { position: absolute; top: 15px; right: 20px; font-size: 28px; cursor: pointer; color: #999; transition: 0.3s; }
.close-modal:hover { color: #d63031; }

/* --- 6. ДОСТАВКА И КОНТАКТЫ --- */
.delivery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.info-card { background: white; padding: 30px; border-radius: var(--radius); box-shadow: var(--shadow); }
.alert-box { margin-top: 30px; background: #fff8e1; color: #d35400; padding: 20px; border-radius: var(--radius); border-left: 5px solid #fdcb6e; display: flex; gap: 15px; align-items: center; }

.contacts-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; }
.contact-item { display: flex; gap: 20px; margin-bottom: 30px; }
.contact-icon { width: 50px; height: 50px; background: #eee; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 20px; flex-shrink: 0; }
.contact-form { background: white; padding: 40px; border-radius: var(--radius); box-shadow: var(--shadow); }
.form-group { margin-bottom: 15px; position: relative; }
.form-group input, .form-group textarea { width: 100%; padding: 15px; border: 1px solid #ddd; border-radius: 10px; font-family: inherit; background: #f9f9f9; transition: 0.3s; }
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1); }
.btn-submit { width: 100%; background: var(--primary); color: white; border: none; padding: 15px; border-radius: 10px; font-weight: 700; transition: 0.3s; cursor: pointer; }
.btn-submit:hover { background: #5649c0; transform: translateY(-2px); }

/* --- 7. FOOTER --- */
.footer { background: #2d3436; color: #dfe6e9; padding: 50px 0 20px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 30px; }
.footer h4 { color: white; margin-bottom: 15px; }
.footer a { display: block; margin-bottom: 8px; color: #b2bec3; font-size: 14px; transition: 0.3s; }
.footer a:hover { color: var(--accent); }
.copyright { text-align: center; border-top: 1px solid #444; padding-top: 20px; font-size: 12px; color: #777; }

/* --- 8. АДАПТИВНОСТЬ (МОБИЛЬНАЯ ВЕРСИЯ) --- */
@media (max-width: 992px) {
    .header-center { display: none !important; } /* Прячем поиск в шапке */
    .header-phone { display: none; } /* Прячем номер текстом */
    .burger-menu { display: block !important; }

    /* Выпадающее меню */
    .main-nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: white;
        z-index: 9999;
        height: auto;
        box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    }
    .main-nav.active { display: block !important; }
    .main-nav ul { flex-direction: column; }
    .main-nav ul li { border-bottom: 1px solid #f0f0f0; width: 100%; text-align: center; }
    .main-nav a { display: block; padding: 15px; }
    .main-nav a.active::after { display: none; }

    .contacts-layout { grid-template-columns: 1fr; }
    .contact-form { padding: 25px; }
}

@media (max-width: 768px) {
    .category-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .category-card { height: 180px; }
    
    .product-grid { grid-template-columns: 1fr 1fr !important; gap: 12px; }
    .product-img { height: 160px; }
    
    .subcats-container { gap: 8px; }
    .subcat-btn { padding: 6px 14px; font-size: 12px; }
}