.detail-topbar,
.gallery,
.detail-content {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
    width: 100%;
}
.listing-detail {
    padding-bottom: 3rem;
}
.detail-topbar {
    padding: 1rem 0;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
}
.back-link:hover {
    color: #e2001a;
}

/* Galerie */
.gallery {
    width: 100%;
    margin-bottom: 4rem;
}
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    height: 450px; /* feste Höhe statt aspect-ratio */
}
.gallery-main {
    border-radius: 10px 0 0 10px;
    overflow: hidden;
    cursor: pointer;
    height: 450px; /* gleiche Höhe wie Grid */
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.gallery-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 450px; /* gleiche Höhe */
}
.gallery-thumb {
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background: #f3f3f3; /* grau für leere Slots */
}
.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.gallery-thumb:hover img {
    transform: scale(1.05);
}
.gallery-thumb-empty {
    background: #f3f3f3;
    cursor: default;
}
.all-photos-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #333;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.gallery-empty {
    height: 300px;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* Inhalt zweispaltig */
.detail-content {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2.5rem;
}
.detail-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.detail-address {
    font-size: 1rem;
    color: #666;
    margin: 0 0 1.5rem;
}

.detail-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
}
.fact {
    padding: 0.75rem 1rem;
    background: #f8f8f8;
    border-radius: 8px;
}
.fact-label {
    display: block;
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
}
.fact-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
}

.detail-section {
    margin-bottom: 2rem;
}
.detail-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1rem;
}
.detail-description {
    line-height: 1.7;
    color: #333;
    white-space: pre-line;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.poi-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.poi-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.poi-type {
    font-weight: 600;
    min-width: 90px;
}
.poi-name {
    flex: 1;
    color: #666;
}
.poi-dist {
    color: #999;
    font-size: 0.9rem;
}

#detailMap {
    height: 320px;
    border-radius: 10px;
}

/* Kontakt-Box */
.detail-sidebar {
    position: relative;
}
.contact-box {
    position: sticky;
    top: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.contact-owner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
}
.contact-owner img,
.contact-avatar-ph {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.contact-avatar-ph {
    background: #e2001a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
}
.contact-owner strong {
    display: block;
}
.contact-link-text {
    font-size: 0.8rem;
    color: #e2001a;
}
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.contact-form .form-control {
    padding: 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
}
.contact-status {
    font-size: 0.85rem;
    text-align: center;
}
.contact-status.ok {
    color: #28a745;
}
.contact-status.err {
    color: #e2001a;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
}
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
}
.lightbox-prev {
    left: 30px;
}
.lightbox-next {
    right: 30px;
}
.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
}

/* Mobile */
@media (max-width: 900px) {
    .detail-content {
        grid-template-columns: 1fr;
    }
    .gallery-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .gallery-main {
        border-radius: 10px;
        height: 250px;
    }
    .gallery-main img {
        height: 250px;
    }
    .gallery-side {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        grid-template-rows: 1fr;
        height: 80px;
    }
    .gallery-thumb {
        border-radius: 6px !important;
    }
    .gallery-thumb:nth-child(n + 3) {
        display: none;
    } /* auf Mobil nur 2 Thumbs + Button */
    .contact-box {
        position: static;
    }
}
.gallery-fullwidth {
    width: 100%;
    /* volle Breite, kein max-width */
}

.detail-wrapper {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.deposit-insurance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #eaf7 ee;
    border: 1px solid #28a745;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #1a7431;
    font-weight: 500;
}
.deposit-insurance-badge {
    font-size: 0.8rem;
    line-height: 1.25;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
    height: 100%;
}
.listing-alarm-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: linear-gradient(135deg, #111 0%, #2a2a2a 100%);
    color: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    margin: 2rem 0;
}

.listing-alarm-banner .lab-icon {
    color: #e2001a;
    flex-shrink: 0;
}

.listing-alarm-banner .lab-text {
    flex: 1;
    min-width: 200px;
}

.listing-alarm-banner .lab-text strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.15rem;
}

.listing-alarm-banner .lab-text span {
    font-size: 0.9rem;
    color: #bbb;
}

.lab-form {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lab-form input[type="email"] {
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    border: none;
    border-radius: 8px;
    outline: none;
    min-width: 200px;
}

.lab-form button {
    padding: 0.6rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: #e2001a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.lab-form button:hover {
    opacity: 0.9;
}

.lab-msg {
    width: 100%;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.lab-msg:empty {
    display: none;
}
.lab-success {
    color: #7ee2a8;
}
.lab-error {
    color: #ff9b9b;
}

@media (max-width: 640px) {
    .listing-alarm-banner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .lab-form {
        flex-direction: column;
    }
    .lab-form input[type="email"],
    .lab-form button {
        width: 100%;
    }
}
