/* ═══════════════════════════════════════════════════════════
   Lidomatic Mappa — Stili V3 (Pan-Zoom + Glassmorphism)
   Prefisso: lidomatic-* (nessun conflitto con temi WP)
   ═══════════════════════════════════════════════════════════ */

/* ── Map Wrapper ────────────────────────────────────────── */

.lidomatic-map-wrapper {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

/* ── Viewport (pan-zoom container) ──────────────────────── */

.lidomatic-viewport {
    width: 100%;
    height: 75vh;
    min-height: 400px;
    overflow: hidden;
    touch-action: none;
    position: relative;
    background: #f5ebe0;
    cursor: grab;
}

.lidomatic-viewport:active {
    cursor: grabbing;
}

#lidomatic-svg-wrapper {
    transform-origin: 0 0;
    will-change: transform;
}

#lidomatic-svg-wrapper svg {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: all;
}

/* Ombrellone SVG top-down — sostituzione rect */
.lidomatic-umb-group {
    pointer-events: bounding-box;
}
.lidomatic-umb-group use {
    pointer-events: fill;
}

.lidomatic-error {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-size: 16px;
}

/* ── Date Overlay (glass, top-left) ─────────────────────── */

.lidomatic-date-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 4px 20px rgba(15, 23, 42, 0.1),
        0 1px 4px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 10px 14px;
}

.lidomatic-date-overlay-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lidomatic-date-overlay-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
}

.lidomatic-date-overlay-input {
    border: 2px solid rgba(100, 116, 139, 0.35);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    width: 120px;
    text-align: center;
    color: #1e293b;
    transition: border-color 0.2s;
}

.lidomatic-date-overlay-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lidomatic-date-overlay-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 0.82rem;
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    white-space: nowrap;
}

.lidomatic-date-overlay-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.lidomatic-date-overlay-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
.lidomatic-btn-loading {
    pointer-events: none;
}

/* ── Zoom Controls (glass, top-right) ───────────────────── */

.lidomatic-zoom-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow:
        0 4px 20px rgba(15, 23, 42, 0.1),
        0 1px 4px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    padding: 4px;
}

.lidomatic-zoom-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    color: #475569;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    line-height: 1;
}

.lidomatic-zoom-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

.lidomatic-zoom-btn:active {
    background: rgba(59, 130, 246, 0.2);
}

.lidomatic-zoom-btn-reset {
    font-size: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* ── Booking Form (Glass Card, centered) ──────────────── */

.lidomatic-booking-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: 400px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.lidomatic-booking-form-inner {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow:
        0 12px 48px rgba(15, 23, 42, 0.18),
        0 4px 16px rgba(15, 23, 42, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
}

.lidomatic-form-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: rgba(148, 163, 184, 0.15);
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.15s ease;
}

.lidomatic-form-close:hover {
    color: #1e293b;
    background: rgba(148, 163, 184, 0.25);
}

.lidomatic-booking-form h3 {
    margin: 0 0 20px 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.lidomatic-form-row {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Riga date: Dal/Al sempre su una riga */
.lidomatic-form-row:has(.lidomatic-form-date) {
    flex-wrap: nowrap;
}

.lidomatic-form-row label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #475569;
    min-width: 30px;
}

.lidomatic-form-date {
    border: 2px solid rgba(100, 116, 139, 0.35);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.88rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    width: 130px;
    text-align: center;
    color: #1e293b;
    transition: border-color 0.2s;
}

.lidomatic-form-date:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lidomatic-form-select {
    width: 100%;
    border: 2px solid rgba(100, 116, 139, 0.35);
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 0.88rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    color: #1e293b;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.lidomatic-form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.lidomatic-price-row {
    justify-content: space-between;
    padding: 14px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin-top: 6px;
}

.lidomatic-price-label {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.lidomatic-price-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #2563eb;
}

.lidomatic-btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 1rem;
    padding: 14px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.lidomatic-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.lidomatic-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.lidomatic-btn-primary:disabled {
    background: rgba(148, 163, 184, 0.4);
    cursor: not-allowed;
    box-shadow: none;
}

.lidomatic-form-message {
    margin-top: 12px;
    font-size: 0.82rem;
    text-align: center;
    font-weight: 500;
}

.lidomatic-form-error {
    color: #dc2626;
}

/* ── Noscript ───────────────────────────────────────────── */

.lidomatic-noscript {
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    padding: 40px 20px;
    text-align: center;
    font-size: 16px;
    border-radius: 16px;
    margin: 20px 0;
}

/* ── WooCommerce Overrides ──────────────────────────────── */

.lidomatic-map-wrapper ~ form.cart .quantity,
.wc-block-components-quantity-selector {
    display: none !important;
}

/* ── Litepicker z-index ─────────────────────────────────── */

.litepicker {
    z-index: 100000 !important;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .lidomatic-viewport {
        height: 65vh;
        min-height: 350px;
    }

    .lidomatic-date-overlay {
        top: 8px;
        left: 8px;
        right: 8px;
        padding: 8px 10px;
        border-radius: 12px;
    }

    .lidomatic-date-overlay-row {
        gap: 6px;
    }

    .lidomatic-date-overlay-input {
        width: 0;
        flex: 1;
        min-width: 0;
        padding: 7px 6px;
        font-size: 0.78rem;
        border-radius: 8px;
    }

    .lidomatic-date-overlay-label {
        font-size: 0.78rem;
    }

    .lidomatic-date-overlay-btn {
        padding: 7px 12px;
        font-size: 0.78rem;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .lidomatic-zoom-controls {
        top: 8px;
        right: 8px;
    }

    .lidomatic-zoom-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .lidomatic-booking-form {
        width: 95vw;
    }

    .lidomatic-booking-form-inner {
        padding: 22px;
        border-radius: 18px;
    }
}

@media (max-width: 480px) {
    .lidomatic-viewport {
        height: 60vh;
        min-height: 300px;
    }

    .lidomatic-date-overlay {
        top: 6px;
        left: 6px;
        right: 6px;
        padding: 7px 8px;
        border-radius: 10px;
    }

    .lidomatic-date-overlay-input {
        padding: 6px 4px;
        font-size: 0.75rem;
    }

    .lidomatic-date-overlay-label {
        font-size: 0.75rem;
    }

    .lidomatic-date-overlay-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .lidomatic-zoom-controls {
        top: auto;
        bottom: 12px;
        right: 8px;
    }

    .lidomatic-zoom-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .lidomatic-booking-form {
        width: 96vw;
    }

    .lidomatic-booking-form-inner {
        padding: 18px;
        border-radius: 16px;
    }

    .lidomatic-form-date {
        width: 110px;
        border-radius: 10px;
    }

    .lidomatic-btn-primary {
        border-radius: 12px;
        padding: 12px;
        font-size: 0.9rem;
    }

    .lidomatic-price-value {
        font-size: 1.2rem;
    }
}
