:root {
    --bg-color: #FDFBF7;
    --text-primary: #2C3522;
    --text-secondary: #6B7261;
    --accent: #C48B9F;
    --accent-hover: #A67184;
    --card-bg: #FFFFFF;
    --border: #E8E5DF;
}

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

html {
    scroll-behavior: smooth;
    overflow-y: scroll;         /* всегда резервируем скроллбар — шапка не прыгает при переходах */
    scrollbar-gutter: stable;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, .logo {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

/* Header */
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    padding: 1rem 2.35rem;
    background-color: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 60px;
    position: absolute;
    width: max-content;      /* pill hugs its content — компактное меню по центру */
    max-width: 92%;
    left: 50%;
    transform: translateX(-50%);
    top: 22px;
    z-index: 10;
    box-shadow: 0 6px 26px rgba(0, 0, 0, 0.32);
}

.header .logo img { height: 44px !important; }

.header .logo, .header .nav a, .header .cart, .header .cart a, .header .theme-toggle {
    color: #ffffff !important;
}
.header .nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
}
.header .nav a {
    font-size: 1.02rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
    padding: 0.62rem 1.05rem;
    border-radius: 30px;
    align-items: center;
    white-space: nowrap;
}

/* Night Mode Stars */
.stars-layer {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    overflow: hidden;
}

body[data-theme="dark"] .stars-layer {
    opacity: 1;
}

.star {
    position: absolute;
    background: #ffffff;
    border-radius: 50%;
    animation: twinkle linear infinite;
}

@keyframes twinkle {
    0% { opacity: 0.1; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 8px #fff; }
    100% { opacity: 0.1; transform: scale(0.8); }
}

/* Watercolor Canvas Effect */
.watercolor-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(8px);
    opacity: 0;
    transform: scale(0.5);
    animation: bloom 3s ease-out forwards;
}

body[data-theme="dark"] .watercolor-blob {
}

@keyframes bloom {
    0% { opacity: 0; transform: scale(0.5); }
    30% { opacity: 0.8; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* ASMR Button */
.asmr-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 30px;
    padding: 10px 20px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}
body[data-theme="dark"] .asmr-btn {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.asmr-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.4);
}
body[data-theme="dark"] .asmr-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}
.asmr-btn.playing {
    border-color: var(--accent);
    color: var(--accent);
}

/* CSS Vase effect */
.product-card {
    position: relative;
}
.css-vase {
    position: absolute;
    bottom: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 150px;
    border-radius: 10px 10px 45px 45px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-bottom: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 
        inset 0 -20px 30px rgba(255, 255, 255, 0.2),
        inset 0 0 15px rgba(255, 255, 255, 0.3),
        0 10px 20px rgba(0, 0, 0, 0.1);
    z-index: 2;
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
.vase-water {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(180deg, rgba(200,230,255,0.1) 0%, rgba(150,210,255,0.2) 100%);
    border-top: 1px solid rgba(255,255,255,0.4);
}
.vase-highlight {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 20px;
    height: 100px;
    background: linear-gradient(90deg, rgba(255,255,255,0.0), rgba(255,255,255,0.6), rgba(255,255,255,0.0));
    transform: rotate(5deg);
    filter: blur(2px);
}
.has-vase .css-vase {
    bottom: -10px;
    opacity: 1;
}
.has-vase .product-image img {
    transform: translateY(-20px) scale(0.95);
}

/* Button Petal Animation */
.btn-petal {
    position: absolute;
    background: var(--accent);
    border-radius: 0 50% 50% 50%;
    opacity: 0.8;
    pointer-events: none;
    z-index: 10;
    animation: petal-fall 1s ease-out forwards;
}
body[data-theme="dark"] .btn-petal {
    background: #ffb6c1;
}

@keyframes petal-fall {
    0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 0.8; }
    50% { transform: translateY(20px) rotate(45deg) scale(0.8); opacity: 0.5; }
    100% { transform: translateY(40px) rotate(90deg) scale(0); opacity: 0; }
}

