/*
 * Farmacia Mirra — restyle fase 1 (6 ottobre 2026)
 * Caricato dopo style.css. Il CSS aggiuntivo del Customizer (stile "glass", salvato nel database)
 * viene stampato dopo questo file: dove serve le regole usano specificità maggiore e, per le poche
 * dichiarazioni !important del Customizer, !important a loro volta. Nessun colore nuovo: palette
 * navy / teal / oro del tema. Non modifica contenuti, link, loghi, contatti o elementi legali.
 */

/* ---------- Base e rete di sicurezza ---------- */
html, body { overflow-x: clip; }
:root { --fm-header-h: 131px; }

.container { padding-left: 24px; padding-right: 24px; }
@media (max-width: 600px) { .container { padding-left: 16px; padding-right: 16px; } }

:is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

/* ---------- Header ---------- */
body header.site-header {
    background: var(--navy) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 14px rgba(13, 33, 55, 0.22);
}
.header-inner { flex-wrap: nowrap; gap: 20px; padding-top: 12px; padding-bottom: 12px; }
/* style.css azzerava il padding laterale del container in header e barra superiore: lo ripristiniamo. */
.header-inner, .top-bar-inner { padding-left: 24px; padding-right: 24px; }
@media (max-width: 600px) { .header-inner, .top-bar-inner { padding-left: 16px; padding-right: 16px; } }
.site-logo-link { min-width: 0; }
.site-logo-text { min-width: 0; }
.site-logo-text strong { white-space: nowrap; }
.header-search { min-width: 0; }
.header-actions a {
    min-height: 44px;
    padding: 0 8px;
    border-radius: 10px;
}
.header-actions a:hover { background: rgba(255, 255, 255, 0.08); }
.header-actions svg { width: 22px; height: 22px; flex-shrink: 0; }
.cart-count { line-height: 1.5; min-width: 22px; text-align: center; }
.menu-toggle { min-height: 44px; font-weight: 600; font-family: var(--font-body); }

/* Voci di menu: area di tocco adeguata, dropdown anche da tastiera */
.main-nav .category-menu > li > a { padding: 9px 14px; }
.main-nav .category-menu > li.has-children:focus-within .sub-menu { display: block; }
.main-nav .submenu-toggle { display: none; }

