:root {
    --pharmickup-primary: #198754;
    --pharmickup-dark: #18221c;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #f8f9fa;
    color: #212529;
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.04em;
}

.hero {
    background: linear-gradient(135deg, var(--pharmickup-secondary, #146c43), var(--pharmickup-primary, #198754));
    color: white;
    border-radius: 1.5rem;
}

.hero-badge {
    color: white;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.product-card {
    height: 100%;
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
}

.product-image {
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: #eef2ef;
}

.product-category {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.price {
    font-size: 1.15rem;
    font-weight: 800;
}

.cart-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.75rem;
}

.summary-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 0.75rem;
}

.empty-state {
    border: 2px dashed #dee2e6;
    border-radius: 1rem;
}

.pickup-card {
    border: 2px solid #e9ecef;
    border-radius: 1rem;
}

.map-frame {
    width: 100%;
    min-height: 500px;
    border: 0;
    border-radius: 1rem;
}

.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    color: white;
    background: var(--pharmickup-primary);
    border-radius: 50%;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.75rem);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background 0.2s ease;
    z-index: 1030;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    color: white;
    background: #146c43;
}

.site-footer {
    background: var(--pharmickup-dark);
}

@media (max-width: 991.98px) {
    .map-frame {
        min-height: 360px;
    }
}


.brand-mark {
    font-size: 0.85em;
}

.map-frame {
    object-fit: cover;
    background: #eef2ef;
}

.footer-link {
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
}

.footer-link:hover {
    color: white;
}

.footer-cookie-button {
    padding: 0;
    color: rgba(255, 255, 255, 0.72);
    background: transparent;
    border: 0;
    text-decoration: none;
}

.footer-cookie-button:hover {
    color: white;
}

.cookie-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 2000;
}

.cookie-banner[hidden], .cookie-preferences[hidden] {
    display: none !important;
}

.cookie-banner-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 1rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

.cookie-copy {
    flex: 1;
}

.cookie-copy p {
    font-size: 0.92rem;
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.cookie-close {
    position: absolute;
    top: 0.55rem;
    right: 0.7rem;
    padding: 0;
    font-size: 1.7rem;
    line-height: 1;
    color: #6c757d;
    background: transparent;
    border: 0;
}

.cookie-preferences {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.45);
}

.cookie-preferences-card {
    width: min(620px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.28);
}

.cookie-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}

.policy-page {
    max-width: 980px;
}

@media (max-width: 767.98px) {
    .cookie-banner-inner {
        align-items: stretch;
        flex-direction: column;
        padding-top: 2.2rem;
    }

    .cookie-actions {
        justify-content: stretch;
    }

    .cookie-actions .btn {
        flex: 1 1 100%;
    }
}


.icon {
    display: inline-block;
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
}

.icon-sm {
    width: 1rem;
    height: 1rem;
}

.icon-md {
    width: 1.25rem;
    height: 1.25rem;
}

.icon-brand {
    width: 1.45rem;
    height: 1.45rem;
}

.icon-xl {
    width: 3rem;
    height: 3rem;
}

.icon-xxl {
    width: 4.5rem;
    height: 4.5rem;
}

.empty-state-icon {
    line-height: 1;
}

.confirmation-icon {
    line-height: 1;
}

.pickup-card {
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pickup-card:hover {
    border-color: #a7d7ba;
}

.pickup-card.selected {
    border-color: var(--pharmickup-primary);
    background: #f1fbf5;
    box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.08);
}

#pickupMap {
    background: #eef2ef;
}



.real-map {
    position: relative;
    height: 500px;
    min-height: 500px;
    overflow: hidden;
    background: #dce6dc;
    border: 1px solid #dee2e6;
}

.map-tile-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.map-tile {
    position: absolute;
    width: 256px;
    height: 256px;
    max-width: none;
    user-select: none;
    pointer-events: none;
}

.map-marker-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pickup-map-marker {
    position: absolute;
    width: 2.65rem;
    height: 2.65rem;
    padding: 0;
    color: white;
    background: #495057;
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    box-shadow: 0 0.35rem 0.8rem rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -100%) rotate(-45deg);
    pointer-events: auto;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 2;
}

.pickup-map-marker:hover {
    background: #343a40;
    transform: translate(-50%, -100%) rotate(-45deg) scale(1.08);
}

.pickup-map-marker.selected {
    background: var(--pharmickup-primary);
    transform: translate(-50%, -100%) rotate(-45deg) scale(1.1);
}

.map-attribution {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    text-align: right;
}

