/* ==========================================================================
   Campground Map Frontend Styles
   ========================================================================== */

/* Import Outfit font for premium look */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

.mcm-map-container {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1920px;
    width: 100%;
    margin: 2rem auto;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: auto; /* Set to auto to grow dynamically */
}

/* Header container with flexbox alignment */
.mcm-map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.mcm-map-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

/* Booking Link button styled dynamically */
.mcm-booking-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 10px;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, filter 0.2s ease;
    cursor: pointer;
}

.mcm-booking-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.mcm-booking-button:active {
    transform: translateY(0);
}

/* Instructions Callout Box */
.mcm-instructions {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 1rem;
    color: #334155;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.015);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.mcm-instructions p:last-child {
    margin-bottom: 0;
}

/* Wrapper supporting markers */
.mcm-map-wrapper {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 14px;
    overflow: visible;
    /* Prevent marker clipping */
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.05);
}

.mcm-map-wrapper img {
    border-radius: 14px;
    max-width: 100%;
    height: auto;
    display: block;
}

/* Map Markers */
.mcm-marker {
    position: absolute;
    display: inline-block;
    text-decoration: none;
    z-index: 5;
    /* Keep constant size by dividing by map scale */
    translate: -50% -50%;
    scale: calc(1 / var(--map-scale, 1));
    transition: scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), z-index 0.2s ease;
}

.mcm-marker:hover {
    scale: calc(1.2 / var(--map-scale, 1));
    z-index: 10;
}

/* Circular icon dot marker */
.mcm-marker-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    position: relative;
    /* Pulsing halo ring animation */
    animation: mcm-pulse-glow 2.5s infinite;
}

/* White glowing ring pulsing regardless of the chosen custom color */
@keyframes mcm-pulse-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.65), 0 4px 10px rgba(0, 0, 0, 0.18);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0), 0 4px 10px rgba(0, 0, 0, 0.18);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0), 0 4px 10px rgba(0, 0, 0, 0.18);
    }
}

/* ==========================================================================
   Template Layout Styles
   ========================================================================== */

/* --- Template 1: Standard Stacked --- */

/* Desktop layout: Instructions (auto size/scroll), Map (takes all remaining space), Button at bottom */
@media (min-width: 1025px) {
    .mcm-layout-standard {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .mcm-layout-standard .mcm-instructions {
        flex-grow: 0;
        flex-shrink: 0;
        max-height: 140px;
        /* Restricts instructions size so map takes precedence */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        width: 60%;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 1.5rem;
        box-sizing: border-box;
    }

    .mcm-layout-standard .mcm-instructions-scroll {
        overflow-y: auto;
        height: 100%;
    }

    .mcm-layout-standard .mcm-map-area {
        flex-grow: 0;
        flex-shrink: 0;
        min-height: auto;
        overflow: hidden;
        display: block;
        width: 100%;
        margin-bottom: 15px;
    }

    .mcm-layout-standard .mcm-map-wrapper {
        min-height: auto;
        height: auto;
        width: 100%;
        display: block;
    }

    .mcm-layout-standard .mcm-map-zoom-content {
        height: auto;
        width: 100%;
        display: block;
    }

    .mcm-layout-standard .mcm-map-zoom-content img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        object-fit: contain !important;
        display: block;
    }

    .mcm-layout-standard .mcm-booking-wrapper {
        flex-shrink: 0;
        margin-top: auto;
        /* Anchors at bottom */
        text-align: center;
        width: 100%;
    }
}

/* --- Template 2: Split Columns (Map on Left, Sidebar on Right) --- */

/* Desktop Grid Configuration */
@media (min-width: 1025px) {
    .mcm-layout-split {
        display: grid;
        grid-template-columns: 65% 32%;
        gap: 0 3%;
        grid-template-areas:
            "map sidebar";
        align-items: stretch;
        height: auto;
    }

    .mcm-layout-split .mcm-map-area {
        grid-area: map;
        height: auto;
        min-height: auto;
        overflow: hidden;
        display: block;
    }

    .mcm-layout-split .mcm-map-wrapper {
        min-height: auto;
        height: auto;
        width: 100%;
        display: block;
    }

    .mcm-layout-split .mcm-map-zoom-content {
        height: auto;
        width: 100%;
        display: block;
    }

    .mcm-layout-split .mcm-map-zoom-content img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        object-fit: contain !important;
        display: block;
    }

    .mcm-layout-split .mcm-sidebar-column {
        grid-area: sidebar;
        display: flex;
        flex-direction: column;
        height: 100%;
        box-sizing: border-box;
    }

    .mcm-layout-split .mcm-instructions {
        flex-grow: 1;
        /* Ocupa el espacio restante en el sidebar */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        margin-bottom: 0;
    }

    .mcm-layout-split .mcm-instructions-scroll {
        overflow-y: auto;
        height: 100%;
    }

    .mcm-layout-split .mcm-booking-wrapper {
        flex-shrink: 0;
        margin-top: 15px;
        text-align: center;
    }
}

