/**
 * EM Strutture — Frontend Styles (Mobile-First)
 *
 * Styles for the [em_strutture] shortcode: search bar, filter chips,
 * structure cards, Leaflet map, mobile FAB/overlay, and responsive layout.
 *
 * All selectors scoped under .em-strutture to avoid Elementor conflicts.
 *
 * @package EM_Strutture
 * @since   1.0.0
 */

/* =================================================================
   CSS Variables
   ================================================================= */

.em-strutture {
    /* Colori */
    --em-primary: var(--em-admin-primary, #E53935);
    --em-text: var(--em-admin-text, #1a1a1a);
    --em-text-secondary: var(--em-admin-text-secondary, #666666);
    --em-border: var(--em-admin-border, rgba(0, 0, 0, 0.08));
    --em-bg: var(--em-admin-bg, #ffffff);
    --em-bg-hover: var(--em-admin-bg-hover, #f8f9fa);
    --em-ospedaliera: var(--em-admin-ospedaliera, #C0392B);
    --em-convenzionata: var(--em-admin-convenzionata, #1D7874);
    --em-ambulatorio: var(--em-admin-ambulatorio, #2471A3);

    /* Tipografia */
    --em-font-family: var(--em-admin-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    --em-font-size-base: var(--em-admin-font-size-base, 14px);
    --em-font-weight-normal: var(--em-admin-font-weight-normal, 400);
    --em-font-weight-bold: var(--em-admin-font-weight-bold, 700);

    /* Bordi */
    --em-border-width: var(--em-admin-border-width, 1.5px);
    --em-radius: var(--em-admin-radius-base, 12px);
    --em-radius-pill: var(--em-admin-radius-pill, 24px);
    --em-radius-card-icon: var(--em-admin-radius-card-icon, 12px);
    --em-radius-lg: calc(var(--em-radius) + 4px);

    /* Ombre — default (medium), overridden by data-shadow attribute */
    --em-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --em-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);

    /* Spaziatura */
    --em-card-padding-v: var(--em-admin-card-padding-v, 16px);
    --em-card-padding-h: var(--em-admin-card-padding-h, 20px);
    --em-card-gap: var(--em-admin-card-gap, 12px);

    /* Layout */
    --em-map-height-desktop: var(--em-admin-map-height-desktop, 560px);

    --em-transition: 0.2s ease;
}

/* Shadow intensity variants */
.em-strutture[data-shadow="none"]   { --em-shadow: none; --em-shadow-lg: none; }
.em-strutture[data-shadow="subtle"] { --em-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); --em-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08); }
.em-strutture[data-shadow="medium"] { --em-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); --em-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12); }
.em-strutture[data-shadow="strong"] { --em-shadow: 0 2px 6px rgba(0, 0, 0, 0.1); --em-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.18); }

/* =================================================================
   Reset (scoped) — aggressive override for Elementor / theme compat
   ================================================================= */

.em-strutture,
.em-strutture *,
.em-strutture *::before,
.em-strutture *::after {
    box-sizing: border-box !important;
}

.em-strutture {
    font-family: var(--em-font-family) !important;
    font-size: var(--em-font-size-base) !important;
    line-height: 1.5 !important;
    color: var(--em-text) !important;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.em-strutture input,
.em-strutture select,
.em-strutture button {
    font-family: inherit !important;
    font-size: var(--em-font-size-base) !important;
    line-height: 1.5 !important;
    color: inherit;
    margin: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.em-strutture input[type="text"] {
    height: auto !important;
    min-height: 0 !important;
}

.em-strutture a {
    text-decoration: none !important;
}

.em-strutture button {
    cursor: pointer;
    border: 0 !important;
    background: transparent;
    padding: 0;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal;
}

/* =================================================================
   Keyframes
   ================================================================= */

@keyframes em-fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes em-spin {
    to { transform: rotate(360deg); }
}

@keyframes em-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.15); }
}

/* =================================================================
   Search bar
   ================================================================= */

.em-strutture__search {
    position: relative;
    margin-bottom: 12px;
}

.em-strutture__search-icon {
    position: absolute !important;
    left: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2;
    color: var(--em-text-secondary);
    pointer-events: none;
}

.em-strutture .em-strutture__search-input {
    width: 100% !important;
    padding: 12px 44px 12px 48px !important;
    border: var(--em-border-width) solid var(--em-border) !important;
    border-radius: var(--em-radius) !important;
    background: var(--em-bg) !important;
    box-shadow: none !important;
    outline: none !important;
    transition: border-color var(--em-transition), box-shadow var(--em-transition);
}

.em-strutture .em-strutture__search-input::placeholder {
    color: var(--em-text-secondary) !important;
}

.em-strutture .em-strutture__search-input:focus {
    border-color: var(--em-primary) !important;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--em-primary) 10%, transparent) !important;
}

