:root {
    --bg: #f4f7f9; /* Светлый фон */
    --card: #ffffff; /* Белые карточки */
    --accent: #00a8ff; /* Оставляем синий для акцентов */
    --text: #333333; /* Темный текст для читаемости */
    --muted: #666666; /* Серый для второстепенного текста */
    --border: #dddddd; /* Светлые границы */
    --success: #28a745; /* Зеленый для цены */
}

/* 1. Делаем body гибким контейнером на всю высоту экрана */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Минимальная высота - 100% видимого экрана */
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', sans-serif;
}

header {
    background: rgba(21, 25, 29, 0.95);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 1000;
}

.logo { font-size: 1.5rem; font-weight: bold; color: var(--accent); text-decoration: none; }
.back-link { color: var(--muted); text-decoration: none; }


.main-container {
    flex: 1 0 auto; /* Растягивается, но не сжимается меньше контента */
    display: flex;
    flex-direction: column;
}


.container {
    flex: 1; 
    display: flex;
    padding: 30px 5%;
    gap: 30px;
}

/* Сайдбар */
.sidebar { width: 250px; background: var(--card); padding: 20px; border-radius: 12px; height: fit-content; border: 1px solid var(--border); }
.sidebar h3 { color: var(--muted); text-transform: uppercase; font-size: 0.85rem; }
.sidebar ul { list-style: none; padding: 0; }
.sidebar li { margin-bottom: 10px; }
.sidebar a { text-decoration: none; color: var(--text); display: block; padding: 10px; border-radius: 6px; transition: 0.2s; }
.sidebar a:hover { background: #2d333b; color: var(--accent); }

/* Сетка */
.main-content { flex: 1; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

.product-card {
    background: var(--card);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: 0.3s;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-5px); }

/* Контейнер медиа (для сетки) */
.media-container {                
    position: relative; 
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
}
.media-container video, .media-container img {
    width: 100%; height: 100%; object-fit: cover;
}

/* Видео внутри контейнера сетки */
.media-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

/* Водяной знак (CSS-наложение) */
.watermark {
    position: absolute;                
    top: 0;                
    left: 0;                
    width: 100%; /* Занять всю ширину контейнера */
    height: 100%; /* Занять всю высоту контейнера */
    opacity: 0.2
; /* Прозрачность */
    pointer-events: none; /* Кликабельность сквозь знак */
    z-index: 10; /* ВАЖНО: Знак выше фото/видео */
    filter: invert(1);                
    object-fit: cover; /* Чтобы знак закрывал все поле */
}


.product-info h3 { margin: 0 0 10px 0; font-size: 1.1rem; }
.price { font-weight: bold; color: var(--success); margin-bottom: 10px; }
.buy-btn {
    background: var(--accent);
    color: #fff;
    padding: 10px;
    text-decoration: none;
    display: block;
    text-align: center;
    border-radius: 6px;
    font-weight: bold;
}

/* Детальная страница */
.detail-wrapper { width: 100%; }
.detail-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    background: var(--card);
    padding: 30px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

/* Контейнер для детального просмотра */
.media-container-detail { 
    position: relative; /* Оставляем relative для абсолютного позиционирования знака */
    background: #000; 
    border-radius: 8px; 
    overflow: hidden; 
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    max-height: 80vh; 
}

/* Стилизация изображения в деталях */
.media-container-detail img {                
    max-width: 100%;                
    max-height: 100%;                
    width: auto;                
    height: auto;                
    display: block;                
    object-fit: contain;
    z-index: 1; /* Основное фото */
}

/* --- ИСПРАВЛЕННОЕ ПОЗИЦИОНИРОВАНИЕ --- */
.media-container-detail .watermark {
    position: absolute;                
    top:0%;        /* Центрирование по вертикали */
    left: 0%;       /* Центрирование по горизонтали */
    transform: translate(0%, 0%); /* Сдвиг на половину ширины/высоты */
    width:100%;      /* Размер относительно контейнера */
    opacity: 0.2;   /* Прозрачность */
    pointer-events: none; /* Кликабельность сквозь знак */
    z-index: 20;     /* ВАЖНО: Знак выше фото */
    filter: invert(1);                
}

/* static/style.css */
.audio-container {                
    width: 100%;                
    height: 100%;                
    background-size: cover;                
    background-position: center;                
    position: relative;                
    display: flex;                
    justify-content: center;                
    align-items: center;                
    cursor: pointer;
    background-color: #333; /* Фон, если нет обложки */
}                

.play-icon {                
    font-size: 3rem;                
    color: white;                
    background: rgba(0,0,0,0.5);                
    padding: 20px;                
    border-radius: 50%;                
    opacity: 0.8;
    transition: opacity 0.3s;
}

.audio-container:hover .play-icon {
    opacity: 1;
}


.cart-wrapper { width: 100%; }

.cart-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    margin-top: 20px;
}

