/* РОДНЫЕ НАСТРОЙКИ СРЕДЫ iOS С КРАСНЫМ АКЦЕНТОМ */
:root {
    --ios-bg: #F4F4F9;                         
    --ios-card: rgba(255, 255, 255, 0.8);     
    --ios-text: #1C1C1E;
    --ios-secondary: #8E8E93;
    --ios-accent-blue: #007AFF;                
    --ios-accent-red: #FF3B30;                 
    --ios-gray-light: rgba(60, 60, 67, 0.08);
    --sf-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.01);
    --sheet-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--sf-font);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--ios-bg);
    color: var(--ios-text);
    padding-bottom: 60px;
    overflow-x: hidden;
    position: relative;
}

/* КРАСИВЫЕ ВИЗУАЛЬНЫЕ УЗОРЫ НА ФОНЕ */
.bg-pattern {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    z-index: -1;
    opacity: 0.55;
    pointer-events: none;
}
.pattern-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255,59,48,0.12) 0%, rgba(255,255,255,0) 70%);
    top: -50px;
    right: -100px;
}
.pattern-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0,122,255,0.08) 0%, rgba(255,255,255,0) 70%);
    bottom: 10%;
    left: -150px;
}

/* СТЕКЛЯННАЯ НАВИГАЦИЯ (Glassmorphism) */
header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.15);
    z-index: 1000;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.7px;
    color: #000000;
}
.logo span, .hero h1 span {
    color: var(--ios-accent-red);
    text-shadow: 0 0 15px rgba(255, 59, 48, 0.2); 
}

.cart-btn {
    background: transparent;
    border: none;
    color: var(--ios-accent-blue);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-count {
    background: var(--ios-accent-blue);
    color: #FFFFFF;
    padding: 2px 8px;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
}

/* КОНТЕНТ */
main {
    max-width: 500px; /* Сузили контентную область для идеального мобильного вида */
    margin: 0 auto;
    padding: 16px;
}

.hero {
    margin: 24px 0 28px 0;
}
.hero h1 {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1.2px;
    line-height: 1.1;
    margin-bottom: 8px;
}
.hero p {
    color: var(--ios-secondary);
    font-size: 15px;
    line-height: 1.4;
}

/* СЕГМЕНТНЫЙ ПЕРЕКЛЮЧАТЕЛЬ */
.segmented-control {
    display: flex;
    background: rgba(118, 118, 128, 0.09);
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 26px;
    gap: 2px;
}

.segment-item {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 500;
    color: #3A3A3C;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segment-item.active {
    background: #FFFFFF;
    box-shadow: 0px 3px 8px rgba(0, 0, 0, 0.04);
    font-weight: 600;
    color: #000000;
}

.section-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: -0.4px;
}

