/* =========================================
   1. Глобальні змінні (iOS 2026 Design System)
   ========================================= */
:root {
    --ios-bg: #f2f2f7;
    --ios-card: rgba(255, 255, 255, 0.75);
    --ios-blur: blur(20px);
    --ios-accent: #007aff;
    --ios-text: #000000;
    --ios-muted: #8e8e93;
    --ios-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    --header-height: 64px; /* Фіксована висота для стабільності */
}

html, body {
    height: 100%;
    margin: 0;
    background-color: var(--ios-bg);
    color: var(--ios-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* =========================================
   2. Шапка та Навігація (Sticky + Glassmorphism)
   ========================================= */
#mainHeader {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: var(--ios-blur);
    -webkit-backdrop-filter: var(--ios-blur);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Секція з логотипом: вирівнюємо Лого і Кошик по центру */
.logo-section {
    height: var(--header-height);
    display: flex;
    align-items: center; /* Твій кошик більше не буде "високо" */
    justify-content: space-between;
    padding: 0 20px;
    transition: opacity 0.3s ease;
}

/* Логотип: Великий і чіткий */
.navbar-brand {
    font-size: 1.6rem !important;
    font-weight: 850 !important;
    letter-spacing: -1px;
    color: var(--ios-text);
    text-decoration: none;
    margin: 0;
}

/* Кошик: Стильна "пігулка" праворуч */
.cart-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 18px;
    text-decoration: none;
    color: var(--ios-text);
    transition: all 0.2s ease;
}

    .cart-link:hover {
        background: rgba(0, 0, 0, 0.1);
    }

    .cart-link .fs-4 {
        font-size: 1.25rem !important;
    }

/* Логіка приховування шапки */
#mainHeader.header-hidden {
    transform: translateY(-64px); /* Ховаємо рівно на висоту логотипу */
}

.header-hidden .logo-section {
    opacity: 0;
    pointer-events: none;
}

/* =========================================
   3. Категорії (Centered + Scrollable)
   ========================================= */
.category-bar {
    background: rgba(255, 255, 255, 0.4);
    padding: 6px 0;
    border-top: 0.5px solid rgba(0, 0, 0, 0.05);
}

.category-scroll-container {
    display: flex;
    justify-content: center; /* Центруємо на великих екранах */
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

    .category-scroll-container::-webkit-scrollbar {
        display: none;
    }

/* На мобільних скролимо від краю */
@media (max-width: 768px) {
    .category-scroll-container {
        justify-content: flex-start;
        padding: 0 15px;
    }
}

.nav-pill {
    flex: 0 0 auto;
    margin: 0 4px;
    padding: 8px 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--ios-text);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 0.5px solid rgba(0, 0, 0, 0.05);
}

    .nav-pill.active {
        background: var(--ios-text);
        color: #fff;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

/* =========================================
   4. Товари (Modern Grid & Cards)
   ========================================= */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 24px;
}

.product-card {
    background: var(--ios-card);
    backdrop-filter: var(--ios-blur);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--ios-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-column: column;
}

    .product-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.12);
    }
    .product-card:hover img{
        transform: translateY(-8px);
        box-shadow: 0 15px 45px rgba(0, 0, 0, 0.12);
    }

.product-image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #fff;
}

    .product-image-wrapper img {
        width: 100%;
        height: 100%;
        object-fit:  contain; /* Жодного scale(2.5) у спокої! */
        transform: scale(2);
        transition: transform 0.8s ease;
    }

.product-card:hover img {
    transform: scale(1.08); /* Легкий, дорогий зум */
}

.product-stats-overlay {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* =========================================
   5. Кнопки та Футер
   ========================================= */
.btn-buy {
    background: var(--ios-text);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

    .btn-buy:active {
        transform: scale(0.95);
        background: #333;
    }

footer {
    padding: 60px 0;
    background: #fff;
    border-top: 0.5px solid rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: var(--ios-accent); /* Синій iOS */
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border: 2px solid white; /* Щоб не зливалося з фоном */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Анімація "стрибка", коли товар додано */
.badge-pop {
    transform: scale(1.4);
}

/* Кнопки по боках */
.btn-stepper {
    width: 36px;
    height: 36px;
    border: none;
    background-color: #ffffff;
    color: #000000;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

    .btn-stepper:active {
        transform: scale(0.9);
        background-color: #f2f2f7;
    }

/* Поле вводу в центрі */
.input-stepper {
    width: 55px;
    height: 36px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

    .input-stepper:focus {
        border-color: #007aff; /* Синій акцент iOS */
    }

    /* Прибираємо стрілочки */
    .input-stepper::-webkit-outer-spin-button,
    .input-stepper::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
