:root {
    --qs-primary: #111111;
    /* Black */
    --qs-secondary: #000000;
    /* Black */
    --qs-text: #333;
    --qs-text-light: #666;
    --qs-border: #e0e0e0;
    --qs-bg: #ffffff;
    --qs-bg-light: #f9f9f9;
    --qs-accent: #333333;
    /* Dark Grey Accent */
    --qs-container-max: 1600px;
    --qs-container-pad: 40px;
}

* {
    box-sizing: border-box;
}

.qsidx-dashboard {
    font-size: 23px;
    /* Bumped up 25% from 18px */
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    /* Premium Font */
    color: var(--qs-text);
    background: var(--qs-bg-light);
    line-height: 1.6;
}

/* Entrance Animation */
@keyframes qsidxFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qsidx-container {
    max-width: var(--qs-container-max);
    margin: 0 auto;
    padding: var(--qs-container-pad);
    display: grid;
    /* Slightly wider gap for breathing room */
    grid-template-columns: 1fr 420px;
    gap: 40px;
    animation: qsidxFadeUp 0.8s ease-out forwards;
    /* Smooth Entrance */
}

/* Header - No longer needs grid-column since it's inside main content */
.qsidx-header {
    margin-bottom: 20px;
    padding-left: 0;
    display: none;
    /* Hiding "Back to Listings" as requested */
}

.qsidx-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--qs-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    transition: color 0.2s;
}

.qsidx-back-btn:hover {
    color: #444;
}

/* Explicit Grid Areas for Safety */
.qsidx-main-content {
    grid-column: 1 / 2;
    min-width: 0;
    /* Prevent grid blowout */
}

.qsidx-sidebar {
    grid-column: 2 / 3;
    min-width: 0;
    position: sticky;
    top: 40px;
    height: fit-content;
    z-index: 10;
}

/* Gallery */
.qsidx-gallery {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    /* 2.5:1 ratio for better alignment */
    gap: 16px;
    margin-bottom: 30px;
}

.qsidx-gallery-main {
    width: 100%;
    height: 600px;
    object-fit: cover;
    border-radius: 16px;
    /* Explicit Radius */
}

.qsidx-gallery-side {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 16px;
}

.qsidx-gallery-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Card */
.qsidx-card {
    background: var(--qs-bg);
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    margin-bottom: 30px;
}

.qsidx-heading {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 24px 0;
    color: var(--qs-primary);
}

/* Stats Grid - Modern Icons */
.qsidx-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.qsidx-stat-item {
    text-align: center;
}

.qsidx-stat-item .icon {
    font-size: 2rem;
    margin-bottom: 12px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qsidx-stat-item .icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--qs-primary);
    stroke-width: 1.5;
}

.qsidx-stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--qs-primary);
    margin-bottom: 6px;
}

.qsidx-stat-label {
    display: block;
    font-size: 1rem;
    color: var(--qs-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Description */
.qsidx-description {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--qs-text);
}

/* Property Details Grid Items */
.qsidx-detail-item {
    font-size: 1.1rem;
    /* Larger */
    padding: 16px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.qsidx-detail-label {
    color: #666;
}

.qsidx-detail-value {
    font-weight: 600;
    color: #000;
}

/* Amenities */
.qsidx-amenities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.qsidx-amenity {
    padding: 18px;
    background: var(--qs-bg-light);
    border-radius: 8px;
    font-size: 1.1rem;
    /* Larger */
    color: var(--qs-text);
    font-weight: 500;
}

/* Agent Card */
.qsidx-agent-card {
    text-align: center;
    border: 1px solid var(--qs-border);
}

.qsidx-agent-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 16px;
}

.qsidx-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.qsidx-agent-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--qs-primary);
}

.qsidx-agent-broker {
    font-size: 1rem;
    color: var(--qs-text-light);
    margin-bottom: 24px;
}

/* Share Icon - Absolute Top Right */
.qsidx-share-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.qsidx-share-icon:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.qsidx-share-icon svg {
    width: 18px;
    height: 18px;
}

/* Buttons - Black & White */
.qsidx-btn {
    display: block;
    width: 100%;
    padding: 18px 24px;
    background: #000;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s;
    margin-bottom: 16px;
    border: 2px solid #000;
}

