/* Property Details Page Layout and Styles */

/* General Layout for Property Details Page */
.property-details-page-wrapper {
    display: grid;
    grid-template-columns: 300px 1fr; /* Left Sidebar (increased to 260px), Main Content */
    gap: 30px; /* Space between columns */
    padding: 40px 20px; /* Vertical and horizontal padding for the whole page wrapper */
    min-height: 80vh;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

/* Sidebars */
.left-sidebar {
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Specific overrides for the filter section when it's in the left sidebar */
.left-sidebar .filter-section {
    padding: 0;
    box-shadow: none;
    background-color: transparent;
    color: inherit;
    text-align: left;
}

/* Hide main titles of the filter section when in sidebar */
.left-sidebar .filter-section .section-title,
.left-sidebar .filter-section .section-subtitle {
    display: none;
}

/* Make filter form items stack vertically in the sidebar */
.left-sidebar .property-filter-form {
    padding: 0;
    box-shadow: none;
    background-color: transparent;
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.left-sidebar .filter-group {
    margin-bottom: 0;
}

.left-sidebar .btn-search {
    width: 100%;
    margin-top: 15px;
}

/* Main Content Area */
.main-content-area {
    background-color: #ffffff;
    padding: 30px; /* This padding creates the intrinsic margin from its own edges */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    box-sizing: border-box; /* Crucial to include padding in width/height calculations */
}

/* NEW: Wrapper for the actual property content to control its max-width */
.property-main-content-wrapper {
    max-width: 900px; /* Fixed max-width for the main image and gallery */
    margin: 0 auto; /* Center this wrapper within the .main-content-area's padding */
    padding: 0; /* No extra padding inside this wrapper, content itself will provide spacing */
    box-sizing: border-box;
}

.property-main-content-wrapper h1.property-title {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
}

.property-main-content-wrapper .property-location {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}
.property-main-content-wrapper .property-location .fas {
    margin-right: 8px;
    color: #007bff;
}

/* Main Property Image - Now fits within the new wrapper */
.main-property-image {
    width: 100%; /* Takes 100% of its parent (.property-main-content-wrapper) */
    max-width: 100%;
    max-height: 400px; /* Adjusted max height */
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 30px; /* Only bottom margin needed, centering by parent wrapper */
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f0f0f0;
    box-sizing: border-box;
}
.main-property-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensures entire image is visible, padding empty space with background-color */
    display: block;
}

/* Image Gallery Carousel - Now fits within the new wrapper */
.property-gallery-carousel-wrapper {
    position: relative;
    width: 100%; /* Takes 100% of its parent (.property-main-content-wrapper) */
    margin: 30px 0; /* Add top/bottom margin */
    overflow: hidden;
    box-sizing: border-box;
}
.property-gallery-carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
    padding: 0 15px; /* Visual padding for items, pushes items away from buttons */
    box-sizing: border-box;
}
.property-gallery-carousel .gallery-item {
    flex-shrink: 0;
    width: calc((100% / var(--gallery-items-per-view, 3)) - ((var(--gallery-items-per-view, 3) - 1) * 15px / var(--gallery-items-per-view, 3)) ); /* Adjusted for space between items and outer padding */
    padding: 10px;
    box-sizing: border-box;
    margin-right: 15px; /* Space between gallery items */
}
.property-gallery-carousel .gallery-item:last-child {
    margin-right: 0;
}
.property-gallery-carousel .gallery-item img {
    width: 100%;
    height: 150px; /* Fixed height for gallery images */
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s ease;
}
.property-gallery-carousel .gallery-item img:hover {
    transform: scale(1.05);
}

.property-gallery-carousel-wrapper .gallery-prev,
.property-gallery-carousel-wrapper .gallery-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    z-index: 10;
    font-size: 1.2rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}
.property-gallery-carousel-wrapper .gallery-prev:hover,
.property-gallery-carousel-wrapper .gallery-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
.property-gallery-carousel-wrapper .gallery-prev { left: 0px; }
.property-gallery-carousel-wrapper .gallery-next { right: 0px; }


/* Section Headings within property-main-content-wrapper */
.property-main-content-wrapper .property-features h2,
.property-main-content-wrapper .property-full-description h2,
.property-main-content-wrapper .property-video h2,
.property-main-content-wrapper .agent-contact-card h2 {
    font-size: 1.8rem;
    color: #333;
    margin-top: 40px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.property-main-content-wrapper .features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.property-main-content-wrapper .feature-item {
    background-color: #f7f7f7;
    padding: 15px 20px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: #555;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.property-main-content-wrapper .feature-item .fas {
    color: #007bff;
    margin-right: 10px;
    font-size: 1.2rem;
}

.property-main-content-wrapper .feature-item .property-price-display {
    font-weight: bold;
    color: #333;
}

.property-main-content-wrapper .property-full-description p {
    font-size: 1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 20px;
}

/* Property Video Section (Preview with Play Button) */
.property-main-content-wrapper .property-video .video-preview-thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    cursor: pointer;
    margin-bottom: 30px;
}

