:root {
    --primary: #3498db;
    --secondary: #27ae60;
    --danger: #e74c3c;
    --bg: #f4f7f9;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #888;
    --border: #ddd;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Автоматическая темная тема */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --card-bg: #2d2d2d;
        --text: #f4f7f9;
        --text-muted: #aaa;
        --border: #444;
        --shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
}

html { 
    scroll-behavior: smooth; 
    overscroll-behavior-y: none; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 20px; 
    overflow-x: hidden; 
    transition: background-color 0.3s, color 0.3s;
}

.container { 
    max-width: 900px; 
    margin: 0 auto; 
}

.banner-container {
    width: 100%;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.banner-img {
    width: 100%;
    height: auto;
    display: block;
}

h1 { text-align: center; margin-bottom: 30px; }

/* ПОИСК (Липкий) */
.search-container { margin-bottom: 20px; position: sticky; top: 10px; z-index: 100; }
.search-container input {
    width: 100%; padding: 15px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text); box-shadow: var(--shadow); font-size: 16px;
    box-sizing: border-box;
}

/* КАТЕГОРИИ - С ПЕРЕНОСОМ */
.categories-container {
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    padding-bottom: 15px; 
    margin-bottom: 20px;
}

.tag {
    padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text); cursor: pointer;
    white-space: nowrap; font-size: 14px; transition: 0.2s;
}
.tag.active { background: var(--primary); color: white; border-color: var(--primary); }

/* СЕТКА ТОВАРОВ */
.products-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 40px;
}

/* --- ИСПРАВЛЕННАЯ КАРТОЧКА ТОВАРА --- */
.product-card {
    background: var(--card-bg); 
    padding: 15px; 
    border-radius: var(--radius);
    box-shadow: var(--shadow); 
    text-align: center; 
    display: flex; 
    flex-direction: column;
    /* Убрали глобальный ховер-эффект из базового стиля */
    transition: transform 0.2s, box-shadow 0.2s; 
}

/* Эффект наведения ТОЛЬКО для устройств с мышкой (ПК) */
@media (hover: hover) {
    .product-card:hover { 
        transform: translateY(-5px); 
        box-shadow: 0 10px 20px rgba(0,0,0,0.15); 
    }
}

/* Эффект нажатия для мобильных (касание пальцем) */
.product-card:active {
    transform: scale(0.98); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
/* ------------------------------------ */

.product-img {
    width: 100%; height: 160px; object-fit: contain; border-radius: 8px;
    margin-bottom: 12px; background: #fff; cursor: pointer;
}
.product-title { font-weight: 600; margin-bottom: 15px; flex-grow: 1; font-size: 0.95em; }

/* КНОПКИ */
.btn {
    padding: 10px 15px; border: none; border-radius: 8px; cursor: pointer;
    font-weight: 600; transition: 0.2s; font-size: 14px;
}
.btn-add { background: var(--primary); color: white; width: 100%; }
.btn-add:active { transform: scale(0.95); }
.btn-clear { background: var(--danger); color: white; }
.btn-order { background: var(--secondary); color: white; width: 100%; padding: 15px; font-size: 16px; margin-top: 10px; }

/* ПЛАШКА ОСТАТКА */
.stock-badge {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
    align-self: center; /* Центрируем в карточке */
    letter-spacing: 0.5px;
}

.stock-ok {
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #c8e6c9;
}

.stock-zero {
    background: #fff3e0;
    color: #e67e22;
    border: 1px solid #ffe0b2;
}

/* КОРЗИНА */
.cart-section {
    background: var(--card-bg); padding: 25px; border-radius: var(--radius);
    box-shadow: var(--shadow); margin-bottom: 50px;
}
.cart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.cart-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--border);
}
.cart-item-info { flex: 1; margin-right: 15px; }
.cart-controls { display: flex; align-items: center; gap: 12px; }
.cart-controls button {
    width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border);
    background: var(--card-bg); color: var(--text); cursor: pointer;
}
.cart-qty-num { font-weight: bold; min-width: 20px; text-align: center; }

/* ФОРМА */
.order-form { display: none; flex-direction: column; gap: 15px; margin-top: 30px; }
.form-group { display: flex; flex-direction: column; gap: 5px; position: relative; }
.form-group label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea {
    padding: 12px; border: 1px solid var(--border); background: var(--card-bg);
    color: var(--text); border-radius: 8px; font-size: 16px; box-sizing: border-box;
}

/* ПРОКРУТКА ДЛИННОГО АДРЕСА НА МОБИЛЬНОМ */
.scrollable-input {
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important; 
}

/* КОММЕНТАРИЙ - ТОЛЬКО ВЕРТИКАЛЬНОЕ РАСТЯГИВАНИЕ */
#comment {
    resize: vertical;
    min-height: 60px;
}

/* МОДАЛЬНОЕ ОКНО (МОБИЛЬНОЕ) */
.modal-overlay {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: rgba(0, 0, 0, 0.9); 
    z-index: 5000; 
    /* Центрируем содержимое */
    justify-content: center; 
    align-items: center; 
    padding: 10px;
    box-sizing: border-box;
}

.modal-container {
    position: relative; 
    width: auto; 
    max-width: 100%; 
    max-height: 90vh;
    display: flex; 
    flex-direction: column;
    justify-content: center; 
    align-items: center;
}

#modal-img-tag { 
    max-width: 100%; 
    max-height: 80vh; 
    border-radius: 8px; 
    object-fit: contain; 
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Кнопка закрытия */
.close-modal { 
    position: absolute; 
    top: -45px; 
    right: 5px; 
    color: white; 
    font-size: 40px; 
    cursor: pointer;
    line-height: 1;
    padding: 10px; 
}

@media (max-width: 480px) {
    .close-modal {
        top: -40px;
        right: 0;
        font-size: 35px;
    }
}

/* АДАПТАЦИЯ */
.mobile-badge { 
    position: fixed; 
    bottom: 25px; 
    right: 25px; 
    
    /* ИЗМЕНЕНИЕ 1: Яркий цвет фона вместо синего */
    background: #ff6b6b; /* Или можно написать 'orange', 'red' */
    
    color: white; 
    width: 65px;  /* Чуть крупнее */
    height: 65px; 
    border-radius: 50%; 
    display: none; 
    justify-content: center; 
    align-items: center; 
    z-index: 1000; 
    
    /* ИЗМЕНЕНИЕ 2: Крупный шрифт и жирная тень для заметности */
    font-size: 24px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border: 2px solid white; /* Белая обводка для контраста */
    cursor: pointer;
    transition: transform 0.2s;
}

.mobile-badge:active {
    transform: scale(0.9);
}

@media (max-width: 600px) {
    .products-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .product-img { height: 120px; }
}

.notification { position: fixed; top: 20px; right: 20px; padding: 15px; border-radius: 8px; color: white; display: none; z-index: 4000; }
.success { background: var(--secondary); } 
.error { background: var(--danger); }

.hints-container {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 8px; z-index: 5000;
    max-height: 250px; overflow-y: auto; box-shadow: var(--shadow);
    display: none; margin-top: 4px;
}
.hint-item { padding: 12px 15px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 14px; }
.hint-item:hover { background: var(--bg); color: var(--primary); }

