@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0c10;
    --bg-secondary: #11151c;
    --bg-card: #161b24;
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #22c55e;
    --border-light: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    background-color: var(--bg-primary);
    font-family: var(--font-sans);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-top: 80px;
}

body.menu-open,
body.cart-open {
    overflow: hidden;
}

/* --- Фиксированная шапка --- */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    transition: var(--transition);
}

@media (min-width: 1400px) {
    .fixed-header {
        background: rgba(10, 12, 16, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-light);
    }
}


.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Логотип */
.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.logo-link:hover {
    opacity: 0.8;
}

.logo-img {
    height: 2.4rem;
    width: auto;
    display: block;
}

.logo-text {
    white-space: nowrap;
}

/* Десктопное меню категорий */
.categories-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.categories-menu {
    display: flex;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.category-link:hover {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* Бургер-кнопка (по умолчанию скрыта) */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 110;
}

.burger-line {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: transform 0.3s, opacity 0.3s;
    border-radius: 0;
}

/* Мобильное меню */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    max-width: 85%;
    height: 100%;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    padding: 2rem 1.5rem;
    transition: right 0.3s ease;
    border-left: 1px solid var(--border-light);
    overflow-y: auto;
}

.mobile-nav.open {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.mobile-nav-title {
    font-size: 1.4rem;
    font-weight: 500;
}

.mobile-nav-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s;
}

.mobile-nav-close:hover {
    color: var(--text-primary);
}

.mobile-categories-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-category-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: color 0.2s;
}

.mobile-category-link:hover {
    color: var(--text-primary);
}

/* Корзина иконка */
.cart-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.cart-icon:hover {
    background: rgba(255, 255, 255, 0.05);
}

.cart-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.cart-count {
    color: white;
    border-radius: 0;
    padding: 0.1rem 0.6rem;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 700px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -80px;
    overflow: hidden;
}

.hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.9)), url('/static/images/bg.png');
    background-size: auto;
    background-position: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
    max-width: 1200px;
}

.hero-title {
    font-size: clamp(2rem, 10vw, 4rem);
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
}

.hero-title-line {
    font-family: Montserrat, sans-serif;
    display: block;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.8s ease-out forwards;
    opacity: 0;
}

.hero-title-line:first-child {
    animation-delay: 0.1s;
}

.hero-title-line:last-child {
    animation-delay: 0.3s;
}

.hero-subtitle {
    font-family: Montserrat, sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    animation: fadeUp 0.8s 0.5s ease-out forwards;
}

.hero-scroll {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.hero-scroll-line {
    width: 1px;
    height: 60px;
    background: white;
    animation: scrollPulse 2s infinite;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.2); }
}

/* --- Основной контент --- */
.main-content {
    padding: 4rem 0;
}
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 3rem;
}
.categories {
    display: flex;
    flex-direction: column;
    gap: 6rem;
}
.category-section {
    position: relative;
    scroll-margin-top: 100px;
}
.category-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.5rem;
}
.category-title {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

/* --- Сетка продуктов --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}
.product-card {
    position: relative;
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: none;
}
.product-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 4;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 0;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.95);
    border-radius: 0;
}
.product-media:hover {
    transform: scale(1.1);
    filter: brightness(1.25);
}
.product-content {
    padding: 0 0.25rem;
}
.product-name {
    font-size: 1.5rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}
.product-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--success);
    letter-spacing: -0.02em;
}
.product-stock {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.product-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.product-attrs span {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(4px);
}

/* Выпадающий список вариантов и кнопка в одном ряду */
.variant-select-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.variant-select {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: 0;
    cursor: pointer;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
}
.variant-select:hover,
.variant-select:focus {
    border-color: var(--accent);
    outline: none;
}
/* Кнопка "В корзину" внутри обёртки */
.variant-select-wrapper .add-to-cart {
    margin-bottom: 0;
    white-space: nowrap;
    align-self: flex-start;
}

/* --- Кнопки --- */
button,
.btn,
.add-to-cart,
.delivery-option,
#order-button,
.product-qty-actions button,
.cart-item-actions button,
.clear-cart-btn,
.close-cart {
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.add-to-cart,
#order-button,
.delivery-option.active {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: var(--accent);
    border: 1px solid var(--accent);
    color: white;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    text-transform: none;
}
.add-to-cart:hover,
#order-button:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: scale(0.98);
}
.add-to-cart.disabled,
.add-to-cart:disabled,
#order-button:disabled {
    background: var(--bg-card);
    border-color: var(--border-medium);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.8;
    transform: none;
}
.delivery-option:not(.active),
.product-qty-actions button,
.cart-item-actions button,
.clear-cart-btn,
.close-cart {
    background: transparent;
    color: var(--text-secondary);
    border-radius: 0;
}
.delivery-option:not(.active):hover,
.product-qty-actions button:hover,
.cart-item-actions button:hover,
.clear-cart-btn:hover,
.close-cart:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.product-qty-actions {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 0;
    padding: 0;
}
.product-qty-actions button {
    width: 36px;
    height: 36px;
    border: none;
    border-right: 1px solid var(--border-medium);
    border-radius: 0;
    font-size: 1.2rem;
    background: transparent;
    color: var(--text-primary);
}
.product-qty-actions button:last-child {
    border-right: none;
}
.product-qty-actions button:hover:not(:disabled) {
    background: var(--accent);
    color: white;
}
.product-qty-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    color: var(--text-muted);
}
.product-qty-value {
    min-width: 2.5rem;
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
}
.product-cart-controls {
    margin-bottom: 1rem;
}