.property-main-content-wrapper .property-video .video-preview-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Dark overlay */
    z-index: 1;
}

.property-main-content-wrapper .property-video .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 123, 255, 0.8);
    color: #fff;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    z-index: 2; /* Above the overlay */
}

.property-main-content-wrapper .property-video .play-button:hover {
    background-color: rgba(0, 86, 179, 0.9);
    transform: translate(-50%, -50%) scale(1.1);
}

/* Video Modal Styles */
.video-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 10000; /* Sit on top of everything */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black background with transparency */
    justify-content: center;
    align-items: center;
}

.video-modal-content {
    position: relative;
    margin: auto;
    width: 90%;
    max-width: 900px; /* Max width for the video player */
    background-color: #000; /* Black background for video */
    border-radius: 8px;
    overflow: hidden; /* Ensures video stays within bounds */
}

.video-modal-content video, .video-modal-content iframe {
    width: 100%;
    height: auto;
    display: block; /* Remove extra space below video */
    aspect-ratio: 16 / 9; /* Ensure aspect ratio for embedded video */
}

.close-video-modal {
    position: absolute;
    top: 10px;
    right: 25px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001; /* Ensure close button is above video */
}

.close-video-modal:hover,
.close-video-modal:focus {
    color: #bbb;
    text-decoration: none;
}


/* Agent Contact Card (Moved to main content area and within property-main-content-wrapper) */
.property-main-content-wrapper .agent-contact-card {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    text-align: center;
    margin-top: 40px; /* Space from elements above */
}

.property-main-content-wrapper .agent-info {
    margin-bottom: 25px;
}

.property-main-content-wrapper .agent-image {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 15px;
    border: 3px solid #007bff;
}

.property-main-content-wrapper .agent-info h3 {
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 10px;
}