.header .nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

.solid-header {
    position: relative;
    top: 0;
    margin-top: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.page-section {
    padding: 4rem 5% 0;
}

.logo {
    font-size: 2rem;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -1px;
}

/* Logo badge: cream pill behind the ЦветоFOR wordmark (rounding matches the header) */
img[src*="logo-wordmark"] {
    background: #F6F0E6;
    padding: 6px 16px;
    border-radius: 999px;
    box-sizing: content-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10);
    aspect-ratio: 778 / 220;   /* резервируем ширину до загрузки картинки — нет прыжка */
}

/* "Корзина" — обычный пункт меню (стоит в nav сразу после «Контакты») */
.header .nav a.cart-link {
    color: #fff !important;
    text-decoration: none;
}

.nav a {
    text-decoration: none;
    color: var(--text-primary);
    margin: 0 2rem;
    font-size: 1.2rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover {
    color: var(--accent);
}

.cart {
    font-size: 1.2rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.cart a {
    transition: color 0.3s;
}

.cart a:hover {
    color: var(--accent) !important;
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    min-height: 80vh;
    padding: 150px 5% 70px;
    position: relative;
}

.hero-content {
    flex: 0 0 auto;   /* column hugs the text — no stretched empty space */
    max-width: 460px;
    padding-right: 0;
    z-index: 2;
}

.hero-content h1 {
    font-size: 4.2rem;
    line-height: 1.06;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
}

.hero-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 420px;
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--accent);
    color: white;
    text-decoration: none;
    font-weight: 500;
    border-radius: 50px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(196, 139, 159, 0.2);
}

.hero-image {
    flex: 0 1 600px;
    height: 500px;
    max-height: 62vh;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.14);
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

/* Catalog */
.catalog {
    padding: 8rem 5%;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-style: italic;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2.25rem;
    max-width: 1900px;   /* до 5 широких карточек в ряд, не больше */
}

.product-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}

.product-image {
    height: 350px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 2rem;
    text-align: center;
}

.product-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.price {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.add-to-cart {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: #ffffff;
    padding: 0.85rem 1rem;
    border-radius: 30px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.2s ease, transform 0.1s ease;
    width: 100%;
}

.add-to-cart:hover {
    filter: brightness(1.08);
    color: white;
}
.add-to-cart:active { transform: scale(0.98); }

/* Footer */
.footer {
    background-color: #1a1a1a;
    color: white;
    padding: 5rem 5% 2rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4rem;
}

.footer-brand h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: #A0A59A;
}

.footer-links p {
    margin-bottom: 0.5rem;
    color: #A0A59A;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #A0A59A;
    font-size: 0.9rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .hero {
        flex-direction: column;
        padding-top: 100px;
    }
    
    .hero-content {
        padding-right: 0;
        text-align: center;
        margin-bottom: 3rem;
    }
    
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .hero-image {
        width: 100%;
        height: 50vh;
    }
    
    .nav {
        display: none;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    .hero {
        padding-top: 80px;
    }
    .hero-content h1 {
        font-size: 2.2rem;
        margin-bottom: 1rem;
    }
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    .hero-image {
        height: 40vh;
        border-radius: 12px;
    }
    .hero-image img {
        border-radius: 12px;
    }
    .catalog {
        padding: 4rem 1rem;
    }
    .section-header h2 {
        font-size: 2.2rem;
    }
    .products-grid {
        gap: 1.5rem;
        grid-template-columns: 1fr;
    }
    .footer {
        padding: 3rem 1rem 1rem;
    }
    .footer-brand h2 {
        font-size: 2rem;
    }
}

/* Auth Page */
.auth-page {
    background-color: var(--card-bg);
}

.auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 5% 50px;
}

.auth-container {
    display: flex;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    overflow: hidden;
    max-width: 1000px;
    width: 100%;
}