/* Tablet & Mobile: Stacked order: Instructions -> Map -> Booking Button (Same on both) */
@media (max-width: 1024px) {
    .mcm-map-container {
        height: auto;
        width: 90vw;
        max-height: none;
        max-width: 90vw;
        display: flex;
        flex-direction: column;
    }

    .mcm-layout-standard,
    .mcm-layout-split {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .mcm-layout-split .mcm-sidebar-column {
        display: contents;
        /* Flattens sidebar wrapper for flex ordering */
    }

    .mcm-instructions {
        order: 1;
        flex-grow: 0;
        /* Do not stretch instructions card */
        flex-shrink: 0;
        max-height: 140px;
        /* Limit height so map has space to grow */
        overflow: hidden;
        display: flex;
        flex-direction: column;
        width: 80% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        margin-bottom: 15px !important;
        box-sizing: border-box;
    }

    .mcm-instructions-scroll {
        overflow-y: auto;
        height: 100%;
    }

    .mcm-map-area {
        order: 2;
        flex-grow: 0;
        flex-shrink: 0;
        min-height: auto !important;
        height: auto !important;
        /* Allow the map to shrink to fit available space */
        overflow: hidden;
        display: block;
        width: 100%;
        margin-bottom: 15px;
    }

    .mcm-map-wrapper {
        min-height: auto !important;
        /* Allow the wrapper to shrink to fit available space */
        height: auto !important;
        width: 100% !important;
        display: block;
    }

    .mcm-map-zoom-content {
        height: auto !important;
        width: 100% !important;
        display: block;
    }

    .mcm-map-zoom-content img {
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        object-fit: contain !important;
        display: block;
    }

    .mcm-booking-wrapper {
        order: 3;
        flex-shrink: 0;
        margin-top: auto;
        /* Anchor to bottom */
        text-align: center;
        width: 100%;
    }
}

/* ==========================================================================
   6. Full-Screen Modal Dialog Styles
   ========================================================================== */

dialog.mcm-modal {
    position: relative;
    width: 90vw;
    height: 90vh;
    width: 90dvw;
    height: 90dvh;
    max-width: 90vw;
    max-height: 90vh;
    max-width: 90dvw;
    max-height: 90dvh;
    border: none;
    padding: 0;
    margin: auto;
    background: rgba(15, 23, 42, 0.95);
    /* Premium dark slate background */
    color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Backdrop blurring for premium glassmorphism overlay */
dialog.mcm-modal::backdrop {
    background-color: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.mcm-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    /* Black semi-transparent background */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease;
    z-index: 1000;
}

.mcm-modal-close:hover {
    background: rgba(0, 0, 0, 0.85);
    /* Darker on hover */
    border-color: rgba(255, 255, 255, 0.4);
    transform: rotate(90deg) scale(1.08);
}

.mcm-modal-close:active {
    transform: rotate(90deg) scale(0.92);
}

.mcm-modal-body {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.mcm-modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
    display: block;
}

/* Fallback Card styles when there's no URL link */
.mcm-modal-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}

.mcm-fallback-card {
    background: rgba(30, 41, 59, 0.7);
    /* Slate 800 blur card */
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.mcm-fallback-icon {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 1.5rem;
    animation: mcm-bounce 2s infinite ease-in-out;
}

@keyframes mcm-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.mcm-fallback-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
}

.mcm-fallback-desc {
    font-size: 1.1rem;
    color: #94a3b8;
    margin: 0;
    line-height: 1.6;
}

/* ==========================================================================
   7. Map Zoom Controls Styling
   ========================================================================== */

.mcm-map-wrapper {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    /* Clips zoomed map image */
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.05);
    background: #f8fafc;
}

.mcm-map-zoom-content {
    position: relative;
    width: 100%;
    transform-origin: center center;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    user-select: none;
    -webkit-user-drag: none;
}

.mcm-map-zoom-content img {
    pointer-events: none;
    /* Prevents default image dragging */
    -webkit-user-drag: none;
}

.mcm-map-zoom-content.is-dragging {
    transition: none;
    /* Instant feedback when dragging */
}

.mcm-zoom-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.mcm-zoom-btn {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: none;
    color: #0f172a;
    font-size: 22px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    user-select: none;
    padding: 0;
    margin: 0;
}

.mcm-zoom-btn:first-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mcm-zoom-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #000000;
}

.mcm-zoom-btn:disabled {
    background: #f8fafc;
    color: #cbd5e1;
    cursor: not-allowed;
}