.back-button {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.main-content {
    display: flex;
    gap: 2rem;
    min-height: 600px;
    background: #FFF !important;
    padding-bottom: 60px;
}

.planimetry-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
}

.planimetry-wrapper {
    position: relative;
    width: 100%;
    max-width: 1250px;
    background: transparent;
}

.planimetry-image {
    width: 100%;
    height: auto;
    border-radius: 22px;
    cursor: crosshair;
    display: block;
}

.planimetry-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.planimetry-badge i {
    color: #f79c12;
}

@media (max-width: 768px) {
    /* Stay position:absolute (out of flow) so this never affects
       .planimetry-wrapper's box size — the apartment-area hotspots are
       positioned as percentages of that box and must line up with the
       floor plan image exactly. Shift up by the badge's own rendered
       height (+12px gap) via transform, which — unlike top/bottom
       percentages — doesn't depend on .planimetry-wrapper having a
       definite height, so it stays correct even if the badge grows
       (e.g. longer translated text wrapping to 2 lines). */
    .planimetry-badge {
        top: 0;
        transform: translateY(calc(-100% - 12px));
    }
}

/* Simple floor-plan PDF download button, sits inline in .header-tags
   alongside the location/building pills. */
.planimetry-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.7rem 1.4rem;
    background: #f79c12;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.25s ease;
}

.planimetry-download-btn:hover {
    background: #1a1a1a;
    color: #fff;
    transform: translateY(-2px);
}

/* Apartment hover areas */
.apartment-area {
    position: absolute;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.apartment-area:hover {
    background: rgba(247, 156, 18, 0.3);
    border-color: #f79c12;
    box-shadow: 0 0 20px rgba(247, 156, 18, 0.6);
    transform: scale(1.02);
    z-index: 10;
}

.apartment-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,0.95);
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    color: #2c3e50;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
}

.apartment-area:hover .apartment-label {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.instructions {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    border-left: 4px solid #2196f3;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.instructions h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.legend {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.legend h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: #f0f0f0;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid #ddd;
}

.legend-color.available {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4caf50;
}

.legend-color.reserved {
    background: rgba(255, 152, 0, 0.3);
    border-color: #ff9800;
}

.legend-color.sold {
    background: rgba(99, 102, 255, 0.3);
    border-color: #f44336;
}

/* Image loading error */
.image-error {
    display: none;
    text-align: center;
    padding: 2rem;
    color: #f44336;
    background: #ffebee;
    border-radius: 10px;
    margin: 1rem 0;
}

.image-error.show {
    display: block;
}

/* ===================== */
/*   MODAL - REDESIGNED  */
/* ===================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: #fff;
    margin: 10px auto;
    padding: 0;
    width: 92%;
    max-width: 720px;
    max-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.modal-body {
    padding: 0;
    overflow-y: auto;
}

/* Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #fff;
    color: #111;
    border-bottom: 1px solid #eef0f3;
    margin-bottom: 0;
}

.modal-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: #111;
    letter-spacing: 0.3px;
}

.close {
    color: #666;
    background: #f3f3f3;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.close:hover {
    color: #fff;
    background: #f79c12;
}

/* Image Section */
.modal-image-section {
    position: relative;
    background: #f0f2f5;
}

.modal-image-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
}

.modal-image-tab {
    flex: 1;
    padding: 8px 16px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #888;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.modal-image-tab:hover {
    color: #555;
    background: #f0f0f0;
}

.modal-image-tab.active {
    color: #111;
    background: #fff;
}

.modal-image-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #f79c12;
    border-radius: 3px 3px 0 0;
}

.modal-image-display {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 185px;
    max-height: 210px;
    overflow: hidden;
    background: #f5f6f8;
}

.modal-image-display img {
    max-width: 100%;
    max-height: 210px;
    object-fit: contain;
    display: block;
}

/* Larger preview on desktop only — mobile keeps the compact sizing above
   (and its own @media (max-width: 600px) override further down). */
@media (min-width: 601px) {
    .modal-image-display {
        min-height: 300px;
        max-height: 300px;
    }

    .modal-image-display img {
        max-height: 300px;
    }
}

/* Specs Section */
.modal-specs {
    padding: 12px 20px;
}

.modal-specs-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.spec-card {
    background: #f8f9fb;
    border-radius: 10px;
    padding: 7px 10px;
    text-align: center;
    border: 1px solid #eef0f3;
    transition: border-color 0.2s ease;
}

.spec-card:hover {
    border-color: #d0d5dd;
}

.spec-card-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8a919c;
    margin-bottom: 3px;
}

.spec-card-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1a2332;
}

/* Status & Floor row */
.modal-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fb;
    border-radius: 10px;
    margin-bottom: 0;
    border: 1px solid #eef0f3;
}