.map-attribution a {
    color: #6c757d;
    text-decoration: none;
}

.map-attribution a:hover {
    color: var(--pharmickup-primary);
    text-decoration: underline;
}

@media (max-width: 991.98px) {
    .real-map {
        height: 380px;
        min-height: 380px;
    }
}


.pickup-map-shell {
    position: relative;
}

.real-map {
    cursor: grab;
    touch-action: none;
}

.real-map.is-dragging {
    cursor: grabbing;
}

.pickup-map-controls {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    border: 1px solid #adb5bd;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.pickup-map-control {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    color: #212529;
    background: white;
    border: 0;
    border-bottom: 1px solid #dee2e6;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
}

.pickup-map-control:last-child {
    border-bottom: 0;
}

.pickup-map-control:hover {
    color: var(--pharmickup-primary);
    background: #f8f9fa;
}

.pickup-map-control:focus-visible {
    position: relative;
    outline: 3px solid rgba(25, 135, 84, 0.25);
    z-index: 2;
}

.pickup-map-fit {
    font-size: 1.1rem;
}


#searchInput:focus {
    border-color: transparent;
    box-shadow: none;
    outline: none;
}

.hero .input-group:focus-within {
    box-shadow: none;
    outline: none;
}

.cart-toast {
    position: fixed;
    right: 1.25rem;
    bottom: 5.25rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 280px;
    max-width: calc(100vw - 2.5rem);
    padding: 0.9rem 1rem;
    color: #212529;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.85rem;
    box-shadow: 0 0.5rem 1.4rem rgba(0, 0, 0, 0.16);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(0.75rem);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 1060;
}

.cart-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.cart-toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    color: white;
    background: var(--pharmickup-primary);
    border-radius: 50%;
    font-weight: 700;
}

.cart-toast-title {
    font-size: 0.9rem;
    font-weight: 700;
}

.cart-toast-text {
    margin-top: 0.1rem;
    color: #6c757d;
    font-size: 0.82rem;
}

@media (max-width: 575.98px) {
    .cart-toast {
        right: 1rem;
        left: 1rem;
        bottom: 5rem;
        min-width: 0;
        max-width: none;
    }
}

.cart-toast.is-error .cart-toast-icon {
    background: #dc3545;
}

#productsSort {
    min-width: 180px;
}

.site-logo {
    width: auto;
    height: 2.5rem;
    max-width: 180px;
    object-fit: contain;
}

.pickup-list-scroll {
    height: clamp(380px, calc(100vh - 260px), 650px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}

.pickup-list-scroll .pickup-card:last-child {
    margin-bottom: 0 !important;
}

.pickup-list-scroll::-webkit-scrollbar {
    width: 8px;
}

.pickup-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

.pickup-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#pickupListLoader {
    min-height: 48px;
}

.pickup-map-shell {
    position: relative;
    top: auto;
    width: 100%;
    height: clamp(380px, calc(100vh - 260px), 650px);
    isolation: isolate;
}

.real-map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 320px;
    overflow: hidden;
    contain: paint;
}

.map-tile-layer,
.map-marker-layer {
    position: absolute;
    inset: 0;
}

.map-tile-layer {
    z-index: 1;
}

.map-marker-layer {
    z-index: 2;
}

.pickup-map-controls {
    position: absolute;
    z-index: 10;
}

.map-attribution,
#pickupMapCaption,
#pickupMapStatus {
    position: relative;
    z-index: auto;
}

@media (max-width: 991.98px) {
    .pickup-list-scroll {
        height: clamp(360px, 55vh, 520px);
    }

    .pickup-map-shell {
        height: clamp(360px, 55vh, 520px);
    }
}

@media (max-width: 575.98px) {
    .pickup-list-scroll {
        height: clamp(320px, 50vh, 440px);
    }

    .pickup-map-shell {
        height: clamp(320px, 50vh, 440px);
    }
}

.pickup-card-name {
    min-width: 0;
    flex: 1 1 180px;
    overflow-wrap: anywhere;
}

.pickup-distance-badge {
    flex: 0 0 auto;
    max-width: 100%;
    white-space: normal;
    text-align: center;
}

@media (max-width: 575.98px) {
    .pickup-distance-badge {
        font-size: 0.72rem;
    }
}

.pickup-distance-badge {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    text-align: left;
}

.pickup-map-cluster {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--pharmickup-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
    cursor: zoom-in;
    z-index: 3;
}