@media (max-width: 860px) {
    .header-inner { flex-wrap: wrap; gap: 10px 8px; padding-top: 10px; padding-bottom: 12px; }
    .site-logo-link { order: 1; flex: 1 1 0; min-width: 0; gap: 10px; }
    .site-logo-mark { width: 40px; height: 40px; }
    .site-logo-text strong { font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; }
    .site-logo-text span { font-size: 0.62rem; letter-spacing: 1.6px; }
    .header-actions { order: 2; gap: 2px; margin-left: auto; }
    .header-actions .only-desktop { display: none; }
    .header-actions a { position: relative; width: 44px; padding: 0; justify-content: center; }
    .header-actions .cart-count { position: absolute; top: 2px; right: -2px; padding: 0 5px; font-size: 0.66rem; }
    .menu-toggle { display: inline-flex; align-items: center; margin-left: 6px; padding: 0 14px; }
    .header-search { display: block; order: 3; flex: 1 1 100%; max-width: none; }
    .header-search form { width: 100%; }
    .header-search input[type="search"] { min-width: 0; min-height: 44px; font-size: 16px; }
    .header-search button { min-height: 44px; padding: 0 18px; }

    .main-nav.is-open { display: block; max-height: calc(100vh - 150px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .main-nav .category-menu { flex-direction: column; gap: 0; padding: 8px 0 14px; flex-wrap: nowrap; }
    .main-nav .category-menu > li { display: flex; flex-wrap: wrap; align-items: center; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
    .main-nav .category-menu > li > a { flex: 1 1 0; min-height: 46px; display: flex; align-items: center; border-radius: 0; padding: 10px 4px; font-size: 0.95rem; }
    .main-nav .submenu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 46px; height: 46px; flex: 0 0 46px;
        background: none; border: 0; color: var(--gold-light);
        font-size: 1.4rem; line-height: 1; cursor: pointer;
    }
    .main-nav .category-menu .sub-menu {
        display: none; position: static; flex: 1 1 100%; min-width: 0;
        background: transparent; box-shadow: none; border: 0;
        border-left: 2px solid var(--gold); margin: 0 0 10px 6px; padding: 2px 0;
    }
    .main-nav .category-menu li.is-expanded > .sub-menu { display: block; }
    .main-nav .category-menu .sub-menu a { color: rgba(255, 255, 255, 0.88); padding: 11px 14px; min-height: 44px; display: flex; align-items: center; }
    .main-nav .category-menu .sub-menu a:hover { background: rgba(255, 255, 255, 0.08); color: var(--gold-light); }
}
/* Schermi stretti (320-400 px): il nome del negozio deve restare per intero, senza puntini. */
@media (max-width: 400px) {
    .header-inner { gap: 8px 2px; }
    .site-logo-link { gap: 8px; }
    .site-logo-mark { width: 36px; height: 36px; }
    .site-logo-text strong { font-size: 1rem; overflow: visible; text-overflow: clip; }
    .site-logo-text span { font-size: 0.58rem; letter-spacing: 1.2px; }
    .header-actions a { width: 40px; }
    .menu-toggle { margin-left: 2px; padding: 0 10px; font-size: 0.82rem; }
}
@media (max-width: 360px) {
    .site-logo-text strong { font-size: 0.95rem; }
    .header-actions a { width: 38px; }
    /* Pulsante Menu a sola icona (il nome accessibile resta "Menu" via aria-label). */
    .menu-toggle { position: relative; width: 42px; padding: 0; font-size: 0; }
    .menu-toggle::before {
        content: ""; position: absolute; left: 11px; right: 11px; top: 50%; height: 2px;
        background: var(--white); box-shadow: 0 -6px 0 var(--white), 0 6px 0 var(--white); transform: translateY(-1px);
    }
}

/* ---------- Layout catalogo con categorie ---------- */
.shop-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 32px; align-items: start; }
.shop-main { min-width: 0; }
.shop-section { padding-top: 24px; padding-bottom: 16px; }
.site-footer { margin-top: 44px; }

.shop-cats {
    position: sticky;
    top: calc(var(--fm-header-h) + 16px);
    max-height: calc(100vh - var(--fm-header-h) - 32px);
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    box-shadow: var(--shadow-sm);
}
.shop-cats-title {
    margin: 0 8px 10px;
    font-family: var(--font-body);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--teal);
}
.shop-cats ul { list-style: none; margin: 0; padding: 0; }
.shop-cats a {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--ink); font-size: 0.9rem; font-weight: 500; line-height: 1.3;
}
.shop-cats a:hover { background: var(--cream); color: var(--teal); }
.shop-cats .count {
    flex-shrink: 0; min-width: 28px; text-align: center;
    background: var(--cream); color: var(--gray);
    border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; font-weight: 600;
}
.shop-cats li.is-branch > a { color: var(--navy); font-weight: 700; }
.shop-cats li.is-current > a { background: var(--teal); color: var(--white); }
.shop-cats li.is-current > a .count { background: rgba(255, 255, 255, 0.22); color: var(--white); }
.shop-cats .shop-cats-all-list { margin-bottom: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.shop-cats .shop-cats-sub { margin: 2px 0 8px 12px; padding-left: 8px; border-left: 2px solid var(--gold); }
.shop-cats .shop-cats-sub a { font-size: 0.86rem; padding: 7px 10px; }
.shop-cats-chips { display: none; }

@media (max-width: 860px) {
    .shop-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .shop-cats { position: static; max-height: none; overflow: visible; background: none; border: 0; padding: 0; box-shadow: none; }
    .shop-cats-title, .shop-cats-tree { display: none; }
    .shop-cats-chips { display: block; }
    .shop-cats .chips-row {
        display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px;
        scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
    }
    .shop-cats .chips-row li { flex: 0 0 auto; scroll-snap-align: start; }
    .shop-cats .chips-row a {
        display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px;
        background: var(--white); border: 1px solid var(--border); border-radius: 999px;
        font-size: 0.88rem; font-weight: 600; color: var(--navy); white-space: nowrap;
    }
    .shop-cats .chips-row li.is-current a { background: var(--teal); border-color: var(--teal); color: var(--white); }
    .shop-cats .chips-sub a { min-height: 38px; font-size: 0.82rem; background: var(--cream); }
    .shop-cats .chips-sub li.is-current a { background: var(--navy); border-color: var(--navy); }
}

/* ---------- Intestazione archivio, ordinamento, paginazione ---------- */
.shop-main .woocommerce-products-header { margin: 0 0 6px; }
.shop-main .woocommerce-products-header__title,
.shop-main .page-title { font-size: 1.9rem; margin: 0 0 6px; }
.woocommerce-result-count { float: left; margin: 10px 0 18px; line-height: 40px; }
.woocommerce-ordering { float: right; margin: 0 0 18px; }
.woocommerce-ordering select { min-height: 40px; max-width: 100%; }
.shop-main ul.products { clear: both; }
@media (max-width: 600px) {
    .woocommerce-result-count { float: none; margin: 4px 0 8px; line-height: 1.4; }
    .woocommerce-ordering { float: none; margin: 0 0 16px; }
    .woocommerce-ordering select { width: 100%; }
}

body nav.woocommerce-pagination {
    display: block; clear: both; margin: 32px 0 8px; padding: 0;
    background: none; border: 0; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none; text-align: center;
}
body nav.woocommerce-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; border: 0; }
body nav.woocommerce-pagination ul li { border: 0; float: none; overflow: visible; }
body nav.woocommerce-pagination a,
body nav.woocommerce-pagination span {
    min-width: 42px; height: 42px; padding: 0 10px; background: var(--white);
}
body nav.woocommerce-pagination .current { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------- Griglia e schede prodotto (negozio e home) ---------- */
body ul.products.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch;
}
/* Il clearfix di WooCommerce diventava una cella vuota della griglia (grande spazio a sinistra). */
body ul.products.products::before,
body ul.products.products::after { content: none !important; display: none !important; }