.em-strutture__search-clear {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2;
    color: var(--em-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background var(--em-transition), color var(--em-transition);
}

.em-strutture__search-clear:hover {
    background: var(--em-bg-hover);
    color: var(--em-text);
}

/* =================================================================
   Filter chips
   ================================================================= */

.em-strutture__filters {
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.em-strutture__filters::-webkit-scrollbar {
    display: none;
}

.em-strutture__filters-scroll {
    display: flex;
    gap: 8px;
    white-space: nowrap;
    padding-bottom: 2px;
}

.em-strutture__chip-group {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.em-strutture__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--em-radius-pill);
    font-size: calc(var(--em-font-size-base) - 1px);
    font-weight: var(--em-font-weight-normal);
    white-space: nowrap;
    background: var(--em-bg);
    border: var(--em-border-width) solid var(--em-border);
    color: var(--em-text);
    transition: all var(--em-transition);
    user-select: none;
}

.em-strutture__chip:hover {
    border-color: rgba(0, 0, 0, 0.15);
    background: var(--em-bg-hover);
}

.em-strutture__chip--active,
.em-strutture__chip.em-strutture__chip--active:hover {
    background: var(--em-primary);
    color: #fff;
    border-color: transparent;
}

.em-strutture__chip--reset {
    color: var(--em-primary);
    font-weight: var(--em-font-weight-bold);
}

.em-strutture__chip--reset:hover {
    background: rgba(229, 57, 53, 0.06);
    background: color-mix(in srgb, var(--em-primary) 6%, transparent);
    border-color: var(--em-primary);
}

.em-strutture__select {
    padding: 8px 32px 8px 14px;
    border-radius: var(--em-radius-pill);
    font-size: calc(var(--em-font-size-base) - 1px);
    font-weight: var(--em-font-weight-normal);
    background: var(--em-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: var(--em-border-width) solid var(--em-border);
    color: var(--em-text);
    cursor: pointer;
    transition: all var(--em-transition);
    max-width: 200px;
    text-overflow: ellipsis;
}

.em-strutture__select:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

.em-strutture__select:focus {
    border-color: var(--em-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--em-primary) 10%, transparent);
}

/* =================================================================
   Novità
   ================================================================= */

.em-strutture {
    --em-novita: var(--em-admin-novita-color, #FF6B00);
}

/* Novità chip — same base style as other chips, distinctive only when active */
.em-strutture__chip--novita svg {
    color: var(--em-novita) !important;
    stroke: var(--em-novita) !important;
}

.em-strutture__chip--novita:hover {
    border-color: var(--em-novita) !important;
    background: rgba(255, 107, 0, 0.06) !important;
    background: color-mix(in srgb, var(--em-novita) 6%, transparent) !important;
}

.em-strutture__chip--novita.em-strutture__chip--active,
.em-strutture__chip--novita.em-strutture__chip--active:hover {
    background: var(--em-novita) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.em-strutture__chip--novita.em-strutture__chip--active svg {
    color: #fff !important;
    stroke: #fff !important;
}

/* Novità badge on cards */
.em-strutture__badge--novita {
    background: var(--em-novita) !important;
    color: #fff !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 3px !important;
}

/* Hide novità chip group when no novità (JS adds hidden) */
.em-strutture__chip-group--novita[hidden] {
    display: none !important;
}

/* =================================================================
   Results count
   ================================================================= */

.em-strutture__count {
    font-size: calc(var(--em-font-size-base) - 1px);
    color: var(--em-text-secondary);
    margin-bottom: 8px;
    min-height: 20px;
}

/* =================================================================
   Layout — mobile base (list-first)
   ================================================================= */

.em-strutture__layout {
    position: relative;
}

/* Mobile: list is the default view, map hidden */
.em-strutture__list {
    display: block !important;
    background: var(--em-bg);
}

.em-strutture__map-wrap {
    display: none;
    position: relative;
}

.em-strutture__map {
    width: 100%;
    height: 100%;
}

/* =================================================================
   Loading state
   ================================================================= */

.em-strutture__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--em-text-secondary);
    font-size: var(--em-font-size-base);
}

.em-strutture__spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid var(--em-border);
    border-top-color: var(--em-primary);
    border-radius: 50%;
    animation: em-spin 0.7s linear infinite;
}

/* =================================================================
   Cards
   ================================================================= */