.auth-form-box {
    flex: 1;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-form-box h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.auth-form-box > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-btn {
    width: 100%;
    margin-top: 1rem;
}

.auth-switch {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-image {
    flex: 1;
    display: none;
}

@media (min-width: 768px) {
    .auth-image {
        display: block;
    }
    .auth-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* Profile Page */
.profile-section {
    padding-bottom: 8rem;
}

.profile-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 992px) {
    .profile-container {
        grid-template-columns: 300px 1fr;
    }
}

.profile-sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    height: fit-content;
}

.user-info {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.user-avatar {
    width: 80px;
    height: 80px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    margin: 0 auto 1rem;
    font-family: 'Playfair Display', serif;
}

.user-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.user-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.profile-menu {
    list-style: none;
}

.profile-menu li {
    margin-bottom: 0.5rem;
}

.profile-menu a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s;
    font-weight: 500;
}

.profile-menu a:hover, .profile-menu li.active a {
    background-color: var(--bg-color);
}

.profile-content h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.order-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.order-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
}

.order-number {
    font-weight: 600;
}

.order-status {
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.order-status.delivered {
    background-color: #E8F5E9;
    color: #2E7D32;
}

.order-body {
    padding: 1.5rem;
}

.order-item {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.order-item img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.order-item h4 {
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}

.order-item p {
    color: var(--text-secondary);
}

.order-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.order-total {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

/* Yandex Button */
.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
    z-index: 1;
}
.auth-divider span {
    background: var(--card-bg);
    padding: 0 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}
.yandex-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #FFFFFF;
    color: #000000;
    border: 1px solid var(--border);
    width: 100%;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.yandex-btn:hover {
    background-color: #F5F5F5;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.yandex-icon {
    color: #FC3F1D;
    font-weight: bold;
    font-size: 1.2rem;
    font-family: Arial, sans-serif;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-color: #1c1228;
    --card-bg: #27193a;
    --text-primary: #f5f5f5;
    --text-secondary: #bbbbcc;
    --border: #442f66;
}

/* Theme Toggle & Hamburger */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-primary);
    margin-right: 2rem;
    transition: 0.3s;
}
.theme-toggle:hover {
    opacity: 0.7;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    margin-left: 1.5rem;
}