body .shop-main ul.products.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 1100px) {
    body ul.products.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    body .shop-main ul.products.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 860px) {
    body ul.products.products,
    body .shop-main ul.products.products { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 700px) {
    body ul.products.products,
    body .shop-main ul.products.products { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
}
@media (max-width: 340px) {
    body ul.products.products,
    body .shop-main ul.products.products { grid-template-columns: minmax(0, 1fr) !important; }
}

body ul.products.products li.product {
    display: flex !important;
    flex-direction: column;
    height: 100%;
    padding: 0 !important;
    background: var(--white) !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}
body ul.products.products li.product:hover { box-shadow: var(--shadow-md) !important; transform: translateY(-2px); }

body ul.products.products li.product > a.woocommerce-LoopProduct-link {
    display: flex; flex-direction: column; flex: 1 1 auto; color: inherit;
}
body ul.products.products li.product a img {
    width: 100% !important; height: auto !important; max-width: none !important;
    aspect-ratio: 1 / 1; object-fit: contain;
    padding: 12px; margin: 0;
    background: var(--white);
    border: 0 !important; border-bottom: 1px solid var(--cream) !important; border-radius: 0 !important;
}
body ul.products.products li.product .woocommerce-loop-product__title {
    font-family: var(--font-body);
    font-size: 0.92rem; font-weight: 600; line-height: 1.35; color: var(--navy);
    margin: 12px 0 6px; padding: 0 14px;
    min-height: calc(1.35em * 3);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
    overflow-wrap: anywhere;
}
body ul.products.products li.product .price {
    display: block; margin-top: auto; padding: 4px 14px 12px !important;
    font-size: 1.02rem; font-weight: 700; color: var(--teal) !important;
}
body ul.products.products li.product .price del { font-weight: 400; opacity: 0.65; margin-right: 4px; }
body ul.products.products li.product .price ins { text-decoration: none; }
body ul.products.products li.product .button,
body ul.products.products li.product a.added_to_cart {
    display: flex; align-items: center; justify-content: center;
    min-height: 44px; margin: 0 14px 14px !important; padding: 8px 12px !important;
    font-size: 0.85rem; line-height: 1.2; text-align: center;
}
body ul.products.products li.product a.added_to_cart { margin-top: -6px !important; background: var(--teal); }
@media (max-width: 700px) {
    body ul.products.products li.product .woocommerce-loop-product__title { font-size: 0.84rem; padding: 0 10px; }
    body ul.products.products li.product .price { padding: 2px 10px 10px !important; font-size: 0.95rem; }
    body ul.products.products li.product .button,
    body ul.products.products li.product a.added_to_cart { margin: 0 10px 10px !important; font-size: 0.8rem; }
    body ul.products.products li.product a img { padding: 8px; }
}

/* ---------- Elementi legali ---------- */
/* Il logo del Ministero (mu-plugin) resta invariato: solo allineamento al centro. */
body > div a[href*="VOLID=F12212"] img { margin-left: auto; margin-right: auto; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
    body ul.products.products li.product:hover { transform: none; }
}