/* Корзина элементы */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cart-item-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: transparent;
    border: none;                 /* убрали обводку */
    color: var(--text-secondary);
}
.cart-item-actions button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
.cart-qty-value {
    min-width: 1.5rem;
    text-align: center;
}
.cart-header-actions {
    display: flex;
    gap: 0.5rem;
}
/* Кнопки очистки и закрытия корзины без обводки */
.clear-cart-btn,
.close-cart {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: 0;
}
.clear-cart-btn:hover,
.close-cart:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}
#order-button {
    width: 100%;
    padding: 1rem;
    font-weight: 600;
    border-radius: 0;
    margin-top: 1rem;
}

/* Переключатель доставки */
.delivery-toggle {
    display: flex;
    position: relative;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: 0;
    padding: 0;
}
.delivery-toggle-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 50%;
    background: var(--accent);
    transition: transform 0.3s ease;
    z-index: 1;
    border-radius: 0;
    transform: translateX(0);
    will-change: transform;
}
.cart-delivery--delivery .delivery-toggle-bg {
    transform: translateX(100%);
}
.delivery-option {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
    z-index: 2;
    border-radius: 0;
    text-align: center;
}
.delivery-option.active {
    background: transparent;
    color: white;
    border: none;
}
.delivery-option:not(.active):hover {
    background: transparent;
    color: var(--text-primary);
}

/* Пустые состояния */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-style: italic;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 0;
}
.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 0;
}

/* --- Корзина Sidebar --- */
.cart-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: -420px;
    width: 420px;
    max-width: 100%;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border-left: 1px solid var(--border-light);
    border-radius: 0;
}
.cart-sidebar.open {
    right: 0;
}
.cart-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}
.cart-header h2 {
    font-size: 1.8rem;
    font-weight: 500;
    letter-spacing: -0.02em;
}
.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}
.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}
.cart-item-img {
    width: 80px;
    height: 100px;
    object-fit: cover;
    background: var(--bg-card);
    border-radius: 0;
}
.cart-item-img--placeholder {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-primary));
    border: 1px dashed var(--border-medium);
}
.cart-item-details {
    flex: 1;
}
.cart-item-name {
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.cart-item-attrs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}
.cart-item-price {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.cart-line-total {
    color: var(--success);
    font-weight: 600;
}
.cart-delivery {
    flex-shrink: 0;
    margin-bottom: 1.5rem;
}
.cart-delivery-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.cart-total {
    flex-shrink: 0;
    font-size: 1.5rem;
    font-weight: 600;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-light);
    text-align: right;
}

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999;
    display: none;
    transition: opacity 0.3s;
}
.overlay.active {
    display: block;
}

/* Toast */
.cart-toast {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    max-width: 400px;
    background: var(--bg-secondary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0;
    font-size: 0.9rem;
    z-index: 1001;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
}
.cart-toast--error {
    background: #b91c1c;
}
.cart-toast--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Footer */
.footer {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
}

@media (max-width: 1400px) {
    .logo {
        display: none;
    }
    .categories-nav {
        display: none;
    }
    .burger-menu {
        display: flex;
    }
}

/* Адаптивность */
@media (max-width: 900px) {
    .header-inner {
        padding: 1rem 1.5rem;
    }
    .container {
        padding: 0 1.5rem;
    }
    .hero-title {
        font-size: clamp(3rem, 12vw, 5rem);
    }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    .logo-text {
        font-size: 1.5rem;
    }
    .cart-icon {
        margin-left: auto;
    }
}

@media (max-width: 640px) {
    .product-media:hover {
        transform: scale(1);
        filter: brightness(1);
    }
    body {
        padding-top: 70px;
    }
    .fixed-header {
        padding: 0;
    }
    .header-inner {
        padding: 0.75rem 1.25rem;
    }
    .logo-img {
        height: 2rem;
    }
    .logo-text {
        font-size: 1.3rem;
    }
    .hero {
        margin-top: -70px;
        min-height: 600px;
    }
    .hero-content {
        padding: 0 1rem;
    }
    .hero-title {
        font-size: 3.5rem;
    }
    .container {
        padding: 0 1.25rem;
    }
    .category-title {
        font-size: 2rem;
    }
    .products-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    .mobile-nav {
        width: 260px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.hero-logo {
    display: none;
}

@media (max-width: 1400px) {
    .hero-logo {
        display: inline-block;
        transform: scale(1.25);
        margin: 0 auto;
        padding: 2rem;
    }
    .hero-title {
        display: none;
    }
}