/* ===== Compact "curtain" header — phones & tablets (≤1024px) ===== */
@media (max-width: 1024px) {
    /* Compact pill: round menu button on the LEFT, logo, Catalog + cart chips */
    .header {
        width: 94% !important;
        max-width: 600px !important;
        gap: 0.5rem !important;
        top: 12px;
        padding: 0.5rem 0.7rem !important;
        flex-wrap: nowrap;
        border-radius: 999px;
        justify-content: space-between;
    }

    /* Round menu button — a normal flex item (order:-1) so it can never overlap the logo */
    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        position: static;
        order: -1;
        transform: none;
        flex: 0 0 auto;
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--accent, #C48B9F);
        border: none;
        color: #fff;
        font-size: 1.35rem;
        line-height: 1;
        margin: 0;
        box-shadow: 0 2px 10px rgba(196, 139, 159, 0.6);
        z-index: 5;
    }

    .header .logo img { height: 30px !important; padding: 4px 12px; }

    .nav {
        display: flex !important;
        order: 0;
        width: auto;
        margin: 0;
        padding: 0;
        overflow: visible;
        flex: 1;
        justify-content: center;
        gap: 0.4rem;
    }
    .nav a { display: none; }
    .nav a[href="catalog.html"] {
        display: inline-flex;
        background: var(--accent, #10B981);
        color: #fff !important;
        border-radius: 999px;
        padding: 0.5rem 1.05rem;
        font-size: 0.8rem;
        margin: 0;
    }
    .nav a.cart-link {
        display: inline-flex;
        font-size: 0.75rem;
        padding: 0.45rem 0.65rem;
        margin: 0;
    }
    .header .cart { display: flex; align-items: center; order: -1; }  /* hamburger to the far left */

    /* Open state: neutralise the header transform so the fixed overlay is
       measured against the viewport, not the pill */
    .header.menu-open {
        transform: none !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0;
        background: transparent;
        border-color: transparent;
        box-shadow: none;
        padding: 0;
    }

    /* The full-screen curtain */
    .header.menu-open .nav {
        display: flex !important;
        position: fixed !important;
        inset: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        min-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        z-index: 100 !important;
        background: rgba(18, 20, 26, 0.98) !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.75rem !important;
        transform: translateY(0);
        transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
        will-change: transform;
        touch-action: none;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    }
    .header.menu-open .nav::before {
        content: "";
        position: absolute;
        top: 12px; left: 50%;
        width: 46px; height: 5px;
        transform: translateX(-50%);
        background: rgba(255, 255, 255, 0.35);
        border-radius: 999px;
    }
    .header.menu-dragging .nav { transition: none !important; }
    .header.menu-open .nav a {
        display: inline-flex !important;
        font-size: 1.2rem;
        color: #fff !important;
        padding: 0.85rem 1.7rem;
        border-radius: 999px;
        background: transparent;
    }
    .header.menu-open .nav a[href="catalog.html"],
    .header.menu-open .nav a.cart-link { background: var(--accent, #10B981); }
    .header.menu-open .hamburger {
        position: fixed;
        top: 16px;
        left: 16px;
        transform: none;
        z-index: 101;
    }
}

/* Catalog Layout with Filters */
.catalog-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    max-width: 1760px;      /* центрируем каталог на широких экранах */
    margin: 0 auto;
}
@media (min-width: 992px) {
    .catalog-layout {
        grid-template-columns: 250px minmax(0, 1fr);  /* minmax(0,...) не даёт сетке вылезать */
    }
}
.filters-sidebar {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    height: fit-content;
}
.filter-group {
    margin-bottom: 2rem;
}
.filter-group h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-family: 'Playfair Display', serif;
}
.filter-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.care-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50px;
    width: 45px;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}
.care-btn:hover {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2000;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    padding: 2.5rem;
    position: relative;
    transform: translateY(30px);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    max-height: 85vh;
    overflow-y: auto;
}
.modal-overlay.active .modal-content {
    transform: translateY(0);
}
.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
}
.modal-close:hover {
    color: var(--text-primary);
}
.modal-content h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}
.modal-instruction {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-start;
}
.modal-instruction-icon {
    font-size: 2rem;
}
.modal-instruction-text h4 {
    margin-bottom: 0.3rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}
.modal-instruction-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Additional Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .modal-content {
        padding: 1.5rem;
    }
    .auth-form-box {
        padding: 2rem 1.5rem;
    }
    .auth-section {
        padding: 80px 1rem 30px;
    }
    .profile-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .order-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .order-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .section-header {
        margin-bottom: 2rem;
    }
    .catalog-layout {
        gap: 1.5rem;
    }
}

