/* ═══════════════════════════════════════════
   MAMI BIO MED — Mobile Overrides (≤ 768px)
   ═══════════════════════════════════════════ */

/* ── Fix min-width from style.css ── */
@media (max-width: 768px) {
    .main-page { min-width: 0 !important; }
    .main-page .desktop-content { align-items: stretch !important; }

    /* Product page — force single column on mobile */
    .product-layout,
    .product-skeleton-body {
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    .product-skeleton-body {
        grid-template-columns: unset !important;
    }
    .product-gallery,
    .product-skeleton-gallery {
        position: static !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    /* ════════════════════════════════════════
       HERO — баннеры в один ряд
    ════════════════════════════════════════ */
    .main-page .hero-section {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        padding: 12px 14px 20px !important;
        gap: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .main-page .carousel-huge {
        flex: 1 1 60% !important;
        width: auto !important;
        height: 160px !important;
    }
    .main-page .carousel-medium {
        flex: 1 1 40% !important;
        width: auto !important;
        height: 160px !important;
    }
    .main-page .baner-hover {
        border-radius: 10px !important;
    }
    .main-page .baner {
        width: 100% !important;
        left: 0 !important;
        border-radius: 10px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* ── Banner 1: reposition & resize SUPER SALE text ── */
    .main-page .ribbon,
    .main-page .ribbon-2 { display: none !important; }

    .main-page .baner-s-content {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90% !important;
        gap: 6px !important;
        align-items: center !important;
    }
    .main-page .SUPER-SALE {
        font-size: 9px !important;
        line-height: 1.3 !important;
        white-space: normal !important;
        text-align: center !important;
    }
    .main-page .price {
        padding: 3px 8px !important;
        border-radius: 6px !important;
    }
    .main-page .text-wrapper-9 {
        font-size: 11px !important;
        line-height: 1.2 !important;
        white-space: normal !important;
    }

    /* ── Banner 2: "Новинка дня" ── */
    .main-page .txt {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px !important;
        width: 100% !important;
    }
    .main-page .baner-s-content-2 {
        gap: 4px !important;
        align-items: center !important;
    }
    .main-page .text-wrapper-11 {
        font-size: 11px !important;
        line-height: 1.3 !important;
        white-space: normal !important;
        text-align: center !important;
    }
    .main-page .p { display: none !important; }

    /* ── "Акция" text in section ribbon ── */
    .main-page .rectangle-2 { height: 32px !important; }
    .main-page .text-wrapper-14 { font-size: 10px !important; }
    .main-page .tab-2 { padding: 2px 6px !important; }

    /* ════════════════════════════════════════
       Акции section
    ════════════════════════════════════════ */
    .main-page .section-2 {
        padding: 28px 14px !important;
        gap: 16px !important;
    }
    .main-page .text-wrapper-15 {
        font-size: 20px !important;
    }
}

/* Mobile drawer styles live in header.css — header.css is loaded on every
   page, mobile.css is not. Keeping them there prevents the burger menu
   from rendering unstyled on main/catalog/product pages. */


/* ════════════════════════════════════════
   MOBILE HEADER
════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Preheader & additional menu: hidden ── */
    .main-page .preheader { display: none !important; }
    .main-page .additional-menu { display: none !important; }

    /* ── Main header: compact ── */
    .main-page .main-header-inner {
        height: 56px !important;
        padding: 0 14px !important;
        gap: 8px !important;
        justify-content: flex-start !important;
    }

    /* Logo smaller */
    .main-page .main-header-inner > a > .logo,
    .main-page .main-header-inner .logo {
        height: 32px !important;
        width: auto !important;
    }

    /* Hide search bar + catalog button */
    .main-page .content-2 { display: none !important; }

    /* Show hamburger */
    .mobile-hamburger { display: flex !important; }

    /* Show mobile search icon */
    .mobile-search-icon { display: flex !important; }

    /* Auth: hide text, keep person icon */
    .main-page .auth-buttons .button-4 { display: none !important; }
    .main-page .auth-buttons .button-3 { display: none !important; }
    .main-page .auth-divider { display: none !important; }

    /* Action group: push to right, icons close together */
    .main-page .action {
        margin-left: auto !important;
        gap: 4px !important;
    }

    /* Auth section: no extra margin */
    .main-page .div-2.auth-section { margin-left: 0 !important; }

    /* Person icon: reset margin */
    .main-page .header-person-icon {
        margin-left: 0 !important;
    }

    /* Buttons in action: smaller */
    .main-page .button-2,
    .main-page .button-wrapper { width: 36px !important; height: 36px !important; }
}

/* Hamburger — hidden on desktop */
.mobile-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    background: #f4f6f8;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.mobile-hamburger:hover { background: #eef4ef; color: #005b24; }

/* Mobile search icon — hidden on desktop */
.mobile-search-icon {
    display: none;
    align-items: center;
    justify-content: center;
    background: #f4f6f8;
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.mobile-search-icon:hover { background: #eef4ef; color: #005b24; }

/* ════════════════════════════════════════
   MOBILE FOOTER
════════════════════════════════════════ */
@media (max-width: 768px) {

    /* Email section */
    .main-page .email-section-inner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 20px !important;
        padding: 32px 20px !important;
    }
    .main-page .email-section-inner .div-3 { max-width: 100% !important; }
    .main-page .email-section-inner .text-wrapper-16 { font-size: 22px !important; }
    .main-page .lorem-ipsum-dolor { width: auto !important; }

    .main-page .email-capture {
        width: 100% !important;
        flex-direction: column !important;
    }
    .main-page .input-default { width: 100% !important; }
    .main-page .button-main { width: 100% !important; }

    /* Footer columns */
    .main-page .footer-wrapper-inner { padding: 28px 20px 24px !important; }

    .main-page .content-4 {
        flex-direction: column !important;
        gap: 28px !important;
    }
    .main-page .logoa-nd-contacts { width: 100% !important; }

    .main-page .links {
        flex-direction: column !important;
        gap: 20px !important;
    }
    .main-page .footer-links-column,
    .main-page .footer-links-column-2 {
        width: 100% !important;
    }

    .main-page .section-3 {
        height: auto !important;
        flex-direction: column !important;
        gap: 20px !important;
        flex: none !important;
        width: 100% !important;
    }

    /* Bottom bar */
    .main-page .content-5 {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    /* Footer text smaller */
    .main-page .footer-2 { gap: 28px !important; }
}

@media (max-width: 480px) {
    .main-page .email-section-inner { padding: 24px 16px !important; }
    .main-page .footer-wrapper-inner { padding: 24px 16px 20px !important; }
}

/* ════════════════════════════════════════
   MOBILE SEARCH MODAL
════════════════════════════════════════ */
.mobile-search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1300;
    background: var(--baseblack-500);
    transform: translateY(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
    opacity: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.mobile-search-modal.open {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-search-modal {
        display: flex;
        flex-direction: column;
    }
}

.mobile-search-modal-inner {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    height: 56px;
    gap: 0;
}

.mobile-search-form {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.15s;
}

.mobile-search-form:focus-within {
    border-color: rgba(255, 232, 23, 0.5);
    background: rgba(255, 255, 255, 0.13);
}

.mobile-search-back {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}
.mobile-search-back:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.mobile-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 10px 0;
    min-width: 0;
}
.mobile-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.mobile-search-input::-webkit-search-cancel-button {
    display: none;
}

.mobile-search-submit {
    background: var(--yellow-500, #FFE817);
    border: none;
    color: var(--baseblack-500, #2e2828);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.12s;
}
.mobile-search-submit:hover {
    opacity: 0.9;
    transform: scale(1.05);
}
.mobile-search-submit:active {
    transform: scale(0.96);
}

/* ══════════════════════════════════════
   NEW HEADER — Mobile overrides (≤ 768px)
══════════════════════════════════════ */
@media (max-width: 768px) {
    /* Hide desktop-only chrome */
    .main-page .header-catalog-btn  { display: none !important; }
    .main-page .header-action-label { display: none !important; }
    .main-page .mobile-search-icon  { display: none !important; }

    /* Profile / favorites / cart moved to bottom nav on mobile */
    .main-page .header-actions .header-action-item:not(.mobile-search-icon) {
        display: none !important;
    }
    .main-page .header-actions { display: none !important; }

    /* Header: sticky on mobile so search/menu always reachable */
    .main-page .main-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: #fff;
        box-shadow: 0 1px 0 rgba(15,23,42,0.05);
    }

    /* Two-row header: [hamburger + logo] on top, [search] below */
    .main-page .main-header-inner {
        height: auto !important;
        min-height: 56px;
        padding: 10px 14px 12px !important;
        gap: 10px !important;
        flex-wrap: wrap;
        align-items: center;
    }

    /* Hamburger: clean, no pill bg — pushed to right on mobile */
    .main-page .mobile-hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: none;
        background: transparent;
        border-radius: 10px;
        cursor: pointer;
        color: #1a1a1a;
        flex-shrink: 0;
        transition: background .15s, color .15s;
        padding: 0;
        order: 2;
    }
    .main-page .mobile-hamburger:hover,
    .main-page .mobile-hamburger:active {
        background: #f4f6f8;
        color: #005b24;
    }
    .main-page .mobile-hamburger svg { width: 24px; height: 24px; }

    /* Logo first on mobile */
    .main-page .header-logo-link { flex: 1; min-width: 0; order: 1; }
    .main-page .header-logo-img { width: 150px; height: 40px; }
    .main-page .header-logo-brand { font-size: 14px; }
    .main-page .header-logo-small { font-size: 8px; }

    /* Search bar: always visible, full-width on its own row */
    .main-page .header-search {
        display: flex !important;
        flex: 1 1 100%;
        order: 10;
        min-width: 0;
        background: #f4f6f8;
        border: 1px solid transparent;
        border-radius: 12px;
        padding: 10px 14px;
        gap: 8px;
        margin-top: 4px;
    }
    .main-page .header-search:focus-within {
        background: #fff;
        border-color: #005b24;
    }
    .main-page .header-search-input {
        font-size: 14px;
        font-weight: 500;
    }
    .main-page .header-search-input::placeholder {
        color: #9aa0a6;
        font-weight: 500;
    }

}

@media (max-width: 480px) {
    .main-page .main-header-inner { padding: 8px 12px 10px !important; gap: 8px !important; }
    .main-page .header-logo-img { width: 130px; height: 36px; }
    .main-page .mobile-hamburger { width: 38px; height: 38px; }
    .main-page .header-search { padding: 9px 12px; border-radius: 10px; }
}

@media (max-width: 375px) {
    .main-page .main-header-inner { padding: 6px 10px 10px !important; gap: 6px !important; }
    .main-page .header-logo-img { width: 110px; height: 32px; }
    .main-page .mobile-hamburger { width: 36px; height: 36px; }
    .main-page .mobile-hamburger svg { width: 22px; height: 22px; }
}

/* Стили нижней панели переехали в bottom-nav.css: mobile.css подключён не на
   всех страницах, а панель нужна везде. */

/* Цвет всплывающих окон переехал в mobile-windows.css: этот файл подключён
   не на всех страницах, а окна нужны везде. */

/* ══ Телефон: заголовки и отступы ══════════════════════════════════════════
   Страницы «О нас», «Отзывы о магазине» и «Видео обзоры» собраны на старом
   наборе стилей и не подключают mbm.css, поэтому общий мобильный слой их не
   накрывал — заголовки оставались по 43 пункта, вдвое крупнее, чем на
   остальных страницах. Повторяем те же величины здесь.

   Приоритет намеренный: против этих правил стоят частные настройки разделов
   под широкий экран, а одинаковый заголовок на всех страницах важнее. */
@media (max-width: 560px) {
    main h1 { font-size: 25px !important; line-height: 1.15 !important; }
    main h2 { font-size: 22px !important; line-height: 1.18 !important; }
    main h3 { font-size: 15px !important; line-height: 1.3 !important; }
    main > section:not(.mbm-hero),
    main > div > section:not(.mbm-hero) { padding-block: 16px !important; }
}
