/* --- PROPERTY DETAILS PAGE LAYOUT --- */
.property-container { max-width: 1300px; margin: 40px auto; padding: 0 20px; display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.prop-main { min-width: 0; } /* CRITICAL: Prevents large images from blowing out the CSS Grid */

/* --- TOP BREADCRUMBS & ACTIONS --- */
.prop-top-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; color: #666; font-size: 0.9rem; }
.breadcrumbs a { color: var(--rlp-red); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.prop-actions { display: flex; gap: 10px; }
.prop-actions button { background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 6px 12px; cursor: pointer; color: var(--text-dark); transition: 0.2s; font-size: 1rem; }
.prop-actions button:hover { background: #f0f0f0; border-color: #ccc; }

/* --- HEADER (Title, Badges, Price) --- */
.prop-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; grid-column: 1 / -1; }
.prop-title-wrap h1 { font-size: 2.2rem; margin: 0 0 15px 0; color: var(--text-dark); font-weight: 400; }
.prop-badges { display: flex; gap: 10px; margin-bottom: 15px; }
.badge { padding: 4px 10px; font-size: 0.75rem; font-weight: 700; border-radius: 3px; color: #fff; text-transform: uppercase; }
.badge-red { background: var(--rlp-red); }
.badge-dark { background: #555; }
.prop-address { color: #666; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.prop-price { font-size: 2.5rem; font-weight: 600; color: var(--text-dark); margin: 0; }

/* --- IMAGE GALLERY --- */
/* --- IMAGE GALLERY --- */
.gallery-main { 
    width: 100%; 
    height: 500px; 
    border-radius: 4px; 
    overflow: hidden; 
    margin-bottom: 10px; 
    position: relative; 
    background-color: #f4f4f4; /* ADDED: A light gray background */
}
/* --- IMAGE GALLERY --- */
.gallery-main img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
    cursor: zoom-in; /* ADDED: Shows a magnifying glass cursor on hover */
}
.gallery-thumbs { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; }
.gallery-thumbs::-webkit-scrollbar { display: none; }
.thumb { width: 120px; height: 80px; flex-shrink: 0; cursor: pointer; border-radius: 4px; opacity: 0.6; transition: 0.2s; object-fit: cover; border: 2px solid transparent; }
.thumb:hover, .thumb.active { opacity: 1; border-color: var(--rlp-red); }

/* --- OVERVIEW BAR --- */
.prop-overview { display: flex; justify-content: space-between; background: #fff; padding: 25px; border-radius: 4px; border: 1px solid var(--border); margin: 30px 0; flex-wrap: wrap; /* Add this */
    gap: 20px; }
.overview-item { display: flex; flex-direction: column; gap: 5px; }
.overview-item strong { font-size: 1.1rem; color: var(--text-dark); }
.overview-item span { font-size: 0.85rem; color: #888; }
.overview-item i { font-size: 1.2rem; color: #888; margin-bottom: 5px; }

/* --- CONTENT SECTIONS --- */
.prop-section { background: #fff; padding: 30px; border-radius: 4px; border: 1px solid var(--border); margin-bottom: 30px; }
.prop-section h3 { font-size: 1.4rem; margin-top: 0; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--border); font-weight: 400; }
.prop-desc { line-height: 1.7; color: #555; font-size: 0.95rem; }

/* --- ROOMS TABLE --- */
.rooms-level { margin-bottom: 20px; }
.rooms-level h4 { font-size: 1.1rem; color: var(--text-dark); margin-bottom: 10px; font-weight: 400; }
.room-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.95rem; }
.room-row:last-child { border-bottom: none; }
.room-name { font-weight: 500; color: #444; }
.room-size { color: #888; }

/* --- DETAILS GRIDS --- */
.details-highlight { background: #eef8fc; border: 1px solid #bce0ef; padding: 20px; border-radius: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 40px; }
.detail-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.95rem; }
.detail-item strong { color: var(--text-dark); font-weight: 600; }
.detail-item span { color: #666; text-align: right; }

/* --- MORTGAGE CALCULATOR --- */
.mortgage-calc { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; align-items: center; margin-bottom: 30px; }
.calc-chart { text-align: center; }
.calc-chart-circle { width: 180px; height: 180px; border-radius: 50%; border: 15px solid var(--rlp-red); display: flex; flex-direction: column; justify-content: center; margin: 0 auto; }
.calc-monthly { font-size: 1.8rem; font-weight: 700; color: var(--text-dark); }
.calc-breakdown { font-size: 0.95rem; }
.calc-breakdown .row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #eee; }
.calc-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.calc-group label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.calc-group input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 4px; outline: none; }
.calc-btn { background: #00aeef; color: white; border: none; padding: 10px 25px; border-radius: 4px; font-weight: bold; cursor: pointer; margin-top: 15px; }

/* --- AGENT SIDEBAR --- */
.agent-sidebar { position: sticky; top: 100px; background: #fff; padding: 30px; border-radius: 4px; border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.agent-profile { display: flex; align-items: center; gap: 15px; margin-bottom: 25px; }
.agent-profile img { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; }
.agent-profile h4 { margin: 0 0 5px 0; font-size: 1.1rem; font-weight: 400; }
.agent-profile a { color: var(--rlp-red); font-size: 0.85rem; font-weight: 600; }
.agent-form input, .agent-form textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 15px; font-family: inherit; }
.agent-form textarea { resize: vertical; min-height: 100px; }
.agent-checkbox { display: flex; gap: 10px; font-size: 0.8rem; color: #666; margin-bottom: 20px; align-items: flex-start; }
.btn-solid, .btn-outline { width: 100%; padding: 12px; border-radius: 4px; font-weight: 600; cursor: pointer; font-size: 1rem; text-align: center; display: block; margin-bottom: 10px; }
.btn-solid { background: var(--rlp-red); color: #fff; border: none; transition: 0.2s; }
.btn-solid:hover { background: #c20031; }
.btn-outline { background: transparent; color: var(--rlp-red); border: 1px solid var(--rlp-red); transition: 0.2s; }
.btn-outline:hover { background: #fff5f7; }

/* --- PHOTO MODAL STYLES --- */
.photo-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    align-items: center;
    justify-content: center;
}
.photo-modal.active {
    display: flex;
}
.modal-content {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    user-select: none; /* Makes swiping smoother */
}
.modal-close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000;
}


/* --- EXPANDABLE SECTIONS --- */
.expandable-content {
    position: relative;
    max-height: 180px; /* Adjust this to show more/less default text */
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

/* This is the class our JS will add when clicked */
.expandable-content.expanded {
    max-height: 3000px; /* An arbitrarily large number to fit any content */
    transition: max-height 0.6s ease-in;
}

/* The fade-out gradient at the bottom */
.expandable-content::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    pointer-events: none;
    transition: opacity 0.3s;
}

/* Hide the gradient when fully expanded */
.expandable-content.expanded::after {
    opacity: 0;
}

/* The toggle button */
.show-more-btn {
    background: none;
    border: none;
    color: var(--rlp-red);
    font-weight: 600;
    cursor: pointer;
    padding: 10px 0 0 0;
    font-size: 0.95rem;
    display: inline-block;
}
.show-more-btn:hover {
    text-decoration: underline;
}

/* --- MODAL DESKTOP NAVIGATION --- */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 60px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100000;
    padding: 20px;
    user-select: none;
    transition: 0.2s;
}
.modal-nav:hover { color: var(--rlp-red); }
.modal-prev { left: 20px; }
.modal-next { right: 20px; }

.modal-thumbs {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
}
.modal-thumb {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.5;
    transition: 0.2s;
}
.modal-thumb:hover, .modal-thumb.active {
    opacity: 1;
    border-color: var(--rlp-red);
}

/* --- RESPONSIVE IFRAMES (Map & Tour) --- */
.responsive-iframe {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    border-radius: 4px;
    background: #f4f4f4;
}
.responsive-iframe iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
/* --- MOBILE SPACING FIX --- */
/* --- ALL MOBILE RESPONSIVE FIXES --- */
@media (max-width: 992px) {
    /* 1. Force the main container into a single stacked column (Fixes the squish!) */
    .property-container { grid-template-columns: 1fr; }
    
    /* 2. Stack header elements */
    .prop-header { flex-direction: column; gap: 15px; }
    .prop-top-bar { flex-direction: column; align-items: flex-start; gap: 15px; }
    
    /* 3. Stack grid items in details and calc */
    .details-highlight, .details-grid, .calc-inputs { grid-template-columns: 1fr; }
    .mortgage-calc { grid-template-columns: 1fr; }
    
    /* 4. Fix overview icons layout */
    .prop-overview {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 20px;
    }
    .prop-overview .overview-item:first-child {
        grid-column: 1 / -1;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 10px;
    }

    /* 5. Force the image gallery to wrap tightly on mobile */
    .gallery-main { 
        height: auto !important; 
        background: transparent !important; 
        padding: 0;
    }
    .gallery-main img { 
        height: auto !important; 
        display: block; 
    }
    /* Hide desktop modal navigation on mobile */
    .modal-nav, .modal-thumbs { display: none !important; }
}
/* ADD THIS: Structure the overview bar for mobile phones */
@media (max-width: 576px) {
    .prop-overview {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Make the MLS number take up the full row so it doesn't squish */
    .prop-overview .overview-item:first-child {
        grid-column: 1 / -1;
        padding-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
        margin-bottom: 10px;
    }
}

/* --- MOBILE STICKY CONTACT BAR & MODAL --- */
.mobile-contact-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 15px 20px;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.1);
    z-index: 9999;
    gap: 15px;
}
.mobile-contact-bar .btn-solid, .mobile-contact-bar .btn-outline {
    margin-bottom: 0;
    flex: 1;
}

/* Background overlay when the modal is open */
.agent-modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 99998;
}
.agent-modal-backdrop.active { display: block; }

/* The X Close button (Injected via JS) */
.agent-modal-close {
    display: none;
    position: absolute;
    top: 15px; right: 20px;
    font-size: 28px;
    color: #333;
    cursor: pointer;
    z-index: 100000;
}


/* --- ENHANCED SHARE MODAL --- */
.share-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 450px;
    width: 90%;
    position: relative;
    text-align: left;
}
.share-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #111;
    font-size: 1.3rem;
    font-weight: 700;
}
.share-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    transition: 0.2s;
}
.share-close:hover { color: #111; }

.share-social-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 5px;
}
.share-social-row a, .share-social-row button {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #111;
    font-size: 1.1rem;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
}
.share-social-row a:hover, .share-social-row button:hover {
    border-color: #111;
    background: #f8f9fa;
}

.share-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}
.share-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #eee;
    z-index: 1;
}
.share-divider span {
    background: #fff;
    padding: 0 15px;
    color: #777;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
}

.share-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.share-form-row {
    display: flex;
    gap: 15px;
}
.share-form input, .share-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.share-form input:focus, .share-form textarea:focus {
    border-color: var(--rlp-red);
}
.share-form textarea { resize: vertical; }
.share-form .btn-solid { margin-bottom: 0; font-size: 1.05rem; }

@media (max-width: 576px) {
    .share-form-row { flex-direction: column; gap: 15px; }
}
@media (max-width: 992px) {
    /* Show the sticky bar and add padding so the website footer isn't covered */
    .mobile-contact-bar { display: flex; }
    body { padding-bottom: 80px; } 
    
    /* Hide the original inline form buttons so we don't have duplicates */
    .agent-form .btn-solid, .agent-form .btn-outline { display: none; }
    
    /* Transform the sidebar into a floating modal when the 'is-modal' class is applied */
    .agent-sidebar.is-modal {
        position: fixed;
        top: 50%; left: 50%;
        transform: translate(-50%, -50%);
        width: 90%;
        max-height: 90vh;
        overflow-y: auto;
        z-index: 99999;
        margin: 0;
    }
    
    /* Un-hide the "Send Message" button inside the form when the modal is open */
    .agent-sidebar.is-modal .agent-form .btn-solid { display: block; }
    .agent-sidebar.is-modal .agent-modal-close { display: block; }
}