@media print {
    /* 1. Sichtbarkeits-Logik & Reset */
    * { 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
        box-sizing: border-box !important;
    }

    body * { visibility: hidden; }
    .d-print-block, .d-print-block * { visibility: visible; }

    .d-print-block { 
        display: table !important; 
        position: absolute; 
        right: 0; /* Ankerpunkt auf Rechts gesetzt */
        top: 0; 
        width: 100%;
        direction: rtl !important; /* Arabischer Textfluss */
    }

    @page { size: A4; margin: 1cm 1.5cm; }

    body { 
        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 
        font-size: 11pt; 
        line-height: 1.5; 
        color: #333; 
        margin: 0;
        background: #fff !important;
    }

    /* 2. HEADER (RTL Gespiegelt) */
    .page-header { 
        position: fixed; 
        top: 0; 
        width: 100%; 
        height: 100px; 
        display: flex; 
        flex-direction: row-reverse; /* Tauscht Logo und Textposition */
        justify-content: space-between; 
        align-items: center; 
        border-bottom: 2px solid #00B98E; 
        background: #fff; 
        z-index: 1000; 
    }

    .header-left { display: flex; align-items: center; gap: 15px; flex-direction: row-reverse; }
    .custom-logo { max-height: 100px; width: auto; margin-bottom: 31px; } 
    .brand-name { font-size: 22pt; font-weight: bold; color: #00B98E; margin: 0; } 
    .header-right { text-align: left; font-size: 8pt; color: #666; } /* Text linksbündig da RTL */
    
  
    .header-spacer { height: 120px; } 
    .footer-spacer { height: 40px; }

    /* 3. BADGES */
    .badge-container { margin-bottom: 10px; display: block !important; text-align: right; }

    .print-badge { 
        display: inline-block !important; 
        padding: 3px 10px !important; 
        border-radius: 4px !important; 
        font-size: 10pt !important; 
        font-weight: bold !important; 
        margin-left: 5px !important; /* Margin getauscht von rechts nach links */
        margin-right: 0 !important;
        border: 1px solid #ddd !important; 
        background-color: #f0f0f0; 
    }

    .print-badge.status-badge { border: none !important; }

/* 4. GALERIE */
.main-img { 
    width: 100%; 
    height: 450px; 
    object-fit: cover; 
    border-radius: 8px; 
    display: block;
    margin-bottom: 0px; 
} 

.gallery-grid { 
    table-layout: fixed !important; 
    width: auto !important; /* Nicht mehr 100%, damit sie nicht zwingend dehnt */
    border-collapse: separate !important; 
    border-spacing: 4px 0 !important; 
    margin: 10px 0 !important;
}

.gallery-grid td { 
    /* 180mm / 6 Bilder = ca. 28-29mm pro Bild inkl. Abstand */
    width: 28mm !important; 
    max-width: 28mm !important;
    min-width: 28mm !important;
    padding: 0 !important; 
    vertical-align: top !important;
}

.gallery-grid img { 
    width: 28mm !important; 
    height: 28mm !important; /* Quadratisch fixieren */
    aspect-ratio: 1/1 !important; 
    object-fit: cover !important; 
    border-radius: 4px !important; 
    border: 1px solid #eee !important;
    display: block;
}

/* RTL-Check: Falls die Bilder bei 4 Stück links kleben statt rechts */
[direction="rtl"] .gallery-grid {
    margin-right: 0 !important;
    margin-left: auto !important;
}


    /* 5. TITEL & PREIS (RTL) */
    .title-row { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: flex-end; margin-bottom: 5px; }

    h1 { font-size: 22pt; margin: 0; color: #000; flex: 1; line-height: 1.1; text-align: right; } 
    .price-tag { font-size: 20pt; font-weight: bold; color: #00B98E; margin-right: 15px; margin-left: 0; } 
    .price-suffix { font-size: 11pt; color: #666; text-align: left; }
    
    .location { font-size: 14pt; color: #00b98e; margin: 20px 0; text-align: right; } 

    /* 6. INFO BOX & QR-SECTION (RTL Gespiegelt) */
    .info-box { display: table; width: 100%; background: #f8f9fa; border: 1px solid #eee; border-radius: 8px; margin-bottom: 20px; direction: rtl; }
    
    /* Border von links nach rechts geschoben */
    .info-item { display: table-cell; padding: 12px; border-right: 3px solid #00B98E; border-left: none; vertical-align: middle; text-align: right; }

    .info-label { font-size: 9pt; text-transform: uppercase; color: #777; margin-bottom: 2px; }
    .info-value { font-size: 11pt; font-weight: bold; color: #333; }
    
    /* QR Section auf die andere Seite */
    .qr-section { display: table-cell !important; width: 100px; padding: 5px; background: #fff !important; border-right: 1px solid #eee; border-left: none; text-align: center; }
    .qr-section img { width: 100px !important; height: 100px !important; }
    .qr-section p { font-size: 7pt; margin: 2px 0 0 0 !important; }

    /* 7. BESCHREIBUNG */
    .description-title { font-size: 14pt; font-weight: bold; color: #00B98E; border-bottom: 1px solid #eee; padding-bottom: 5px; margin-bottom: 10px; text-align: right; }
    .content { font-size: 11pt; text-align: justify; line-height: 1.6; direction: rtl; }

    /* Page-Breaks */
    img { page-break-inside: avoid; }
	.info-box { page-break-after: always; }

	/* Verhindert, dass eine Überschrift ganz unten auf Seite 1 steht und der Text auf Seite 2 */
	.description-title {
		page-break-after: avoid !important;
		break-after: avoid !important;
	}
	
	

}