/* Светло-розовая тема для каталога Nataly Cake */

:root {
    --primary-pink: #f8d7da;
    --secondary-pink: #fce4e6;
    --accent-pink: #e91e63;
    --dark-pink: #c2185b;
    --light-pink: #fdf2f2;
    --white: #ffffff;
    --text-dark: #2d2d2d;
    --text-gray: #666;
    --border-light: #f0f0f0;
    --shadow: 0 4px 18px rgba(233, 30, 99, 0.18);
    --shadow-hover: 0 8px 26px rgba(233, 30, 99, 0.28);
    /* Более заметная розовая тень снизу для карточек */
    --card-shadow-bottom: 0 14px 28px -12px rgba(233, 30, 99, 0.45);
    --card-shadow-bottom-hover: 0 20px 36px -14px rgba(233, 30, 99, 0.55);
    --transition-base: 0.2s ease;
    --transition-quick: 0.15s ease;
    --transition-slow: 0.35s ease;
}

body.dark-theme {
    --primary-pink: #2d0b2d;
    --secondary-pink: #341236;
    --accent-pink: #ff7aa5;
    --dark-pink: #ff93bc;
    --light-pink: #1d0a1f;
    --white: #120713;
    --text-dark: #f7ecf5;
    --text-gray: #d6bfd1;
    --border-light: rgba(255, 255, 255, 0.12);
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.65);
    --card-shadow-bottom: 0 20px 45px -20px rgba(255, 154, 190, 0.55);
    --card-shadow-bottom-hover: 0 30px 60px -20px rgba(255, 154, 190, 0.7);
}

body.dark-theme {
    background: radial-gradient(circle at top, #2a0d29 0%, #140510 50%, #090208 100%);
    color: var(--text-dark);
}

body {
    margin: 0;
    font-family: 'Montserrat', 'Segoe UI', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(-45deg, #fff0f6, #ffd6e7, #ffcce5, #ffe3ee);
    background-size: 400% 400%;
    animation: gradientFlow 18s ease infinite;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: 1rem;
    /* мягче общий контейнер */
    overflow: hidden;
}

body.dark-theme .container {
    background: rgba(20, 8, 24, 0.92);
    box-shadow: var(--shadow);
}

/* Заголовок */
.header {
    /* Фоновое изображение с нежным градиентом-оверлеем для читабельности текста */
    background-image:
        linear-gradient(135deg, rgba(233, 30, 99, 0.55) 0%, rgba(194, 24, 91, 0.55) 100%),
        url('/static/images/header-bg.jpg');
    background-size: cover, cover;
    background-position: center 30%, center;
    background-repeat: no-repeat;
    color: var(--white);
    padding: 1rem 0.8rem;
    /* минус ~30% высоты */
    text-align: center;
    border-radius: 0 0 1.4rem 1.4rem;
}

body.dark-theme .header {
    background-image:
        linear-gradient(135deg, rgba(255, 122, 165, 0.68) 0%, rgba(255, 147, 188, 0.65) 100%),
        url('/static/images/header-bg.jpg');
    color: var(--text-dark);
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, 0.12);
}

.header-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 0.75rem;
}

.logo {
    font-family: 'Great Vibes', cursive;
    /* рукописный стиль */
    font-size: 1.6rem;
    /* чуть крупнее, чтобы читалось в меньшей шапке */
    font-weight: 400;
    margin-bottom: 0.1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.2px;
    grid-column: 1 / 2;
    justify-self: center;
}

.subtitle {
    font-size: 0.8rem;
    /* чуть меньше */
    opacity: 0.9;
    font-weight: 300;
}

body.dark-theme .subtitle {
    color: rgba(255, 255, 255, 0.82);
}

.home-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.9rem;
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 6px 18px rgba(233, 30, 99, 0.25);
    backdrop-filter: saturate(160%) blur(4px);
}

.home-link:hover {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

/* В Telegram Mini App (tma=1) скрываем ссылку "На главную" через атрибут на body */
body[data-tma="1"] .home-link {
    display: none !important;
}

.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    grid-column: 2 / 3;
}

.header-actions .home-link,
.header-actions .cart-button {
    width: 100%;
}

.cart-button--header {
    justify-content: center;
    font-size: 0.9rem;
}

