/**
 * Itinerario Maps — Styles
 * Mobile-first. No pointer-events hacks.
 */

:root {
    --itm-accent: #73b9e6;
    --itm-text: #1a1a1a;
    --itm-dim: #6b7280;
    --itm-bg: #fff;
    --itm-border: #e5e7eb;
    --itm-radius: 10px;
    --itm-shadow: 0 4px 16px rgba(0,0,0,0.12);
}



/* ── Base ── */
.leaflet-control-attribution {display:none!important;}

.itmap-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ══ FILTERS ══ */
.itmap-filters {
    justify-content: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.itmap-filter-btn {
    width: 38px; height: 38px;
    padding: 0;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.itmap-filter-btn.active { opacity: 1; }
.itmap-filter-btn:not(.active) { opacity: 0.3; transform: scale(0.88); }
.itmap-filter-pin { width: 20px; height: 20px; }

/* ══ MAIN LAYOUT ══ */
.itmap-main {
    position: relative;
    border-radius: var(--itm-radius);
    overflow: hidden;
    box-shadow: var(--itm-shadow);
}

.itmap-map {
    width: 100%;
    min-height: 300px;
    background: #eef2f5;
}

/* ══ OVERLAY (mobile dark bg) ══ */
.itmap-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 900;
}
.itmap-main.sidebar-open .itmap-overlay {
    display: block;
}

/* ══ SIDEBAR ══ */
.itmap-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: var(--itm-bg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
    transform: translateX(calc(-100% - 50px));
    transition: transform 0.3s ease;
    will-change: transform;
}
.itmap-main.sidebar-open .itmap-sidebar {
    transform: translateX(0);
}

.itmap-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--itm-border);
    flex-shrink: 0;
}
.itmap-sidebar-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--itm-text);
}
.itmap-sidebar-close {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--itm-dim);
    padding: 0 4px;
    -webkit-tap-highlight-color: transparent;
}

.itmap-sidebar-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.itmap-sidebar-group { margin-bottom: 2px; }
.itmap-sidebar-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    border-radius: 0;
}
.itmap-sidebar-group-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.itmap-sidebar-item {
    display: block;
    width: 100%;
    padding: 10px 16px 10px 38px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--itm-text);
    line-height: 1.35;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, border-color 0.1s;
}
.itmap-sidebar-item:hover,
.itmap-sidebar-item:active {
    background: #f3f4f6;
    border-left-color: var(--itm-accent);
}

/* ══ SIDEBAR TAB (bookmark at left edge) ══ */
.itmap-sidebar-tab {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 800;
    width: 22px;
    height: 52px;
    background: var(--itm-bg);
    border: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 0 6px rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--itm-dim);
    transition: width 0.2s, background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.itmap-sidebar-tab:hover {
    width: 28px;
    background: var(--itm-text);
    color: #fff;
}
.itmap-main.sidebar-open .itmap-sidebar-tab {
    display: none;
}

