/* =========================
   СБРОС И БАЗОВЫЕ СТИЛИ
========================= */
* { 
    box-sizing: border-box; 
}

body {
    margin: 0;
    font-family: Roboto, sans-serif;
    background: #f3f4f6;
}

/* =========================
   ПЕРЕМЕННЫЕ
========================= */
:root {
    --header-height: 50px;
    --primary-color: #7b2cff;
    --primary-hover: #6823d9;
    --success-color: #01a51f;
    --danger-color: #ea5050;
    --text-dark: #111;
    --text-light: #666;
}

/* =========================
   ФИКСИРОВАННАЯ ШАПКА С ПОИСКОМ
========================= */
.search-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    z-index: 1000;
    box-sizing: border-box;
}

.search-header .search-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    position: relative;
    gap: 8px;              /* Добавляем отступ между поиском и корзиной */
}
.search-header .search-input {
    width: 100%;
    height: 44px;
    padding: 0 80px 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.search-header .search-input:focus {
    border-color: var(--primary-color);
}

.search-header .search-input::placeholder {
    color: rgba(131, 17, 245, 0.7);
    font-weight: bold;
    font-size: 17px;
}

.search-header .clear-btn {
    position: absolute;
    right: 85px;           /* или ваше текущее значение */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;        /* уменьшили с 20px до 18px */
    font-weight: 700;       /* добавляем жирность (700 = bold) */
    color: var(--primary-color);  /* меняем с #999 на фиолетовый */
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    transition: color 0.2s, background 0.2s;  /* добавили background в transition */
    z-index: 10;
    border-radius: 50%;
    aspect-ratio: 1;
}

.search-header .clear-btn:hover {
    color: var(--primary-hover);  /* более темный фиолетовый при наведении */
    background: rgba(123, 44, 255, 0.1);  /* полупрозрачный фиолетовый фон */
}

/* Кнопка корзины в шапке */
.cart-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: bold;
    transition: background 0.2s;
    margin-left: 8px;
}

.cart-btn:hover {
    background-color: var(--primary-hover);
}

#cartCount {
    background-color: #ff3b30;
    color: #fff;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
}

/* Отступ для контента */
body {
    padding-top: var(--header-height);
}

/* Скрываем старую шапку */
.header {
    display: none;
}

/* =========================
   СЕТКА ТОВАРОВ
========================= */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    column-gap: 2px;
    row-gap: 15px;
    padding: 0;
}

.product-card {
    display: flex;
    flex-direction: column;
}

.product-image {
    width: 100%;
    height: 250px;
    background: #fff;
    border-radius: 17px;
    overflow: hidden;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 6px 4px 2px;
}

.product-card button {
    display: block;
    width: calc(100% - 14px);
    margin: 6px auto 0;
    padding: 13px;
    border-radius: 16px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}

.product-card button:hover {
    background: var(--primary-hover);
}

/* =========================
   СТИЛИ ДЛЯ ЦЕН И СКИДОК
========================= */
.price-container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0;
    padding-left: 8px;
    padding-right: 8px;
}

.new-price {
    font-size: 18px;
    font-weight: 900;
    color: var(--success-color);
    order: 1;
}

.old-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    font-weight: normal;
    order: 2;
}

.discount-badge {
    display: inline-block;
    background: var(--danger-color);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    order: 3;
}

.regular-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--success-color);
}

/* =========================
   СТРАНИЦА КОРЗИНЫ
========================= */
.cart-page {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-link {
    color: var(--primary-color);
    text-decoration: none;
}

.cart-item {
    display: flex;
    gap: 12px;
    background: white;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.cart-item-image-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

 .item-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    z-index: 10;
    cursor: pointer;
    accent-color: #7b2cff;
    border-radius: 50%;        /* полностью круглая */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item-checkbox:hover {
    transform: scale(1.2);
    filter: brightness(1.1);
}.item-checkbox

.item-checkbox:checked {
    filter: drop-shadow(0 2px 4px rgba(123, 44, 255, 0.4));
}

.cart-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.cart-item.zero-qty .cart-item-image {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.cart-item-price {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.cart-item-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.cart-item-controls button {
    padding: 4px 10px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 6px;
    cursor: pointer;
}

.cart-item-controls .remove-btn {
    background: #ffe5e5;
    border-color: #ffa5a5;
    color: #d00;
}

.cart-summary {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin: 8px 0;
}

.summary-row.total {
    font-size: 18px;
    font-weight: bold;
    border-top: 1px solid #eee;
    padding-top: 8px;
    margin-top: 8px;
}

.checkout-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    transition: background 0.2s;
}

.checkout-btn:hover {
    background: var(--primary-hover);
}

.checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.empty-cart {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 12px;
    color: var(--text-light);
}

.order-form {
    margin-top: 20px;
    background: white;
    padding: 16px;
    border-radius: 12px;
}

.order-form input,
.order-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

.order-form label {
    font-weight: 500;
    display: block;
    margin-bottom: 4px;
}

/* =========================
   УВЕДОМЛЕНИЯ
========================= */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* =========================
   FOOTER
========================= */
.footer {
    text-align: center;
    padding: 14px;
    font-size: 12px;
    color: #9ca3af;
}

/* =========================
   PREMIUM INSTALL (PWA)
========================= */
.install-overlay {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    margin: 0 auto;
    z-index: 10000;
    display: block;
    animation: slideUp 0.3s ease;
}

.install-overlay.hidden {
    display: none;
}

.install-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 20px;
    width: 100%;
}

.install-header {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 12px;
}

.install-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
}

.install-title {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-dark);
}

.install-subtitle {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.install-description {
    font-size: 14px;
    color: #444;
    line-height: 1.5;
    margin: 12px 0 16px;
    padding: 8px 0;
    text-align: left;
}

.install-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.install-primary {
    flex: 2;
    padding: 14px 16px;
    border-radius: 14px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.install-primary:hover {
    background: var(--primary-hover);
}

.install-secondary {
    flex: 1;
    padding: 14px 16px;
    border-radius: 14px;
    border: none;
    background: #f0f0f0;
    color: #333;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.install-secondary:hover {
    background: #e4e4e4;
}

/* =========================
   МЕДИА-ЗАПРОСЫ
========================= */
@media (max-width: 480px) {
    .install-overlay {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
    
    .install-actions {
        flex-direction: column;
    }
    
    .install-primary,
    .install-secondary {
        width: 100%;
    }
}

@media (prefers-color-scheme: dark) {
    .install-card {
        background: #1a1a1a;
        color: white;
    }
    
    .install-title {
        color: white;
    }
    
    .install-subtitle {
        color: #aaa;
    }
    
    .install-description {
        color: #ccc;
    }
    
    .install-secondary {
        background: #333;
        color: white;
    }
    
    .install-secondary:hover {
        background: #444;
    }
}
 
/* Стили для подсветки */
mark {
    background-color: #ffeb3b;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Стили для активной категории */
.category-filter.active {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}


/* Стили для пустого состояния */
.search-empty {
    font-size: 1.2rem;
    padding: 40px !important;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Для скринридеров */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}