@media (max-width: 480px) {
    .home-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }

    .header-top {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .header-actions {
        width: 100%;
        align-items: stretch;
    }

    .header-actions .home-link,
    .header-actions .cart-button {
        justify-content: center;
    }
}

/* Каталог */
.catalog {
    padding: 1.5rem 1rem;
}

.catalog-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 0.9rem;
    background: var(--light-pink);
    box-shadow: 0 8px 24px rgba(233, 30, 99, 0.08);
    transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
}

body.dark-theme .catalog-controls {
    background: rgba(41, 16, 45, 0.85);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.catalog-controls .controls-left,
.catalog-controls .controls-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cart-button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 1.1rem;
    border-radius: 999px;
    border: 1.5px solid rgba(233, 30, 99, 0.4);
    background: var(--white);
    color: var(--accent-pink);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
    box-shadow: 0 8px 20px rgba(233, 30, 99, 0.18);
}

.cart-button--empty {
    opacity: 0.8;
}

.cart-button:hover,
.cart-button:focus {
    transform: translateY(-1px);
    border-color: var(--accent-pink);
    box-shadow: 0 10px 24px rgba(233, 30, 99, 0.26);
}

body.dark-theme .cart-button {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--accent-pink);
}

body.dark-theme .cart-button:hover,
body.dark-theme .cart-button:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

body[data-tma="1"] .cart-button {
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
    box-shadow: 0 10px 20px rgba(233, 30, 99, 0.15);
}

body[data-tma="1"] #cartCount {
    font-size: 0.85rem;
}

.sort-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-gray);
}

.sort-select {
    appearance: none;
    padding: 0.45rem 2.1rem 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%23e91e63' d='M1.41 0L6 4.58 10.59 0 12 1.41 6 7.41 0 1.41z'/%3E%3C/svg%3E") no-repeat right 0.75rem center/12px;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
}

.theme-toggle,
.wishlist-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #fff;
    color: var(--accent-pink);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(233, 30, 99, 0.15);
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

body.dark-theme .theme-toggle,
body.dark-theme .wishlist-toggle {
    background: rgba(255, 255, 255, 0.04);
    color: var(--accent-pink);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.08);
}

.theme-toggle:focus-visible,
.wishlist-toggle:focus-visible {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.18);
}

.theme-toggle:hover,
.wishlist-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(233, 30, 99, 0.25);
}

.wishlist-toggle[aria-pressed="true"],
.wishlist-toggle.active {
    background: var(--accent-pink);
    color: #fff;
}

.wishlist-count {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-gray);
}

.wishlist-toggle[aria-pressed="true"] .wishlist-count,
.wishlist-toggle.active .wishlist-count {
    color: rgba(255, 255, 255, 0.9);
}

.product-card {
    position: relative;
}

.product-card .card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.45rem;
    z-index: 3;
}

.wishlist-btn {
    border: none;
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent-pink);
    font-size: 1.2rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    box-shadow: 0 8px 18px rgba(233, 30, 99, 0.25);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base), color var(--transition-base);
}

body.dark-theme .wishlist-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-pink);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
}

.wishlist-btn:hover {
    transform: translateY(-1px) scale(1.03);
}

.wishlist-btn.active {
    background: var(--accent-pink);
    color: #fff;
    box-shadow: 0 10px 22px rgba(233, 30, 99, 0.35);
}

.share-btn.share-top {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(233, 30, 99, 0.28);
    color: var(--accent-pink);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(233, 30, 99, 0.2);
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

body.dark-theme .share-btn.share-top {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--accent-pink);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.share-btn.share-top:hover {
    background: rgba(233, 30, 99, 0.1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 12px 22px rgba(233, 30, 99, 0.3);
}

.share-btn.share-top:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(233, 30, 99, 0.22);
}

.modal-wishlist-btn {
    border: none;
    background: rgba(233, 30, 99, 0.08);
    color: var(--accent-pink);
    padding: 0.65rem 1.1rem;
    border-radius: 0.9rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(233, 30, 99, 0.15);
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base), color var(--transition-base);
    width: 100%;
}

.modal-wishlist-btn.active {
    background: var(--accent-pink);
    color: #fff;
    box-shadow: 0 12px 28px rgba(233, 30, 99, 0.28);
}

.modal-wishlist-btn:hover {
    transform: translateY(-1px);
}

.zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1500;
}