/* ══ MARKERS ══ */
.itmap-marker-icon { background: none !important; border: none !important; }
.itmap-marker {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% 50% 50% 4px;
    transform: rotate(-45deg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2.5px solid rgba(255,255,255,0.6);
    transition: transform 0.15s, box-shadow 0.15s;
}
.itmap-marker:hover {
    transform: rotate(-45deg) scale(1.2);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.itmap-marker-fa {
    transform: rotate(45deg);
    font-size: 16px;
    color: #fff;
    line-height: 1;
}

/* ══ POPUP ══ */
.itmap-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    max-width: 300px;
}
.itmap-popup-img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}
.itmap-popup-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 3px;
}
.itmap-popup-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--itm-text);
    line-height: 1.25;
}
.itmap-popup-desc {
    color: var(--itm-dim);
    font-size: 12px;
    line-height: 1.55;
    margin-bottom: 4px;
}
.itmap-popup-rating {
    margin: 4px 0 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.itmap-stars { color: #f59e0b; letter-spacing: 1px; }
.itmap-rating-num { font-weight: 700; color: var(--itm-text); }
.itmap-reviews { color: var(--itm-dim); font-size: 11px; }
.itmap-price { color: #059669; font-weight: 700; }
.itmap-open-status { font-size: 11px; font-weight: 700; margin: 2px 0 6px; }
.itmap-open { color: #059669; }
.itmap-closed { color: #dc2626; }

.itmap-popup-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--itm-border);
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.itmap-detail {
    font-size: 12px;
    color: var(--itm-dim);
    line-height: 1.4;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.itmap-detail-icon { font-size: 11px; flex-shrink: 0; width: 16px; text-align: center; }
.itmap-detail a { color: var(--itm-accent); text-decoration: none; font-weight: 500; }
.itmap-detail a:hover { text-decoration: underline; }

.itmap-hours-toggle { margin-top: 2px; }
.itmap-hours-toggle summary {
    cursor: pointer; list-style: none;
    font-size: 12px; color: var(--itm-dim);
    display: flex; align-items: center; gap: 6px;
}
.itmap-hours-toggle summary::-webkit-details-marker { display: none; }
.itmap-hours-toggle summary::after { content: ' \25B8'; font-size: 9px; }
.itmap-hours-toggle[open] summary::after { content: ' \25BE'; }
.itmap-hours-list { padding: 6px 0 2px 22px; }
.itmap-hours-row { font-size: 11px; color: var(--itm-dim); line-height: 1.7; }

.itmap-places-loading {
    font-size: 11px; color: var(--itm-dim);
    padding: 8px 0; text-align: center; font-style: italic;
}
.itmap-places-slot { min-height: 0; }

/* ── Buttons ── */
.itmap-popup-actions a {
    color: #FFFFFF!important;
}



.itmap-popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}
.itmap-popup-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.itmap-popup-btn:hover { color: #fff; }
.itmap-popup-btn svg { flex-shrink: 0; }
.itmap-btn-maps { background: var(--itm-accent); }
.itmap-btn-nav { background: #059669; }

/* ══ USER LOCATION ══ */
.itmap-user-marker {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    position: relative;
}
.itmap-user-marker::before,
.itmap-user-marker::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(115,185,230,0.25);
    animation: itmap-radar 2s ease-out infinite;
    width: 40px; height: 40px;
}
.itmap-user-marker::after { animation-delay: 0.8s; }
.itmap-user-dot {
    width: 18px; height: 18px;
    background: var(--itm-accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(115,185,230,0.6);
    position: relative; z-index: 2;
}
@keyframes itmap-radar {
    0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0.7; }
    100% { transform: translate(-50%,-50%) scale(2.2); opacity: 0; }
}

.itmap-locate-btn {
    width: 34px; height: 34px;
    background: var(--itm-bg);
    border-radius: 6px;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--itm-dim);
    box-shadow: var(--itm-shadow);
}
.itmap-locate-btn.locating { color: var(--itm-accent); animation: itmap-pulse 1s ease-in-out infinite; }
.itmap-locate-btn.located { color: var(--itm-accent); }
.itmap-locate-btn.error { color: #dc2626; }
@keyframes itmap-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ══ MOBILE ══ */
@media (max-width: 768px) {
    .itmap-filter-btn { width: 34px; height: 34px; }
    .itmap-filter-pin { width: 18px; height: 18px; }
    .itmap-popup-actions { flex-direction: column; }
    .itmap-sidebar { width: 100%; max-width: 100%; }
}

/* ══ FULLSCREEN ══ */
.itmap-fullscreen-btn {
    width: 34px; height: 34px;
    background: var(--itm-bg);
    border-radius: 6px;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--itm-dim);
    box-shadow: var(--itm-shadow);
    margin-top: 6px;
    transition: color 0.2s, background 0.2s;
}
.itmap-fullscreen-btn:hover {
    background: var(--itm-text);
    color: #fff;
}

/* Native Fullscreen API */
.itmap-container:fullscreen,
.itmap-container:-webkit-full-screen {
    width: 100%;
    height: 100%;
    background: #fff;
}
.itmap-container:fullscreen .itmap-filters,
.itmap-container:-webkit-full-screen .itmap-filters {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255,255,255,0.95);
    padding: 6px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.itmap-container:fullscreen .itmap-main,
.itmap-container:-webkit-full-screen .itmap-main {
    height: 100%;
    border-radius: 0;
}
.itmap-container:fullscreen .itmap-map,
.itmap-container:-webkit-full-screen .itmap-map {
    height: 100% !important;
}

/* Fallback fullscreen per iOS Safari (Native Fullscreen API non supportata su elementi non-video) */
.itmap-container.itmap-fake-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding-top: 10px !important;
    box-sizing: border-box !important;
    z-index: 999999 !important;
    background: #fff;
}
.itmap-container.itmap-fake-fullscreen .itmap-filters {
    max-height: 50vh;
    overflow-y: auto;
}
.itmap-container.itmap-fake-fullscreen .itmap-main {
    height: 100% !important;
}
.itmap-container.itmap-fake-fullscreen .itmap-map {
    height: 100% !important;
}
body.itmap-fake-fullscreen-active {
    overflow: hidden !important;
}
