/* --- 1. Reset & Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* --- 2. Container & Image --- */
.building-container {
    position: relative; 
    width: 100%;
    max-width: 1400px;
    margin: auto;
    overflow: hidden;
}

.building-img {
    width: 100%;
    height: auto;
    display: block;
}

.interactive-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

/* --- 3. View Navigation & Animations --- */
.view-navigation {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(247, 247, 244, 0.9);
    padding: 10px 25px;
    border-radius: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    z-index: 20;
}

.nav-arrow {
    background: none;
    border: none;
    font-size: 24px;
    color: #115363;
    cursor: pointer;
    transition: color 0.3s;
    padding: 0 10px;
}

.nav-arrow:hover {
    color: #ccb291;
}

#view-indicator {
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    min-width: 80px;
    text-align: center;
}

.fade-transition {
    transition: opacity 0.4s ease-in-out;
}

.fade-out {
    opacity: 0.2;
}

/* --- 4. Interactive Polygons --- */
.unit {
    fill: rgba(255, 255, 255, 0);
    stroke: rgba(255, 255, 255, 0);
    stroke-width: 2;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}

/* --- 5. Rich Tooltip Styles --- */
.tooltip {
    position: fixed;
    top: 0;
    left: 0;
    background-color: #f7f7f4;
    color: #333;
    padding: 12px 15px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    pointer-events: none;
    z-index: 9999;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    direction: ltr;
    width: 230px;
    max-width: 85vw;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.close-icon {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 20px;
    color: #115363;
    cursor: pointer;
    font-weight: bold;
}

.plan-img {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    margin-top: 12px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.data-tags {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    margin-bottom: 15px;
}

.tag {
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fff;
    text-align: center;
    flex: 1;
}

.type-tag { background-color: #0b5360; }
.unit-tag { background-color: #5c1836; }
.status-tag { background-color: #e60000; text-transform: uppercase; }
.status-tag.available { background-color: #009933; }

.details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: #333;
    font-size: 0.9rem;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #115363;
}

.main-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #d1d1d1;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    text-align: center;
}

.main-btn.available {
    background-color: #ccb291;
    color: #1a1a1a;
    cursor: pointer;
    pointer-events: auto;
}

.main-btn.available:hover {
    background-color: #b59b7b;
}

/* --- 6. Responsive Design --- */
@media screen and (max-width: 768px), screen and (max-height: 600px) {
    .tooltip {
        width: 200px;
        padding: 10px;
    }
    .plan-img {
        max-height: 130px;
        margin-top: 8px;
        margin-bottom: 8px;
    }
    .data-tags { margin-bottom: 10px; }
    .tag { font-size: 0.75rem; padding: 4px; }
    .details-row {
        font-size: 0.8rem;
        margin-bottom: 10px;
        padding-top: 8px;
    }
    .details-row svg { width: 16px; height: 16px; }
    .main-btn { font-size: 0.85rem; padding: 8px; }
    .view-navigation { bottom: 15px; padding: 8px 15px; }

   /* --- Transition Video Styles --- */
.transition-vid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* باعث می‌شود ابعاد ویدیو دقیقاً با عکس مچ شود */
    z-index: 15; /* ویدیو را بالاتر از عکس (با ایندکس پایین‌تر) قرار می‌دهد */
    display: none;
}

/* --- 6. Responsive Design --- */
@media screen and (max-width: 768px) {
    /* جلوگیری از هل دادن محتوا */
    .building-container {
        display: block; /* از حالت flex خارج کن */
        position: relative;
    }

    .tooltip {
        position: fixed; /* شناور روی صفحه */
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        max-width: 100%;
        border-radius: 0 0 20px 20px;
        transform: none !important;
        z-index: 1000; /* بالاتر از همه چیز */
        pointer-events: auto;
        display: none; /* فقط وقتی کلیک شد ظاهر شود */
        background: rgba(247, 247, 244, 0.98); /* کمی شفافیت برای شیک شدن */
        backdrop-filter: blur(10px); /* افکت شیشه ای */
    }

    /* نویگیشن ویوها را کمی پایین تر میبریم که با تولتیپ تداخل نداشته باشد */
    .view-navigation {
        bottom: 20px;
        z-index: 50;
    }

    /* جلوگیری از پرش تصویر اصلی */
    #main-building-img, .interactive-layer, #transition-canvas {
        position: relative;
        top: 0;
        left: 0;
    }
}