.em-strutture .em-strutture__card {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: var(--em-card-gap) !important;
    padding: var(--em-card-padding-v) var(--em-card-padding-h) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
    border-left: 3px solid transparent !important;
    cursor: pointer !important;
    transition: background var(--em-transition) !important;
    background: transparent !important;
    animation: em-fadeIn 0.3s ease both;
}

.em-strutture .em-strutture__card:hover {
    background: var(--em-bg-hover) !important;
}

.em-strutture .em-strutture__card.em-strutture__card--active {
    border-left-color: var(--em-primary) !important;
    background: rgba(229, 57, 53, 0.04) !important;
    background: color-mix(in srgb, var(--em-primary) 4%, transparent) !important;
}

.em-strutture .em-strutture__card-icon {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: var(--em-radius-card-icon) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: var(--em-font-size-base) !important;
    font-weight: var(--em-font-weight-bold) !important;
    flex-shrink: 0 !important;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.em-strutture .em-strutture__card-body {
    flex: 1 !important;
    min-width: 0 !important;
}

.em-strutture .em-strutture__card-name {
    font-size: calc(var(--em-font-size-base) + 2px) !important;
    font-weight: var(--em-font-weight-bold) !important;
    color: var(--em-text) !important;
    line-height: 1.3 !important;
    margin-bottom: 4px !important;
    display: block !important;
    word-break: break-word;
}

.em-strutture .em-strutture__card-address {
    font-size: calc(var(--em-font-size-base) - 1px) !important;
    color: var(--em-text-secondary) !important;
    margin-bottom: 8px !important;
    display: flex !important;
    align-items: flex-start !important;
    gap: 4px !important;
    line-height: 1.4;
}

.em-strutture .em-strutture__card-address svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--em-primary);
}

.em-strutture .em-strutture__card-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
}

.em-strutture .em-strutture__badge {
    display: inline-block !important;
    font-size: calc(var(--em-font-size-base) - 3px) !important;
    font-weight: var(--em-font-weight-bold) !important;
    padding: 3px 10px !important;
    border-radius: calc(var(--em-radius-pill) - 4px) !important;
    white-space: nowrap;
    letter-spacing: 0.2px;
    line-height: 1.4 !important;
}

.em-strutture .em-strutture__badge--tipo {
    color: #fff !important;
}

.em-strutture .em-strutture__badge--spec {
    background: var(--em-bg-hover) !important;
    color: var(--em-text-secondary) !important;
}

.em-strutture .em-strutture__badge--zona {
    background: transparent !important;
    color: var(--em-text-secondary) !important;
    border: 1px solid var(--em-border) !important;
}

.em-strutture .em-strutture__card-contacts {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    font-size: calc(var(--em-font-size-base) - 1px) !important;
}

.em-strutture .em-strutture__card-contacts a {
    color: var(--em-primary) !important;
    font-weight: var(--em-font-weight-bold) !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    transition: opacity var(--em-transition);
}

.em-strutture .em-strutture__card-contacts a:hover {
    opacity: 0.75;
}

.em-strutture .em-strutture__card-contacts svg {
    flex-shrink: 0;
}

.em-strutture__card-price {
    font-weight: var(--em-font-weight-bold);
    font-size: calc(var(--em-font-size-base) + 1px);
    color: var(--em-text);
}

.em-strutture .em-strutture__nav-btn {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: var(--em-radius) !important;
    background: var(--em-primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3) !important;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--em-primary) 30%, transparent) !important;
    transition: opacity var(--em-transition), transform var(--em-transition);
    padding: 0 !important;
    align-self: flex-start;
    margin-top: 2px;
    color: #ffffff !important;
    font-size: 0 !important; /* hide any text overflow */
}

.em-strutture .em-strutture__nav-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.em-strutture .em-strutture__nav-btn:active {
    transform: scale(0.95);
}

.em-strutture .em-strutture__nav-btn svg {
    stroke: #ffffff !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
}

.em-strutture .em-strutture__nav-btn * {
    color: #ffffff !important;
}

/* =================================================================
   Load more
   ================================================================= */

.em-strutture__load-more-wrap {
    text-align: center;
    padding: 12px 0;
}

.em-strutture__load-more {
    padding: 10px 28px;
    border-radius: var(--em-radius-pill);
    font-weight: var(--em-font-weight-bold);
    font-size: var(--em-font-size-base);
    background: var(--em-bg);
    border: var(--em-border-width) solid var(--em-primary);
    color: var(--em-primary);
    transition: all var(--em-transition);
}

.em-strutture__load-more:hover {
    background: var(--em-primary);
    color: #fff;
}

