/* Parking plan: background image + clickable SVG overlay.
   Shared tokens (--primary-color, --border-color, card radius/shadow) come from style.css. */

:root {
    --hover-color: #3498db;
    --house-color: #ecf0f1;
    --house-border: #95a5a6;
    --house-hover: #d5d8dc;
}

/* Scroll wrapper: lets the plan stay readable on narrow screens */
.map-scroll {
    max-width: 1200px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: #fff;
}

/* Positioning context for the absolutely placed SVG overlay */
.map-container {
    position: relative;
    line-height: 0;
}

.map-container img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
}

/* Overlay stretched over the image; viewBox 0 0 100 100 makes the
   coordinates in parking.js behave as percentages of the image. */
#parking-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* --- SVG ELEMENT STYLES --- */

.parking-spot {
    fill: #ffffff;
    stroke: var(--primary-color);
    stroke-width: 0.15;
    transition: fill 0.2s ease-in-out, opacity 0.2s ease-in-out;
    cursor: pointer;
}

.parking-spot:hover,
.parking-spot:focus {
    fill: var(--hover-color);
    opacity: 0.85;
}

.house-shape {
    fill: var(--house-color);
    stroke: var(--house-border);
    stroke-width: 0.3;
    transition: fill 0.2s ease-in-out, stroke 0.2s ease-in-out;
    cursor: pointer;
    opacity: 0.95; /* Slightly transparent so it blends with the map */
}

.house-shape:hover,
.house-shape:focus {
    fill: var(--house-hover);
    stroke: var(--primary-color);
}

/* Per-spot label. font-size is in SVG user units (viewBox is 0 0 100 100), so
   ~0.95 keeps a 6-character label inside a bay. Tune it here, not in the JS. */
.spot-label {
    font-size: 0.95px;
    font-weight: 600;
    fill: var(--primary-color);
    pointer-events: none; /* Clicks pass through to the spot underneath */
    user-select: none;
}

.house-label {
    font-size: 3.5px; /* Scaled to the 100x100 SVG viewBox */
    font-weight: 800;
    fill: var(--primary-color);
    pointer-events: none; /* Clicks pass through to the polygon underneath */
    user-select: none;
}

/* --- MODAL STYLES --- */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    line-height: 1.6;

    &.house {
        .modal-body {
            .info-value {
                color: var(--primary-color);
                /*font-weight: bold;*/
            }
        }
    }
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.modal-body {
    font-size: 16px;
    color: #555;
    margin-bottom: 25px;
}

.modal-body .info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.modal-body .info-label {
    font-weight: bold;
    color: #333;
}

.modal-body .info-value {
    color: #777;
    font-style: italic;
    text-align: right;
}

.close-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
    font-weight: bold;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #1a252f;
}

.close-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.close-icon:hover {
    color: #333;
}

@media (max-width: 768px) {
    /* Keep the plan legible: it scrolls sideways instead of shrinking to nothing */
    .map-container { min-width: 640px; }
    .modal-content { padding: 20px; }
    .close-btn { min-height: 44px; }
}