.grid-products {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ПОЛУСТЕКЛЯННЫЕ КАРТОЧКИ ТОВАРОВ */
.product-card {
    background: var(--ios-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column; /* Изменили на column, чтобы фото было сверху контента */
    align-items: stretch;
    gap: 12px;
}

.card-meta {
    font-size: 11px;
    font-weight: 600;
    color: var(--ios-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.card-price {
    font-size: 14px;
    color: var(--ios-secondary);
    margin-top: 3px;
}

/* НЕЖНО-СТЕКЛЯННЫЕ КНОПКИ ЗАКАЗА (Frosted Glass) */
.btn-order {
    background: rgba(0, 122, 255, 0.06);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 122, 255, 0.12);
    color: var(--ios-accent-blue);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-order:hover {
    background: rgba(0, 122, 255, 0.1);
    border-color: rgba(0, 122, 255, 0.25);
}

.btn-order:active {
    transform: scale(0.95);
    background: rgba(0, 122, 255, 0.18);
}

/* СТИЛИ ДЛЯ КАРТИНОК В КАТАЛОГЕ (ExpressGo Фото-модуль) */
.product-card-img-container {
    width: 100%;
    height: 180px; /* Высота миниатюры фото */
    overflow: hidden;
    border-radius: 10px;
    background: #f2f2f7;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- СТИЛИ ДЛЯ КОМПАКТНОГО МОДАЛЬНОГО ОКНА ПРОСМОТРА ФОТО (iOS STYLE) --- */

/* Задний размытый фон */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4); /* Полупрозрачное затемнение */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeInOverlayCustom 0.25s ease forwards;
}

/* Основной контейнер всплывающей карточки */
.image-modal-container {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 100%;
    max-width: 360px; /* Компактная ширина как на картинке */
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    transform: scale(0.9) translateY(15px);
    animation: zoomInContainerCustom 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Кнопка закрытия Х в верхнем правом углу карточки */
.image-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: rgba(118, 118, 128, 0.15);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    color: #3C3C43;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    font-weight: bold;
    transition: background 0.2s ease;
}
.image-modal-close:active {
    background: rgba(118, 118, 128, 0.3);
}

/* Ограничивающий контейнер для самого фото */
.image-modal-wrapper {
    width: 100%;
    height: 280px; /* Фиксированная высота для фото в превью */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 14px;
    background: transparent;
}

/* Сама картинка внутри модального окна */
.image-modal-wrapper img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* Текстовая подпись внизу окна */
.image-modal-caption {
    font-size: 13px;
    font-weight: 600;
    color: #1C1C1E;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 4px;
}

/* Анимации появления */
@keyframes fadeInOverlayCustom {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomInContainerCustom {
    to { transform: scale(1) translateY(0); }
}

/* Стили плавного скрытия при закрытии */
.image-modal-overlay.closing {
    opacity: 0;
    transition: opacity 0.2s ease;
}
.image-modal-overlay.closing .image-modal-container {
    transform: scale(0.92) translateY(10px);
    transition: transform 0.2s ease;
}

/* АДАПТИВНАЯ МОДЫ ОКОН (ШТОРКА НА ОСТРОВЕ НА ПК / ПОЛНОЭКРАННАЯ ШТОРКА НА МОБИЛКАХ) */
.ios-sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: flex-end; /* По умолчанию снизу для телефонов */
}

.ios-sheet {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    width: 100%;
    max-width: 480px; /* Ограничили ширину, чтобы форма не расползалась */
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 16px 24px 34px 24px;
    box-shadow: var(--sheet-shadow);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

/* Индикатор свайпа для mobile устройств */
.ios-sheet::before {
    content: '';
    display: block;
    width: 40px;
    height: 5px;
    background: #000000;
    opacity: 0.12;
    border-radius: 3px;
    margin: 0 auto 18px auto;
}

/* Стили для ПК-версии (превращаем в аккуратное окно по центру) */
@media (min-width: 600px) {
    .ios-sheet-overlay {
        align-items: center; /* Центрируем по вертикали на мониторах */
    }
    .ios-sheet {
        border-radius: 24px; /* Круглые углы со всех сторон на ПК */
        transform: scale(0.9) translateY(30px);
        opacity: 0;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    }
    .ios-sheet-overlay.active .ios-sheet {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    .ios-sheet::before {
        display: none; /* Прячем мобильный индикатор свайпа на ПК */
    }
}

.ios-sheet-overlay.active { display: flex; }
/* Для мобилок оставляем translateY анимацию */
@media (max-width: 599px) {
    .ios-sheet-overlay.active .ios-sheet { transform: translateY(0); }
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.sheet-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.btn-close {
    background: rgba(118, 118, 128, 0.08);
    border: none;
    color: #000000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ТАБЛИЧНЫЕ ПОЛЯ ВВОДА ПО СТАНДАРТУ APPLE */
.input-group {
    border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
    padding: 12px 0;
}

.input-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ios-secondary);
    margin-bottom: 4px;
}

.ios-field {
    width: 100%;
    background: transparent;
    border: none;
    padding: 4px 0;
    font-size: 17px;
    color: var(--ios-text);
    outline: none;
}

select.ios-field {
    color: var(--ios-accent-blue);
    font-weight: 600;
}

.checkout-summary {
    margin-top: 24px;
    padding: 12px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 17px;
}

.summary-info {
    color: var(--ios-secondary);
    font-size: 12px;
    display: block;
    margin-top: 10px;
    line-height: 1.4;
}

/* СИСТЕМНАЯ КНОПКА КРАСИВОГО СИНЕГО ЦВЕТА */
.btn-submit {
    width: 100%;
    background: var(--ios-accent-blue);
    color: #FFFFFF;
    border: none;
    padding: 15px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.25);
    transition: all 0.15s ease;
}

.btn-submit:active {
    opacity: 0.7;
    transform: scale(0.99);
}