/* =================================================================
   Mobile FAB "Mappa" button
   ================================================================= */

.em-strutture__fab {
    position: fixed !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 1000 !important;
    padding: 14px 28px !important;
    border-radius: 28px !important;
    background: var(--em-text) !important;
    color: #fff !important;
    font-size: calc(var(--em-font-size-base) + 1px) !important;
    font-weight: var(--em-font-weight-bold) !important;
    border: none !important;
    box-shadow: var(--em-shadow-lg) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit !important;
    line-height: 1.4 !important;
}

.em-strutture__fab:active {
    transform: translateX(-50%) scale(0.95) !important;
}

/* Hide FAB when map overlay is open */
.em-strutture--map-open .em-strutture__fab {
    display: none !important;
}

/* =================================================================
   Fullscreen map overlay (mobile)
   ================================================================= */

.em-strutture__map-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: var(--em-bg);
}

.em-strutture--map-open .em-strutture__map-overlay {
    display: block !important;
}

.em-strutture__map-overlay .em-strutture__map-slot {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Force map dimensions when inside the overlay */
.em-strutture__map-overlay .em-strutture__map-wrap {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

.em-strutture__map-overlay #em-strutture-map {
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
}

/* Filters bar and close button: fixed over the map */
.em-strutture--map-open .em-strutture__map-filters-bar {
    position: fixed !important;
    z-index: 10001 !important;
}

.em-strutture--map-open .em-strutture__map-close {
    position: fixed !important;
    z-index: 10001 !important;
}

/* Active filters bar on top of map overlay */
.em-strutture__map-filters-bar {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    right: 12px !important;
    z-index: 10000 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: var(--em-radius) !important;
    padding: 10px 14px !important;
    box-shadow: var(--em-shadow) !important;
    font-size: calc(var(--em-font-size-base) - 1px) !important;
    font-weight: var(--em-font-weight-normal) !important;
    color: var(--em-text-secondary) !important;
    display: none;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Show filters bar only when it has content (JS adds children) */
.em-strutture__map-filters-bar:not(:empty) {
    display: flex !important;
}

/* Close / back-to-list button on map overlay */
.em-strutture__map-close {
    position: absolute !important;
    bottom: 24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10000 !important;
    padding: 14px 28px !important;
    border-radius: 28px !important;
    background: var(--em-bg) !important;
    color: var(--em-text) !important;
    font-size: calc(var(--em-font-size-base) + 1px) !important;
    font-weight: var(--em-font-weight-bold) !important;
    border: none !important;
    box-shadow: var(--em-shadow-lg) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    font-family: inherit !important;
    -webkit-tap-highlight-color: transparent;
}

.em-strutture__map-close:active {
    transform: translateX(-50%) scale(0.95) !important;
}

/* =================================================================
   Geolocation button
   ================================================================= */

.em-strutture__geolocate {
    position: absolute !important;
    bottom: 80px !important;
    right: 12px !important;
    z-index: 10000 !important;
    width: 44px !important;
    height: 44px !important;
    background: var(--em-bg) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--em-shadow) !important;
    color: var(--em-text) !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
}

.em-strutture__geolocate:hover {
    background: var(--em-primary) !important;
    color: #fff !important;
}

/* =================================================================
   Map markers (custom divIcon)
   ================================================================= */

.em-strutture__marker {
    background: transparent;
    border: 0;
}

.em-strutture__marker-pin {
    position: relative;
    display: inline-block;
}

.em-strutture__marker-pin img {
    display: block;
}

.em-strutture__marker-label {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 800;
    color: var(--em-text);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    pointer-events: none;
}

/* Active marker pulse */
.em-strutture__marker--active .em-strutture__marker-pin {
    animation: em-pulse 1s ease infinite;
}

/* =================================================================
   Leaflet popup overrides
   ================================================================= */

.em-strutture .leaflet-popup-content-wrapper {
    border-radius: var(--em-radius);
    box-shadow: var(--em-shadow-lg);
    padding: 0;
}

.em-strutture .leaflet-popup-content {
    margin: 0;
    font-family: inherit;
    font-size: calc(var(--em-font-size-base) - 1px);
    line-height: 1.5;
}

.em-strutture__popup {
    padding: 14px 16px;
    max-width: 260px;
}

.em-strutture__popup strong {
    display: block;
    font-size: var(--em-font-size-base);
    margin-bottom: 4px;
    color: var(--em-text);
}

.em-strutture__popup a {
    color: var(--em-primary);
    text-decoration: none;
    font-weight: var(--em-font-weight-bold);
}

.em-strutture__popup a:hover {
    text-decoration: underline;
}

.em-strutture .leaflet-popup-tip {
    box-shadow: none;
}

/* =================================================================
   TABLET — 768px – 1023px
   ================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {

    .em-strutture__layout {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .em-strutture__list {
        max-height: 300px;
        overflow-y: auto;
        border-radius: var(--em-radius-lg);
        border: 1px solid var(--em-border);
    }

    .em-strutture__map-wrap {
        display: block !important;
        position: relative !important;
        height: 400px;
        border-radius: var(--em-radius-lg);
        overflow: hidden;
    }

    .em-strutture__fab { display: none !important; }
    .em-strutture__map-overlay { display: none !important; }
}

/* =================================================================
   DESKTOP — >= 1024px
   ================================================================= */

@media (min-width: 1024px) {

    .em-strutture__layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        height: var(--em-map-height-desktop);
    }

    .em-strutture__list {
        overflow-y: auto;
        border-radius: var(--em-radius-lg);
        border: 1px solid var(--em-border);
    }

    .em-strutture__list::-webkit-scrollbar {
        width: 6px;
    }

    .em-strutture__list::-webkit-scrollbar-track {
        background: transparent;
    }

    .em-strutture__list::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.12);
        border-radius: 3px;
    }

    .em-strutture__list::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.2);
    }

    .em-strutture__map-wrap {
        display: block !important;
        position: relative !important;
        height: 100%;
        border-radius: var(--em-radius-lg);
        overflow: hidden;
    }

    .em-strutture__fab { display: none !important; }
    .em-strutture__map-overlay { display: none !important; }
    .em-strutture__map-close { display: none !important; }

    .em-strutture__geolocate {
        bottom: 20px !important;
        right: 20px !important;
    }

    .em-strutture__select {
        max-width: 240px;
    }
}

