/* Camping styles */
.mcb-camping .mcb-search-form {
    background: #f5f8f0;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #d5e0c5;
}

/* Space actions row */
.mcb-space-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.mcb-space-count {
    font-size: 14px;
    color: #888;
    margin-left: auto;
}

/* Space grid */
.mcb-space-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    margin: 0 0 16px;
}

.mcb-space-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #f5f5f5;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.15s;
    padding: 0;
}

.mcb-space-tile.mcb-space-available {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.mcb-space-tile.mcb-space-available:hover {
    background: #c8e6c9;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(76,175,80,0.3);
}

.mcb-space-tile.mcb-space-occupied {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
    cursor: not-allowed;
    opacity: 0.5;
}

.mcb-space-tile.mcb-space-selected {
    background: #5a4a3a !important;
    border-color: #5a4a3a !important;
    color: #fff !important;
    transform: scale(1.15);
}

/* Legend */
.mcb-space-legend {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #888;
    margin: 8px 0 16px;
}

.mcb-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mcb-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 2px solid;
}

.mcb-legend-available { background: #e8f5e9; border-color: #4caf50; }
.mcb-legend-occupied { background: #ffebee; border-color: #ef9a9a; }

/* ============ MAP MODAL ============ */
.mcb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.mcb-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 95vw;
    max-width: 1400px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.mcb-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.mcb-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.mcb-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0 8px;
    line-height: 1;
}

.mcb-modal-close:hover {
    color: #000;
}

.mcb-modal-body {
    flex: 1;
    overflow: auto;
    padding: 0;
}

/* Map inside modal */
.mcb-map-container-modal {
    position: relative;
    width: 100%;
}

.mcb-map-container-modal img {
    width: 100%;
    height: auto;
    display: block;
}

/* Map pins in modal — larger and more visible */
.mcb-map-container-modal .mcb-map-pin {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    transform: translate(-50%, -50%);
    transition: all 0.2s;
    border: 2px solid;
    z-index: 2;
    cursor: pointer;
}

.mcb-map-container-modal .mcb-pin-available {
    background: rgba(76,175,80,0.85);
    border-color: #2e7d32;
    color: #fff;
}

.mcb-map-container-modal .mcb-pin-available:hover {
    transform: translate(-50%, -50%) scale(1.4);
    z-index: 10;
    box-shadow: 0 0 16px rgba(76,175,80,0.7);
}

.mcb-map-container-modal .mcb-pin-occupied {
    background: rgba(229,57,53,0.5);
    border-color: #c62828;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.6;
    font-size: 10px;
}

.mcb-map-container-modal .mcb-pin-selected {
    transform: translate(-50%, -50%) scale(1.5);
    z-index: 11;
    box-shadow: 0 0 0 3px #fff, 0 0 16px rgba(0,0,0,0.5);
}

/* Color legend inside the map modal */
.mcb-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 10px 24px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    flex-shrink: 0;
}

.mcb-map-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mcb-map-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Zoom controls on the map */
.mcb-modal-body {
    position: relative;
}

.mcb-map-zoom {
    position: sticky;
    bottom: 16px;
    float: right;
    margin-right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
}

.mcb-map-zoom button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background: #fff;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    line-height: 1;
}

.mcb-map-zoom button:active {
    background: #f0f0f0;
}

/* Info bar shown when a pin is tapped — replaces hover on mobile */
.mcb-map-infobar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Booking summary table */
.mcb-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 15px;
}

.mcb-summary-table td {
    padding: 8px 4px;
    border-bottom: 1px solid #e8eed8;
    vertical-align: middle;
}

.mcb-summary-table .mcb-summary-price {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.mcb-summary-table .mcb-summary-total td {
    border-bottom: none;
    border-top: 2px solid #5a8a3c;
    padding-top: 12px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .mcb-space-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .mcb-modal-content {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    /* Keep the map wide enough that pins stay tappable — pan by scrolling. */
    .mcb-map-container-modal {
        min-width: 900px;
    }

    .mcb-map-container-modal .mcb-map-pin {
        width: 28px;
        height: 28px;
        font-size: 10px;
    }

    .mcb-map-legend {
        padding: 8px 12px;
        font-size: 12px;
        gap: 6px 12px;
    }

    .mcb-map-infobar {
        padding: 10px 12px;
    }

    .mcb-map-infobar .mcb-btn {
        width: auto;
    }
}

/* Instruction hint at the top of the map modal */
.mcb-map-hint {
    padding: 10px 24px;
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
    font-size: 14px;
    flex-shrink: 0;
}

/* The confirm bar slides up and demands attention when a pin is tapped */
.mcb-map-infobar {
    animation: mcb-slideup 0.25s ease-out;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
    background: #fff;
}

.mcb-map-infobar .mcb-btn {
    font-size: 16px;
    padding: 12px 28px;
}

@keyframes mcb-slideup {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    /* Larger, easier-to-read pins on phones */
    .mcb-map-container-modal .mcb-map-pin {
        width: 34px;
        height: 34px;
        font-size: 12px;
        border-width: 2px;
    }

    .mcb-map-hint {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Full-width confirm button so it can't be missed */
    .mcb-map-infobar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .mcb-map-infobar .mcb-btn {
        width: 100%;
    }
}

/* Mobile map modal: compact one-line legend so the MAP gets the screen */
@media (max-width: 768px) {
    .mcb-modal-content {
        height: 100dvh;
    }

    /* Legend as a single horizontally swipeable strip instead of a tall block */
    .mcb-map-legend {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 14px;
        padding: 8px 12px;
        scrollbar-width: none;
    }

    .mcb-map-legend::-webkit-scrollbar {
        display: none;
    }

    .mcb-map-legend-item {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Let the map body take all remaining height and scroll properly */
    .mcb-modal-body {
        min-height: 0;
        flex: 1 1 auto;
    }

    .mcb-map-hint {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