.modal-status-row .status-label,
.modal-status-row .floor-label {
    font-size: 0.8rem;
    color: #8a919c;
    font-weight: 500;
    margin-bottom: 2px;
}

.modal-status-row .status-value,
.modal-status-row .floor-value {
    font-weight: 700;
    font-size: 0.95rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-badge.status-available {
    background: #e6f7ed;
    color: #1a7a3a;
}

.status-badge.status-reserved {
    background: #fff3e0;
    color: #c67100;
}

.status-badge.status-sold {
    background: #ffebee;
    color: #c62828;
}

/* WhatsApp Contact Button */
.contact-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.contact-button:hover {
    background: #1fb855;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.contact-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.contact-button svg {
    flex-shrink: 0;
}

/* Modal CTA block */
.modal-cta {
    padding: 12px 20px 16px;
    border-top: 1px solid #eef0f3;
}

.modal-cta-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1.25rem;
    color: #111;
    margin: 0 0 0.35rem;
    line-height: 1.2;
}

.modal-cta-desc {
    color: #666;
    font-size: 0.78rem;
    line-height: 1.4;
    margin: 0 0 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-cta-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-cta-buttons .contact-button {
    flex: 1;
    min-width: 180px;
    padding: 10px 20px;
}

.modal-cta-btn-outline {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    color: #111;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.modal-cta-btn-outline:hover {
    border-color: #111;
    background: #111;
    color: #fff;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e9ecef;
    }
}

@media (max-width: 600px) {
    .modal-content {
        width: 96%;
        margin: 20px auto;
        border-radius: 12px;
    }

    .modal-specs-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-image-display {
        min-height: 200px;
        max-height: 260px;
    }

    .modal-header {
        padding: 14px 18px;
    }

    .modal-specs {
        padding: 18px;
    }
}

@media (max-width: 768px) {
    .header-left h1 {
        font-size: 2rem;
    }

    .planimetry-container {
        padding: 1rem;
    }

    .sidebar {
        padding: 1rem;
    }
}

.folder-navigation {
    color: #666;
    margin-top: 20px;
    font-size: 16px;
}

.folder-navigation a {
    color: rgba(var(--bs-link-color-rgb),var(--bs-link-opacity,1));
    text-decoration: none;
    font-size: 16px;
}

/* --- Breadcrumb --- */
.crumb-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #888;
    margin-top: 20px;
}

.crumb-nav a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.25s ease;
}

.crumb-nav a:hover {
    color: #f79c12;
}

.crumb-nav .sep {
    color: #f79c12;
}

.crumb-nav .current {
    color: #111;
    font-weight: 600;
}

/* ===================== */
/*   HEADER (title area) */
/* ===================== */
.header {
    padding: 40px 0 20px;
}

.header-left h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: clamp(2rem, 4vw, 2.75rem);
    color: #111;
    margin: 0 0 1.2rem;
    line-height: 1.15;
}

.header-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.2rem;
}

.header-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #efece4;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 16px;
    border-radius: 10px;
}

.header-left p {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 620px;
    margin: 0;
}

/* ===================== */
/*   SIDEBAR (grey card)  */
/* ===================== */
.building-sidebar-card {
    background: #f8f9fa;
    border-radius: 24px;
    padding: 2rem;
    width: 340px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .building-sidebar-card {
        width: 100%;
    }
}

.sidebar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.sidebar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1a1a1a;
    background: #fff;
    padding: 6px 12px;
    border-radius: 999px;
}

.sidebar-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.sidebar-legend-dot.available { background: #4caf50; }
.sidebar-legend-dot.reserved { background: #ff9800; }
.sidebar-legend-dot.sold { background: #f44336; }

.sidebar-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #111;
    color: #fff;
    padding: 0.9rem 1.5rem;
    border-radius: .75rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    transition: all 0.25s;
}

.sidebar-back-btn:hover {
    background: #f79c12;
    color: #000;
}

.sidebar-floor-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8a8578;
    font-weight: 700;
    margin: 0 0 0.8rem;
}

.floor-pill-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 1.5rem;
    padding-left: 0;
}

.floor-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #ddd8c9;
    color: #1a1a1a !important;
    padding: 0.75rem 1.1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none !important;
    list-style: none;
    transition: all 0.2s ease;
}

.floor-pill:hover {
    border-color: #111;
}

.floor-pill.active {
    background: #111;
    border-color: #111;
    color: #fff !important;
}

.floor-pill a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    color: inherit !important;
    text-decoration: none !important;
}

.sidebar-elevations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-elevations img {
    width: 100%;
    border-radius: 14px;
    display: block;
}