.zoom-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.zoom-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 1rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);

    .order-confirmation {
        position: fixed;
        inset: 0;
        background: rgba(17, 8, 11, 0.55);
        backdrop-filter: blur(6px);
        display: none;
        align-items: center;
        justify-content: center;
        padding: 1.5rem;
        z-index: 11000;
    }

    .order-confirmation__dialog {
        background: #fff;
        border-radius: 1.5rem;
        padding: 2.25rem 2.5rem;
        position: relative;
        max-width: 28rem;
        box-shadow: 0 22px 40px rgba(41, 17, 24, 0.22);
        text-align: center;
    }

    .order-confirmation__title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
        color: #c2185b;
    }

    .order-confirmation__message {
        font-size: 1rem;
        line-height: 1.55;
        color: #5b3d48;
        margin-bottom: 1.75rem;
    }

    .order-confirmation__ok {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        padding: 0.9rem 2.5rem;
        border-radius: 999px;
        background: linear-gradient(135deg, #f48fb1, #e91e63);
        color: #fff;
        font-weight: 600;
        border: none;
        cursor: pointer;
        box-shadow: 0 10px 22px rgba(233, 30, 99, 0.25);
        transition: transform 0.18s ease, box-shadow 0.18s ease;
    }

    .order-confirmation__ok:hover {
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(233, 30, 99, 0.28);
    }

    .order-confirmation__close {
        position: absolute;
        top: 1.1rem;
        right: 1.1rem;
        background: transparent;
        border: none;
        font-size: 1.5rem;
        line-height: 1;
        color: rgba(51, 31, 38, 0.6);
        cursor: pointer;
        transition: color 0.2s ease;
    }

    .order-confirmation__close:hover {
        color: rgba(51, 31, 38, 0.9);
    }

    .order-confirmation.is-visible {
        display: flex;
    }

    @media (max-width: 520px) {
        .order-confirmation__dialog {
            width: 100%;
            padding: 2rem 1.5rem;
            border-radius: 1.1rem;
        }

        .order-confirmation__title {
            font-size: 1.35rem;
        }

        .order-confirmation__message {
            font-size: 0.95rem;
        }
    }
}

.zoom-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.zoom-close:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.05);
}

@media (max-width: 560px) {
    .catalog-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-controls .controls-left,
    .catalog-controls .controls-right {
        width: 100%;
        justify-content: space-between;
    }

    .sort-select {
        flex: 1;
    }
}

.catalog-heading {
    margin: 0 0 0.75rem 0.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-pink);
    word-break: normal;
    overflow-wrap: anywhere;
    /* позволяет красивый перенос по словам */
    white-space: normal;
}

