﻿.buildings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, 320px);
    gap: 30px;
    justify-content: center;
    align-items: start;
}

.building {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid #126046;
    border-radius: 12px;
    /*background: linear-gradient(to bottom, #fffdf4, #fefee9);*/
    background: linear-gradient(to top, #f6f6f6, #eeeeee);
    box-shadow: 0 8px 20px rgba(193, 192, 185, 0.25);
    width: 320px;
    max-height: 700px;
    height: 530px;
    position: relative; /* ضروري ليعمل z-index للـ tooltip */
}

/* الجزء العلوي الثابت */
.building-label {
    background: #126046;
    color: #fff;
    font-weight: bold;
    padding: 12px 0;
    font-size: 18px;
    user-select: none;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* محتوى الطوابق القابل للتمرير */
.building-floors {
    flex-grow: 1;
    overflow-y: auto;
}

/* الجزء السفلي الثابت للمواقف */
.parking-floor {
    background: linear-gradient(to top, #f6f6f6, #eeeeee);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 10px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

    .parking-floor .apartment {
        background: #ccc !important;
        color: #000;
        border: 1px solid #bbb;
        box-shadow: none;
        transform: none !important;
    }

        .parking-floor .apartment:hover {
            /*transform: none !important;*/
            transform: scale(1.1);
            /*z-index: 1;*/
            z-index: 2;
        }

.floor {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 30px 12px 12px 12px;
    border-top: 1px solid #999;
    background: #f5f5f5;
    overflow: visible;
    z-index: 1;
    position: relative;
}

    .floor::before {
        content: attr(data-floor);
        position: absolute;
        right: 8px;
        top: 6px;
        font-size: 14px;
        font-weight: bold;
        color: #126046;
        background-color: rgba(255, 255, 255, 0.85);
        padding: 4px 10px;
        border-radius: 6px;
        user-select: none;
        box-shadow: 0 0 5px rgba(0,0,0,0.1);
        z-index: 10;
    }

.apartment {
    width: 50px;
    height: 50px;
    min-width: 40px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    border: 1px solid #126046;
    box-shadow: inset -2px -2px 5px rgba(255,255,255,0.5), inset 2px 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    user-select: none;
    z-index: 1;
    flex: 1 1 40px;
}

    .apartment:hover {
        transform: scale(1.1);
        z-index: 2;
    }

.available {
    background: linear-gradient(to bottom, #4caf50, #388e3c);
}

.reserved {
    background: linear-gradient(to bottom, #ff9800, #ef6c00);
}

.sold {
    background: linear-gradient(to bottom, #e53935, #b71c1c);
}

.tooltip {
    position: absolute;
    bottom: 60px;
    right: -110px;
    background: #fff;
    color: #333;
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    font-size: 12px;
    white-space: nowrap;
    /*z-index: 999999;*/
    z-index: 1000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.apartment:hover .tooltip,
.apartment.show-tooltip .tooltip {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.parking-icon {
    width: 20px;
    height: 20px;
    fill: #126046;
}

    .parking-icon.two-spots {
        fill: #a67c00;
    }

@media (max-width: 400px) {
    .apartment {
        width: 40px;
        height: 40px;
        font-size: 10px;
    }

    .tooltip {
        font-size: 11px;
        padding: 6px 8px;
        bottom: 50px;
        right: -70px;
    }
}

.floors-container {
    overflow-y: auto;
    max-height: 700px; /* أو أي ارتفاع يناسبك */
}

.info-card {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9999999;
    min-width: 140px;
}


.apartment:hover .info-card {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.details-panel {
    margin-top: 20px;
    padding: 15px 20px;
    border: 2px solid #126046;
    border-radius: 10px;
    background: #fefee9;
    font-size: 14px;
    color: #126046;
    min-height: 80px;
    user-select: none;
}