/* =================================================================
   Card style variants (via data-card-style attribute)
   ================================================================= */

.em-strutture[data-card-style="compact"] .em-strutture__card {
    padding: calc(var(--em-card-padding-v) * 0.65) var(--em-card-padding-h) !important;
    gap: calc(var(--em-card-gap) * 0.7) !important;
}

.em-strutture[data-card-style="compact"] .em-strutture__card-icon {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
}

.em-strutture[data-card-style="expanded"] .em-strutture__card {
    padding: calc(var(--em-card-padding-v) * 1.4) var(--em-card-padding-h) !important;
}

/* =================================================================
   Nav button style variants (via data-nav-btn attribute)
   ================================================================= */

.em-strutture[data-nav-btn="outline"] .em-strutture__nav-btn {
    background: transparent !important;
    border: 2px solid var(--em-primary) !important;
    color: var(--em-primary) !important;
    box-shadow: none !important;
}

.em-strutture[data-nav-btn="outline"] .em-strutture__nav-btn svg {
    stroke: var(--em-primary) !important;
}

.em-strutture[data-nav-btn="minimal"] .em-strutture__nav-btn {
    background: transparent !important;
    box-shadow: none !important;
    color: var(--em-primary) !important;
}

.em-strutture[data-nav-btn="minimal"] .em-strutture__nav-btn svg {
    stroke: var(--em-primary) !important;
}

/* =================================================================
   Card border-left toggle (via data-card-border-left attribute)
   ================================================================= */

.em-strutture[data-card-border-left="0"] .em-strutture__card.em-strutture__card--active {
    border-left-color: transparent !important;
    background: var(--em-bg-hover) !important;
}

/* =================================================================
   Print
   ================================================================= */

@media print {
    .em-strutture__map-wrap,
    .em-strutture__fab,
    .em-strutture__map-overlay,
    .em-strutture__geolocate,
    .em-strutture__search,
    .em-strutture__filters,
    .em-strutture__load-more-wrap {
        display: none !important;
    }

    .em-strutture__layout {
        display: block;
        height: auto;
    }

    .em-strutture__list {
        display: block;
        position: static;
        overflow: visible;
        border: none;
    }

    .em-strutture__card {
        break-inside: avoid;
        border-bottom: 1px solid #ccc;
        animation: none;
    }

    .em-strutture__nav-btn {
        background: transparent;
        color: var(--em-text);
        border: 1px solid #ccc;
    }
}

/* Select non applicabili al tipo struttura selezionato (Ospedale/Ambulatorio):
   il blocco funzionale è l'attributo `disabled`, questa regola dà il feedback
   visivo. !important per coerenza con il resto del file (theme-proofing). */
.em-strutture__select--disabled {
    opacity: 0.5 !important;
    pointer-events: none !important;
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
}