/* Макет с боковым сайдбаром */
.layout {
    position: relative;
    display: block;
    /* сайдбар фиксированный, грид не нужен */
    /* скрываем любые субпиксельные артефакты уезжающего сайдбара */
    overflow: hidden;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    /* Непрозрачный фон под цвет шапки (без альфа-канала) */
    background: linear-gradient(135deg, #ffe6ee 0%, #ffd6e7 100%);
    border-right: none;
    /* без линии, когда скрыт */
    box-shadow: none;
    /* без тени, когда скрыт */
    border-radius: 0 1rem 1rem 0;
    transform: translateX(-130%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    display: none;
    /* полностью скрываем по умолчанию */
    transition: transform 0.3s ease, opacity 0.25s ease;
    z-index: 10;
    padding: 1rem;
    width: 220px;
    color: #000;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.sidebar.expanded {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    display: block;
    /* показываем при расширении */
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sidebar-title {
    font-weight: 700;
    color: var(--accent-pink);
}

.sidebar-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-link {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    /* Чёрный текст по требованию */
    color: #000;
    text-decoration: none;
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: var(--light-pink);
}

.sidebar-link.active {
    background: rgba(233, 30, 99, 0.08);
    border-color: var(--border-light);
    color: var(--dark-pink);
}

.sidebar-hint {
    color: #000;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Сгруппированные категории с подсписками товаров */
.sidebar-group {
    border-radius: 0.5rem;
    overflow: hidden;
}

.sidebar-group+.sidebar-group {
    margin-top: 0.25rem;
}

.sidebar-link.group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.sidebar-caret {
    margin-left: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.sidebar-sublist {
    list-style: none;
    margin: 0.1rem 0 0.4rem 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.3s ease;
}

.sidebar-group.expanded .sidebar-sublist {
    max-height: 600px;
    /* достаточно для нескольких товаров */
    opacity: 1;
}

.sidebar-sublink {
    display: block;
    padding: 0.4rem 0.75rem 0.4rem 1.5rem;
    text-decoration: none;
    color: #000;
    /* чёрный текст в подсписках */
    border-radius: 0.4rem;
}

.sidebar-sublink:hover {
    background: var(--light-pink);
}

.sidebar-sublink.active {
    background: rgba(233, 30, 99, 0.12);
    color: var(--dark-pink);
}

/* Страховка: любой текст/ссылки внутри сайдбара — чёрные */
.sidebar,
.sidebar * {
    color: inherit;
}

.sidebar a {
    color: #000;
}

.sidebar-handle {
    position: fixed;
    left: 0.25rem;
    top: 0.75rem;
    transform: none;
    z-index: 100;
    background: var(--accent-pink);
    color: #fff;
    border: none;
    border-radius: 9999px;
    /* круглая кнопка */
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.15s ease, background-color 0.2s ease;
}

/* Невидимый страж от субпиксельных артефактов слева на некоторых WebView */
@media (max-width: 9999px) {
    body::before {
        content: '';
        position: fixed;
        left: -2px;
        /* чуть за экран */
        top: 0;
        width: 2px;
        height: 100vh;
        background: var(--white);
        /* сливается с фоном контейнера */
        pointer-events: none;
        z-index: 5;
    }
}

.sidebar-handle::before {
    content: '›';
    display: block;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    transform: translateX(1px);
}

.sidebar-handle:hover {
    box-shadow: 0 6px 18px rgba(233, 30, 99, 0.35);
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--dark-pink) 100%);
}

.sidebar-handle:active {
    transform: scale(0.96);
}

.sidebar-handle:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .layout {
        grid-template-columns: 0 1fr;
    }
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    /* Чтобы карточки были одинаковой высоты в строке */
    align-items: stretch;
}

.product-card {
    background: var(--white);
    border-radius: 0.8rem;
    overflow: hidden;
    /* нежная розовая тень снизу */
    box-shadow: var(--card-shadow-bottom);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    cursor: pointer;
    /* растягиваем содержимое по вертикали для выравнивания футера */
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(233, 30, 99, 0.9);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.25);
    pointer-events: none;
    z-index: 3;
}

.product-video-preload {
    display: none;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-bottom-hover);
}

.product-image {
    /* Показываем фото целиком без обрезки */
    aspect-ratio: 1 / 1;
    min-height: 180px;
    /* фолбэк для старых браузеров */
    overflow: hidden;
    background: #fff;
    /* белый фон для «письма» вокруг фото */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    /* небольшой внутренний отступ, чтобы фото не прилипало к краям */
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* показываем фото полностью */
    transition: transform 0.25s ease;
}

/* Без масштабирования содержимого при hover, чтобы не обрезать края */
.product-card:hover .product-image img {
    transform: none;
}

.no-image {
    font-size: 2.5rem;
    color: var(--accent-pink);
    opacity: 0.6;
}

.product-info {
    padding: 1rem;
    /* чтобы футер опускался вниз */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.3rem;
    line-height: 1.2;
}

/* -------- Desktop: полноформатный каталог в браузере -------- */

/* Увеличиваем высоту превью на более широких экранах */
@media (min-width: 768px) {
    .product-image {
        min-height: 220px;
    }
}

@media (min-width: 1024px) {
    .product-image {
        min-height: 260px;
    }
}

@media (min-width: 768px) {

    /* Более просторная сетка товаров */
    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .product-image {
        height: 160px;
    }
}

@media (min-width: 1024px) {

    /* Контейнер на всю ширину окна для полноценной web-версии */
    .container {
        max-width: none;
        width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    /* Двухколоночный макет: левый сайдбар + контент */
    .layout {
        display: grid;
        grid-template-columns: 260px 1fr;
        gap: 0;
        overflow: visible;
    }

    /* Показать сайдбар постоянно на десктопе */
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        transform: none;
        opacity: 1;
        pointer-events: auto;
        visibility: visible;
        display: block;
        box-shadow: none;
        border-right: 1px solid var(--border-light);
    }

    /* Убрать ручку сайдбара и левый защитный бордюр */
    .sidebar-handle {
        display: none;
    }

    body::before {
        display: none;
    }

    .catalog {
        padding: 2rem;
    }

    .products-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .product-image {
        height: 200px;
    }
}