.cart-item {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.item-info h3 { margin: 0 0 5px 0; }
.item-price { color: var(--success); font-weight: bold; margin: 0; }

.remove-btn { color: #ff4757; text-decoration: none; font-size: 1.2rem; }

.cart-summary {
    background: var(--card);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
    height: fit-content;
}

.total-price {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin: 20px 0;
}

.checkout-form input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box; /* Важно для padding */
}

.checkout-btn {
    width: 100%;
    background: var(--success);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.empty-cart { text-align: center; padding: 50px; }


.agreement-checkbox {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.agreement-checkbox input {
    margin-top: 3px; /* Выравнивание чекбокса по тексту */
    cursor: pointer;
}

.agreement-checkbox a {
    color: var(--accent);
    text-decoration: none;
}

.agreement-checkbox a:hover {
    text-decoration: underline;
}


.card-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.detail-btn {                
    background: var(--muted);
    color: white;
    text-decoration: none;
    padding: 10px;
    border-radius: 6px;
    flex: 1;
    text-align: center;
}

footer {
    flex-shrink: 0; /* Запрещаем футеру сжиматься */
    background: #1a1d21;
    color: white;
    padding: 40px 5% 20px;
    margin-top: auto; /* Дополнительная страховка */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-links a {
    color: #00a8ff;
    text-decoration: none;
    margin-left: 20px;
}


/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */
@media (max-width: 768px) {
    /* 1. Общая структура */
    .container {
        flex-direction: column;
        padding: 10px;
        gap: 15px;
    }

    /* 2. Сайдбар (Категории) - Горизонтальный скролл */
    .sidebar {
        width: 100%;
        padding: 10px;
        margin-bottom: 10px;
        background: transparent;
        border: none;
    }

    .sidebar h3 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .sidebar ul {
        display: flex;
        flex-direction: row; /* В линию */
        overflow-x: auto; /* Скролл по горизонтали */
        white-space: nowrap; /* Не переносить текст */
        gap: 8px;
        padding-bottom: 5px; /* Для скроллбара */
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
        scrollbar-width: none; /* Скрыть скроллбар в Firefox */
    }

    /* Скрыть скроллбар в Chrome/Safari/Edge */
    .sidebar ul::-webkit-scrollbar {
        display: none;
    }

    .sidebar ul li {
        list-style: none;
        background: #f4f4f4; /* Светлый фон для кнопок */
        border: 1px solid #ddd;
        border-radius: 15px;
        padding: 6px 12px;
        flex-shrink: 0; /* Не сжимать кнопки */
    }

    .sidebar ul li a {
        text-decoration: none;
        color: #333;
        font-size: 0.85rem;
        display: block;
    }

    /* 3. Сетка товаров - 2 колонки */
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* 4. Карточки товаров - Уменьшение шрифтов */
    .product-card h3 {
        font-size: 0.85rem;
        margin: 5px 0;
    }
    
    .price {
        font-size: 0.95rem;
        font-weight: bold;
    }
    
    .card-buttons {
        flex-direction: column;
        gap: 5px;
    }
    
    .detail-btn, .buy-btn {
        padding: 8px;
        font-size: 0.8rem;


/* ------------------------------------- */