/* Animations */
@keyframes floatPetal {
  0% { transform: translateY(-5vh) rotate(0deg) translateX(0); opacity: 0; }
  10% { opacity: 0.7; }
  90% { opacity: 0.7; }
  100% { transform: translateY(100vh) rotate(360deg) translateX(50px); opacity: 0; }
}
.petal { position: fixed; top: -5vh; pointer-events: none; z-index: -1; animation: floatPetal 15s linear infinite; }
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.8s ease, transform 0.8s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* Chatbot Widget */
#chatbot-widget { position: fixed; bottom: 30px; right: 30px; z-index: 1000; font-family: 'Montserrat', sans-serif; }
#chatbot-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: white; border: none; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: transform 0.3s; display: flex; justify-content: center; align-items: center; }
#chatbot-btn:hover { transform: scale(1.1); }
#chatbot-window { display: none; position: absolute; bottom: 80px; right: 0; width: 350px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.3); flex-direction: column; }
#chatbot-header { background: var(--accent); color: white; padding: 1rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
#chatbot-messages { height: 350px; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; }
.chat-msg { max-width: 85%; padding: 0.8rem 1rem; border-radius: 12px; font-size: 0.95rem; line-height: 1.4; }
.chat-bot { background: rgba(0,0,0,0.05); align-self: flex-start; border-bottom-left-radius: 4px; }
[data-theme='dark'] .chat-bot { background: rgba(255,255,255,0.05); }
.chat-user { background: var(--accent); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-options { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.chat-option-btn { background: transparent; border: 1px solid var(--accent); color: var(--text-primary); padding: 0.5rem 1rem; border-radius: 20px; cursor: pointer; transition: 0.3s; font-size: 0.9rem; text-align: left; }
.chat-option-btn:hover { background: var(--accent); color: white; }
#chatbot-close { background: none; border: none; color: white; cursor: pointer; font-size: 1.2rem; }

/* Constructor */
.constructor-layout { display: grid; grid-template-columns: 1fr; gap: 2.75rem; max-width: 1520px; margin: 0 auto; }
@media (min-width: 992px) { .constructor-layout { grid-template-columns: minmax(0, 2.3fr) minmax(330px, 1fr); } }
.constructor-step { background: var(--card-bg); padding: 2.6rem; border-radius: 20px; border: 1px solid var(--border); margin-bottom: 2.25rem; }
.constructor-step > h3 { font-size: 1.8rem !important; margin-bottom: 1.6rem; }

/* Flowers as a grid of image cards */
#flower-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(335px, 1fr)); gap: 1.35rem; }
.flower-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.15rem;
    padding: 1.2rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    margin: 0;
    background: var(--bg-color, #fff);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.flower-item:hover { border-color: var(--accent); box-shadow: 0 8px 22px rgba(0,0,0,0.07); transform: translateY(-2px); }
.flower-info { display: flex; align-items: center; gap: 1.15rem; min-width: 0; }
.flower-thumb {
    width: 108px; height: 108px;
    object-fit: cover;
    border-radius: 14px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.flower-thumb--empty {
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #f6eef1, #eef3ec);
}
.flower-name { font-weight: 600; font-size: 1.2rem; margin-bottom: 0.3rem; line-height: 1.3; }
.flower-price { color: var(--text-secondary); font-size: 1.02rem; }
.flower-controls { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.flower-btn {
    background: var(--accent); color: white; border: none; border-radius: 50%;
    width: 46px; height: 46px; cursor: pointer; font-size: 1.55rem; line-height: 1;
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.1s ease, filter 0.15s ease;
}
.flower-btn:hover { filter: brightness(1.08); }
.flower-btn:active { transform: scale(0.9); }
.flower-qty {
    width: 60px; height: 46px; text-align: center; font-weight: 600; font-size: 1.15rem;
    border: 1px solid var(--border); border-radius: 8px; background: transparent;
    color: var(--text-primary); font-family: inherit;
    appearance: textfield; -moz-appearance: textfield;
}
#const-wrapper { padding: 1.25rem 1.3rem !important; font-size: 1.15rem !important; }
.summary-panel { position: sticky; top: 110px; background: var(--card-bg); padding: 2.5rem; border-radius: 20px; border: 1px solid var(--border); }
.summary-panel h3 { font-size: 1.6rem; }
.summary-item { display: flex; justify-content: space-between; margin-bottom: 0.6rem; font-size: 1.05rem; color: var(--text-secondary); }

/* ============================================================
   RESPONSIVE OVERHAUL — laptops (13–14") and mobile devices
   (appended last so these rules win the cascade)
   ============================================================ */

/* ---- Laptops 13–14" (≤1440px) ---- */
@media (min-width: 1025px) and (max-width: 1440px) {
    .header { max-width: 96%; padding: 0.95rem 2.2rem; }
}
@media (max-width: 1440px) {
    .hero-content h1 { font-size: 3.8rem; }
    .section-header h2 { font-size: 2.6rem; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; }
}

/* ---- Small laptops (≤1280px) ---- */
@media (min-width: 1025px) and (max-width: 1280px) {
    .header { padding: 0.85rem 1.9rem; }
    .header .nav a { font-size: 0.92rem; padding: 0.55rem 0.85rem; }
    .header .nav { gap: 0.5rem; }
}
@media (max-width: 1280px) {
    .hero-content h1 { font-size: 3.2rem; }
    .hero { padding-left: 4%; padding-right: 4%; }
    .page-section { padding-left: 4%; padding-right: 4%; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 1.5rem; }
}

/* ---- Mobile (≤768px) ---- */
@media (max-width: 768px) {
    /* small-screen header tweaks (base compact header lives in the ≤1024 block) */
    .header .logo img { height: 26px !important; padding: 4px 10px; }

    /* Comfortable page spacing */
    .page-section { padding: 5.5rem 0.9rem 2rem; }
    .section-header h2 { font-size: 1.9rem; }
    .section-header p { font-size: 0.95rem; }

    /* Catalog — filters become compact flat toggle chips on mobile */
    .filters-sidebar { padding: 0.9rem 1rem; }
    .product-card .product-info { padding: 1.25rem; }

    .filter-group { margin-bottom: 1.15rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
    .filter-group h4 { width: 100%; margin-bottom: 0.25rem; font-size: 1rem; }
    .filter-label {
        display: inline-flex;
        align-items: center;
        gap: 0;
        margin: 0;
        padding: 0.38rem 0.75rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        background-color: var(--bg-color, #fff);
        color: var(--text-secondary);
        font-size: 0.78rem;
        line-height: 1;
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
    }
    .filter-label:active { transform: scale(0.94); }
    .filter-label input { display: none; }
    .filter-label.is-checked {
        background-color: var(--accent, #10B981) !important;
        border-color: var(--accent, #10B981) !important;
        color: #fff !important;
        font-weight: 600;
    }
    /* Filter applies instantly on tap — the button is redundant on mobile */
    .filters-sidebar > .btn { display: none; }

    /* Constructor */
    .constructor-step { padding: 1.25rem; }
    .summary-panel { padding: 1.25rem; }

    /* Cart page: rows wrap so qty controls drop below on narrow screens */
    #cart-items > div > div { flex-wrap: wrap; }

    /* Footer: single centered column */
    .footer > div > div:first-child {
        grid-template-columns: 1fr !important;
        text-align: center;
    }
    .footer a[href="index.html"] { margin-left: auto; margin-right: auto; }
    .footer [data-contact="phones"] { align-items: center; }
    .footer div[style*="display: flex"][style*="gap: 1rem"] { justify-content: center; }

    /* Modals fill the screen nicely */
    .modal-content { width: 92%; padding: 1.5rem; }

    /* Forms & inputs get bigger touch targets */
    input, select, textarea, button { font-size: 16px; } /* prevents iOS zoom */
}

/* Very narrow phones */
@media (max-width: 380px) {
    .header .logo img { height: 22px !important; padding: 3px 8px; }
    .nav a[href="catalog.html"] { padding: 0.45rem 0.8rem; font-size: 0.72rem; }
    .nav a.cart-link { font-size: 0.66rem; padding: 0.4rem 0.45rem; }
}

/* ===== Image lightbox (click a product photo to enlarge) ===== */
.product-image img,
.product-gallery img,
.flower-thumb,
#cart-items img { cursor: zoom-in; }

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 12, 14, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 5vh 5vw;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.22s ease;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}
.lightbox-overlay.open { display: flex; opacity: 1; }
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: lightboxIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes lightboxIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-close {
    position: fixed;
    top: 18px;
    right: 26px;
    width: 48px;
    height: 48px;
    font-size: 2rem;
    line-height: 1;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