.property-main-content-wrapper .agent-info p {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.property-main-content-wrapper .agent-info p .fas {
    margin-right: 8px;
    color: #007bff;
}

.property-main-content-wrapper .agent-contact-form {
    text-align: left;
}

.property-main-content-wrapper .agent-contact-form .form-group {
    margin-bottom: 15px;
}

.property-main-content-wrapper .agent-contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

.property-main-content-wrapper .agent-contact-form input[type="text"],
.property-main-content-wrapper .agent-contact-form input[type="email"],
.property-main-content-wrapper .agent-contact-form input[type="tel"],
.property-main-content-wrapper .agent-contact-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 1rem;
    color: #495057;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.property-main-content-wrapper .agent-contact-form input:focus,
.property-main-content-wrapper .agent-contact-form textarea:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.property-main-content-wrapper .agent-contact-form .btn-primary {
    width: 100%;
    padding: 12px 20px;
    margin-top: 10px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.property-main-content-wrapper .agent-contact-form .btn-primary:hover {
    filter: brightness(90%);
    transform: translateY(-2px);
}

.property-main-content-wrapper .agent-contact-card .message-area {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    text-align: center;
}
.property-main-content-wrapper .agent-contact-card .message-area.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.property-main-content-wrapper .agent-contact-card .message-area.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }


/* Responsive Adjustments */
@media (max-width: 992px) {
    .property-details-page-wrapper {
        grid-template-columns: 1fr; /* Single column layout for tablet */
        padding: 30px 15px;
        gap: 30px;
    }
    .left-sidebar {
        grid-column: 1 / 2;
        grid-row: 2 / 3; /* Filter moves below main content on tablet */
    }
    .main-content-area {
        grid-column: 1 / 2;
        grid-row: 1 / 2; /* Main content remains at the top */
    }

    .property-main-content-wrapper {
        max-width: 100%; /* Allow wrapper to fill main-content-area on smaller screens */
    }

    .main-property-image {
        max-height: 350px; /* Adjusted for tablets */
    }
    .property-gallery-carousel-wrapper {
        padding: 0;
        margin: 30px 0;
        width: 100%;
    }
    .property-gallery-carousel {
        padding: 0 40px; /* Re-add padding here for button clearance */
    }
    .property-gallery-carousel .gallery-item {
        width: calc((100% / var(--gallery-items-per-view, 2)) - ((var(--gallery-items-per-view, 2) - 1) * 15px / var(--gallery-items-per-view, 2)) ); /* Show 2 items on tablet */
    }
}

@media (max-width: 768px) {
    .property-details-page-wrapper {
        grid-template-columns: 1fr; /* Single column layout for mobile */
        padding: 20px 10px;
        gap: 20px;
    }

    .left-sidebar, .main-content-area {
        grid-column: 1 / 2;
        grid-row: auto;
        padding: 20px;
    }

    .property-main-content-wrapper {
        max-width: 100%; /* Allow wrapper to fill main-content-area on smaller screens */
    }

    .property-main-content-wrapper h1.property-title {
        font-size: 2rem;
    }
    .property-main-content-wrapper .property-location {
        font-size: 1rem;
    }

    .main-property-image {
        max-height: 280px; /* Adjusted for mobile */
    }

    .property-gallery-carousel-wrapper {
        padding: 0;
        margin: 20px 0;
        width: 100%;
    }
    .property-gallery-carousel {
        padding: 0 30px; /* Reduced padding for button clearance */
    }
    .property-gallery-carousel .gallery-item {
        width: calc(100% - 15px); /* Show 1 item on mobile, adjust for margin */
    }
    .property-gallery-carousel .gallery-item img {
        height: 120px;
    }

    .property-main-content-wrapper .property-features h2,
    .property-main-content-wrapper .property-full-description h2,
    .property-main-content-wrapper .property-video h2,
    .property-main-content-wrapper .agent-contact-card h2 {
        font-size: 1.5rem;
        margin-top: 30px;
        margin-bottom: 15px;
    }
    .property-main-content-wrapper .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    .property-main-content-wrapper .feature-item {
        font-size: 0.9rem;
        padding: 12px 15px;
    }
    .property-main-content-wrapper .feature-item .fas {
        font-size: 1rem;
    }

    .property-main-content-wrapper .property-full-description p {
        font-size: 0.95rem;
    }

    .property-main-content-wrapper .agent-contact-card {
        padding: 20px;
        margin-top: 30px;
    }
    .property-main-content-wrapper .agent-contact-card h2 {
        font-size: 1.4rem;
    }
    .property-main-content-wrapper .agent-info h3 {
        font-size: 1.2rem;
    }
    .property-main-content-wrapper .agent-info p {
        font-size: 0.9rem;
    }
    .property-main-content-wrapper .agent-contact-form input, .property-main-content-wrapper .agent-contact-form textarea {
        font-size: 0.9rem;
        padding: 8px 10px;
    }
    .property-main-content-wrapper .agent-contact-form .btn-primary {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .main-property-image {
        max-height: 200px; /* Further adjusted for very small mobile screens */
    }
    .property-gallery-carousel {
        padding: 0 25px;
    }
    .property-gallery-carousel .gallery-item {
        padding: 5px;
    }
    .property-gallery-carousel-wrapper .gallery-prev,
    .property-gallery-carousel-wrapper .gallery-next {
        padding: 8px;
        font-size: 1rem;
    }
}

/* ... existing CSS ... */

/* NEW: Styles for video modal players */
.video-modal-content video {
    background-color: #000; /* Ensure black background if no poster or poster fails */
    width: 100%;
    height: auto;
    display: block; /* Always block, controlled by opacity for flash */
    aspect-ratio: 16 / 9;
    opacity: 0; /* Hidden by default when not playing or loaded */
    transition: opacity 0.3s ease; /* Smooth fade in/out */
}

.video-modal-content video.is-playing {
    opacity: 1; /* Show video when playing */
}

.video-modal-content iframe {
    background-color: #000; /* Ensure black background if iframe content not loaded */
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 16 / 9;
}

/* Ensure the poster is visible when video is not playing/loaded but present */
.video-modal-content video:not(.is-playing) {
    /* When a poster is present, it should handle the visual state */
    /* If no poster, it will default to browser's black background or first frame. */
}

/* Property Details Page Layout and Styles */

/* ... (existing CSS for general layout) ... */

/* NEW: Styles for the PDF Export Button */
.property-actions {
    display: flex; /* Make it a flex container */
    justify-content: flex-end; /* Align button to the right by default */
    margin-bottom: 20px;
    padding-right: 15px; /* Adjust padding if needed to match container */
}

.btn-export-pdf {
    display: inline-flex; /* Ensure it's always displayed */
    align-items: center;
    gap: 8px; /* Space between icon and text */
    padding: 10px 20px;
    background-color: #dc3545; /* Example color: red */
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.btn-export-pdf:hover {
    background-color: #c82333; /* Darker red on hover */
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    /* ... (existing tablet styles) ... */

    .property-actions {
        justify-content: center; /* Center button on tablet */
        padding: 0 15px; /* Adjust padding */
    }
}

@media (max-width: 768px) {
    /* ... (existing mobile styles) ... */

    .property-actions {
        justify-content: center; /* Center button on mobile */
        padding: 0 10px; /* Adjust padding */
        margin-bottom: 15px;
    }

    .btn-export-pdf {
        width: 100%; /* Make button full width on small mobiles */
        text-align: center;
        justify-content: center; /* Center content within button */
        padding: 12px 15px;
        font-size: 0.95rem;
    }
}

/* ... (rest of your file) ... */