.product-description {
    color: var(--text-gray);
    font-size: 0.8rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    /* прижать футер к низу карточки */
    margin-top: auto;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-pink);
}

.order-btn {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--dark-pink) 100%);
    color: var(--white);
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 1.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
}

.order-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(233, 30, 99, 0.4);
}

.order-btn:active {
    transform: translateY(0);
}

/* Пустой каталог */
.empty-catalog {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-gray);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-catalog h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

/* Футер */
.footer {
    padding: 2rem 1.5rem;
    background: var(--secondary-pink);
    border-radius: 1rem 1rem 0 0;
    margin-top: 2rem;
}

.consultant-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--dark-pink) 100%);
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.consultant-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    .header {
        border-radius: 0;
        padding: 1.5rem 1rem;
    }

    .logo {
        font-size: 1.8rem;
    }

    .catalog {
        padding: 1.5rem 1rem;
    }

    .product-info {
        padding: 1rem;
    }

    .product-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .order-btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }
}

/* Анимации загрузки */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Плавный перелив градиента заднего фона */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Уважение к настройкам снижения анимации */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        background-position: 50% 50%;
    }
}

.product-card {
    animation: fadeInUp 0.6s ease forwards;
}

.product-card:nth-child(2) {
    animation-delay: 0.1s;
}

.product-card:nth-child(3) {
    animation-delay: 0.2s;
}

.product-card:nth-child(4) {
    animation-delay: 0.3s;
}

/* Модальное окно товара */
.product-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.product-modal.active {
    display: flex;
}

.product-modal-content {
    background: var(--white);
    border-radius: 1rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.product-modal-header {
    position: relative;
    height: auto;
    /* позволяем содержимому задавать высоту */
    max-height: 60vh;
    /* ограничиваем по окну */
    min-height: 240px;
    /* не обрезаем содержимое, чтобы media сами подстраивались внутри */
    overflow: visible;
    border-radius: 1rem 1rem 0 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-modal-media {
    position: relative;
    width: 100%;
    max-height: 60vh;
    /* ограничиваем медиа по окну */
    display: grid;
    /* надёжное центрирование */
    place-items: center;
    background: #000;
}

.product-modal-image {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    background: transparent;
}

.product-modal-video {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
    /* гарантируем вписывание без обрезки */
    background: #000;
    display: none;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 9;
    display: none;
}

.carousel-nav.left {
    left: 0.5rem;
}

.carousel-nav.right {
    right: 0.5rem;
}

.carousel-dots {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 6px;
    z-index: 9;
}

.carousel-dots .dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    position: relative;
}

.carousel-dots .dot.active {
    background: #fff;
}

.carousel-dots .dot.dot-video {
    width: 10px;
    height: 10px;
    background: rgba(233, 30, 99, 0.45);
}

.carousel-dots .dot.dot-video::after {
    content: '';
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-left: 4px solid rgba(255, 255, 255, 0.85);
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    transform: translate(-35%, -50%);
}

.carousel-dots .dot.dot-video.active {
    background: rgba(233, 30, 99, 0.8);
}

.carousel-dots .dot.dot-video.active::after {
    border-left-color: #fff;
}

.product-modal-body {
    padding: 1.5rem;
}

.product-modal-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.product-modal-price {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent-pink);
    margin-bottom: 1rem;
}

.product-modal-description {
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.order-section {
    margin-top: 1.5rem;
    padding: 1.2rem 1.1rem 1.3rem;
    background: var(--light-pink);
    border-radius: 1.2rem;
    box-shadow: 0 16px 36px rgba(233, 30, 99, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

body.dark-theme .order-section {
    background: rgba(41, 16, 45, 0.92);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.order-section-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-dark);
}

.order-section-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-gray);
    line-height: 1.5;
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-form-feedback {
    margin-top: 0.25rem;
    padding: 0.75rem 1rem;
    border-radius: 0.85rem;
    background: rgba(233, 30, 99, 0.12);
    color: #7a1f45;
    font-size: 0.95rem;
    line-height: 1.4;
}

.order-form-feedback[hidden] {
    display: none !important;
}

.order-form-feedback--success {
    background: rgba(76, 175, 80, 0.16);
    color: #285c2a;
}

.order-form-feedback--error {
    background: rgba(244, 67, 54, 0.2);
    color: #8e2622;
}

.order-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.order-form-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 520px) {
    .order-form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: end;
    }
}