.pickup-map-cluster:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.pickup-cluster-popup {
    position: absolute;
    width: min(320px, calc(100% - 20px));
    max-height: 360px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    z-index: 30;
    overflow: hidden;
}

.pickup-cluster-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.pickup-cluster-popup-list {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.pickup-cluster-popup-item {
    display: block;
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.pickup-cluster-popup-item:hover {
    background: rgba(0, 0, 0, 0.035);
}

.pickup-cluster-popup-item:last-child {
    border-bottom: 0;
}

.pickup-cluster-popup-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
}

@media (max-width: 575.98px) {
    .pickup-cluster-popup {
        width: calc(100% - 20px);
        max-height: 300px;
    }
}

.pickup-map-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pickup-map-marker-icon {
    display: block;
    width: 20px;
    height: 20px;
    pointer-events: none;
    transform: rotate(45deg);
    transform-origin: center;
}

@media (max-width: 575.98px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .navbar-brand {
        font-size: 1.25rem !important;
        max-width: calc(100% - 1rem);
    }

    .navbar .site-logo {
        height: 2rem;
        max-width: 130px;
    }

    .navbar .btn {
        font-size: 0.85rem;
    }
}

.product-card {
    cursor: pointer;
}

.product-modal-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 0.75rem;
}

.product-modal-image {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
}

.product-modal-description {
    color: #495057;
    line-height: 1.65;
    white-space: pre-line;
}

.product-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-2px);
}

/* Avviso dopo la sezione dei punti di ritiro */
.pickup-warning {
    border-radius: 0.75rem;
    line-height: 1.5;
}

/* ============================================================
   CATALOGO RESPONSIVE
   - Ricerca sempre larga quanto il contenitore, senza pulsante Cerca
   - Categorie scorrevoli orizzontalmente sui telefoni
   - Ordinamento adattivo a schermi piccoli
   Queste regole non toccano mappa, cookie banner o freccia in alto.
   ============================================================ */
.product-search-form { max-width: 790px; }
.product-search-field { position: relative; width: 100%; }
.product-search-field .product-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #495057;
    pointer-events: none;
    z-index: 1;
}
.product-search-field .form-control {
    width: 100%;
    min-height: 3.3rem;
    border: 1px solid rgba(255,255,255,0.55);
    border-radius: 0.95rem;
    padding-left: 3rem;
    padding-right: 1rem;
    background: #fff;
    box-shadow: 0 3px 12px rgba(0,0,0,0.09);
}
.product-search-field .form-control:focus {
    border-color: #146c43;
    box-shadow: 0 0 0 .2rem rgba(255,255,255,.26);
}
.product-sort-form .form-select { min-width: 175px; }
.category-badges { padding-bottom: .25rem; }
.category-badges .btn { white-space: nowrap; }
@media (max-width: 767.98px) {
    .hero { border-radius: 1.1rem; }
    .hero h1 { font-size: clamp(1.75rem, 6vw, 2.4rem); line-height: 1.18; }
    .hero .lead { font-size: 1rem; line-height: 1.5; }
    .category-badges {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .category-badges .btn { flex: 0 0 auto; }
    .product-sort-form { width: 100%; justify-content: space-between; }
    .product-sort-form .form-select { flex: 1; max-width: 280px; min-width: 0; }
    #productsSort { min-width: 0; }
}
@media (max-width: 575.98px) {
    main.container { padding-top: 1.1rem !important; }
    .hero { padding: 1.35rem !important; margin-bottom: 1.5rem !important; }
    .product-search-field .form-control { min-height: 3rem; font-size: 1rem; }
    .category-badges { margin-right: -0.75rem; }
    #productGrid { --bs-gutter-x: 1rem; --bs-gutter-y: 1rem; }
    .product-card .card-body { padding: 1rem !important; }
    .product-card h3 { font-size: 1rem; }
    .product-modal-image-wrapper { min-height: 170px; }
}

/* Contatore pezzi su schede e modal: dimensioni comode anche da mobile. */
.product-quantity {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: stretch;
    gap: .4rem;
    max-width: 240px;
}
.product-quantity .btn { padding: .375rem .25rem; font-size: 1.2rem; }
.product-quantity .form-control { min-width: 0; min-height: 40px; }
/* Nasconde gli spinner nativi: il valore resta modificabile a tastiera. */
.product-quantity input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.product-quantity input[type="number"]::-webkit-inner-spin-button,
.product-quantity input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.product-modal-quantity { max-width: 210px; }
#productGrid[aria-busy="true"] { opacity: .7; }