.qsidx-btn:hover {
    background: #333;
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.qsidx-btn.secondary {
    background: transparent;
    color: #000;
    border: 2px solid #000;
}

.qsidx-btn.secondary:hover {
    background: #000;
    color: white;
}

/* Map */
.qsidx-map-placeholder {
    width: 100%;
    height: 300px;
    background: var(--qs-bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--qs-text-light);
    color: var(--qs-text-light);
    font-size: 0.95rem;
}

/* Disclaimer */
.qsidx-disclaimer {
    font-size: 0.8rem;
    color: #999;
    margin-top: 25px;
    text-align: center;
    border-top: 1px solid #eee;
    padding-top: 15px;
    line-height: 1.4;
    font-style: italic;
    /* When inside brokerage card, override specific styles via inline or here */
}

/* Large Text Classes */
.qsidx-price-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.qsidx-price {
    font-size: 2.8rem;
    font-weight: 800;
    color: #000;
    /* Black */
    margin-bottom: 8px;
    line-height: 1.1;
}

.qsidx-address {
    font-size: 1.6rem;
    font-weight: 500;
    color: #111;
    margin: 0;
    line-height: 1.3;
}

/* Global Image Safety */
.qsidx-dashboard img {
    max-width: 100%;
    height: auto;
}

/* Responsive */
@media (max-width: 1024px) {
    .qsidx-container {
        display: flex;
        flex-direction: column;
        padding: 20px;
        max-width: 100%;
    }

    .qsidx-header {
        margin-bottom: 20px;
        /* Default order is fine now as it's inside main content */
    }

    .qsidx-main-content {
        order: -1;
        /* Top */
    }

    .qsidx-sidebar {
        order: 1;
        /* Bottom */
        position: static;
        margin-bottom: 30px;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .qsidx-gallery {
        grid-template-columns: 1fr;
        height: 300px;
        /* Fixed height for mobile hero */
        position: relative;
        border-radius: 12px !important;
        /* Force rounded corners */
        overflow: hidden !important;
        /* Ensure clipping */
    }

    .qsidx-gallery-main-wrapper {
        border-radius: 12px;
        height: 100%;
        overflow: hidden;
        /* Ensure image clips */
    }

    .qsidx-gallery-main {
        height: 100%;
        border-radius: 12px;
        overflow: hidden;
    }

    .qsidx-gallery-side {
        display: none;
        /* Hide side images on mobile */
    }

    /* Add "View Photos" Badge */
    .qsidx-gallery-main-wrapper::after {
        content: 'View Photos';
        position: absolute;
        bottom: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.9rem;
        font-weight: 600;
        pointer-events: none;
    }

    .qsidx-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .qsidx-amenities-grid {
        grid-template-columns: 1fr;
    }
}

/* Lightbox */
.qsidx-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    padding: 0;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

.qsidx-lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1400px;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#qsidx-lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

.qsidx-close {
    color: #fff;
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 50px;
    font-weight: 300;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
    transition: all 0.2s;
    opacity: 0.8;
}

.qsidx-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.qsidx-prev,
.qsidx-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: 60px;
    height: 60px;
    margin-top: -30px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    user-select: none;
    background-color: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.qsidx-prev {
    left: 20px;
}

.qsidx-next {
    right: 20px;
}

.qsidx-prev:hover,
.qsidx-next:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.qsidx-caption {
    text-align: center;
    color: #fff;
    padding: 15px 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 500;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

/* Gallery Hover Pointers */
.qsidx-gallery-main-wrapper,
.qsidx-gallery-sub-wrapper,
.qsidx-view-all {
    cursor: pointer;
    position: relative;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
    /* Increased Radius */
}

.qsidx-gallery-main-wrapper:hover img,
.qsidx-gallery-sub-wrapper:hover img {
    transform: scale(1.03);
    transition: transform 0.4s ease;
}

.qsidx-view-all {
    background: #111;
    /* Black */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff !important;
    font-weight: 600;
    font-size: 1.2rem;
    height: 100%;
    width: 100%;
    transition: background 0.3s;
}

.qsidx-view-all:hover {
    background: #333;
    /* Dark Grey */
}

.qsidx-view-all>span {
    color: #fff;
}