.order-form-row input,
.order-form-row textarea {
    border: 1.5px solid var(--border-light);
    border-radius: 0.9rem;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
    background: var(--white);
    color: var(--text-dark);
}

body.dark-theme .order-form-row input,
body.dark-theme .order-form-row textarea {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-dark);
}

.order-form-row input:focus,
.order-form-row textarea:focus {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.14);
}

.order-input--invalid {
    border-color: rgba(244, 67, 54, 0.75) !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.12) !important;
}

.order-form-row textarea {
    resize: vertical;
    min-height: 96px;
}

.order-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.order-hint {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-gray);
    line-height: 1.4;
}

.order-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
}

.order-checkbox input {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--accent-pink);
    accent-color: var(--accent-pink);
    margin: 0;
}

.order-saved {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.order-saved-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.order-saved-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.order-address-chip {
    border: none;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
    cursor: pointer;
    transition: transform var(--transition-base), box-shadow var(--transition-base), background-color var(--transition-base);
}

.order-address-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(233, 30, 99, 0.18);
}

.order-address-chip:active {
    transform: translateY(0);
}

.order-address-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.25);
}

.order-prefill {
    padding: 0.75rem 0.9rem;
    background: rgba(233, 30, 99, 0.08);
    border-radius: 0.9rem;
    font-size: 0.85rem;
    color: var(--accent-pink);
    line-height: 1.5;
}

body.dark-theme .order-prefill {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-dark);
}

.order-roadmap {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    background: rgba(233, 30, 99, 0.05);
}

body.dark-theme .order-roadmap {
    background: rgba(255, 255, 255, 0.05);
}

.order-roadmap-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}

.order-roadmap-list {
    margin: 0;
    padding-left: 1.05rem;
    display: grid;
    gap: 0.4rem;
    list-style: decimal;
}

.order-roadmap-list li {
    font-size: 0.9rem;
    color: var(--text-gray);
    line-height: 1.5;
    background: rgba(233, 30, 99, 0.08);
    border-radius: 0.8rem;
    padding: 0.55rem 0.75rem;
    list-style-position: inside;
}

body.dark-theme .order-roadmap-list li {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dark);
}

.order-roadmap-note {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-gray);
}

.product-modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-cart-btn {
    width: 100%;
    background: var(--white);
    color: var(--accent-pink);
    border: 1.5px solid rgba(233, 30, 99, 0.45);
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 18px rgba(233, 30, 99, 0.18);
}

.modal-cart-btn:hover,
.modal-cart-btn:focus {
    background: var(--secondary-pink);
    border-color: var(--accent-pink);
    box-shadow: 0 10px 26px rgba(233, 30, 99, 0.26);
}

.modal-cart-btn.is-active {
    background: rgba(233, 30, 99, 0.12);
    color: var(--dark-pink);
    border-color: rgba(233, 30, 99, 0.35);
}

body.dark-theme .modal-cart-btn {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-pink);
    border-color: rgba(255, 255, 255, 0.22);
}

body.dark-theme .modal-cart-btn:hover,
body.dark-theme .modal-cart-btn:focus {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.38);
}

/* Кнопка поделиться в модалке */
.modal-share-btn {
    width: 100%;
    margin-top: 0.75rem;
    background: var(--white);
    color: var(--accent-pink);
    border: 1px solid var(--border-light);
    padding: 0.9rem 1rem;
    border-radius: 1rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-share-btn:hover {
    background: var(--secondary-pink);
    box-shadow: var(--shadow);
}

/* Футер со ссылками */
.footer {
    padding: 1.5rem 1rem;
    background: var(--secondary-pink);
    border-radius: 1rem 1rem 0 0;
    margin-top: 2rem;
}

.footer-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-dark);
}

.footer-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 1rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-links.collapsed {
    display: none;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem;
    background: var(--white);
    border-radius: 2rem;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s ease;
    font-weight: 400;
    border: 1px solid var(--border-light);
}

.social-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.social-icon {
    font-size: 1.2rem;
}