/**
 * Safari Desktop Viewport Fix
 * Präzise Lösung für Container-Größenprobleme
 */

/* Safari Desktop Detection - präziser als vorher */
@supports (-webkit-appearance: none) and (not (overflow: -webkit-marquee)) and (not (-ms-ime-align: auto)) {
    /* Nur Desktop Safari, nicht Chrome, nicht Mobile Safari */
    
    /* Body & HTML Height-Chain korrigieren */
    html {
        height: 100%;
        /* Safari-spezifische Viewport-Korrektur */
        height: -webkit-fill-available;
    }
    
    body {
        height: 100%;
        /* Safari Mobile URL-Bar Problem umgehen */
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Contact Container - Safari-spezifische Größenberechnung */
    .contact-container {
        /* Flexbox komplett vermeiden in Desktop Safari */
        display: block !important;
        
        /* Container-Größe explizit setzen */
        width: 100% !important;
        max-width: 1200px !important;
        margin: 0 auto !important;
        padding: 20px !important;
        
        /* Height-Probleme lösen */
        min-height: 100vh !important;
        min-height: -webkit-fill-available !important;
        
        /* Safari Container-Overflow beheben */
        overflow: visible !important;
        position: relative !important;
        
        /* Box-Sizing für Safari korrigieren */
        box-sizing: border-box !important;
    }
    
    /* Sections in Safari - explizite Dimensionierung */
    .contact-container section {
        display: block !important;
        width: 100% !important;
        margin-bottom: 30px !important;
        padding: 20px !important;
        
        /* Safari braucht explizite Heights */
        min-height: 200px !important;
        height: auto !important;
        
        /* Container-Eigenschaften für Safari */
        box-sizing: border-box !important;
        overflow: visible !important;
        position: relative !important;
    }
    
    /* Content innerhalb von Sections */
    .contact-container section > * {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Spezifische Section-Fixes */
    .property-section {
        min-height: 300px !important;
    }
    
    .contact-section {
        min-height: 400px !important;
    }
    
    .sharing-section {
        min-height: 250px !important;
    }
    
    /* Form-Elemente in Safari */
    .contact-form {
        width: 100% !important;
        display: block !important;
    }
    
    .contact-form .form-group {
        width: 100% !important;
        margin-bottom: 20px !important;
        display: block !important;
    }
    
    /* Buttons in Safari */
    .contact-form button,
    .share-button {
        width: 100% !important;
        max-width: 300px !important;
        height: auto !important;
        padding: 12px 24px !important;
        margin: 10px 0 !important;
        display: block !important;
    }
    
    /* Grid-Layouts für Safari - 2x2 Grid beibehalten */
    .property-info-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto !important;
        gap: 15px !important;
        width: 100% !important;
    }
    
    .property-info-grid .info-item {
        display: block !important;
        width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    /* Mobile Safari: Bei schmalen Bildschirmen auf 1 Spalte */
    @media (max-width: 768px) {
        .property-info-grid {
            grid-template-columns: 1fr !important;
            grid-template-rows: auto !important;
        }
    }
    
    /* Sharing-Buttons Container */
    .share-buttons-container {
        display: block !important;
        width: 100% !important;
    }
    
    .share-buttons {
        display: block !important;
        width: 100% !important;
    }
    
    /* QR-Code Container */
    .qr-code-container {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        margin: 20px 0 !important;
    }
    
    /* Scrolling in Safari korrigieren */
    .contact-container,
    .contact-container section {
        -webkit-overflow-scrolling: touch !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }
}

/* Zusätzlicher Fix für Safari Mobile (falls nötig) */
@supports (-webkit-touch-callout: none) {
    .contact-container {
        /* iOS Safari spezifische Fixes */
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
}

/* Debug-Hilfe für Safari (temporär) */
@supports (-webkit-appearance: none) {
    .contact-container::before {
        content: "Safari Container Active";
        position: fixed;
        top: 10px;
        right: 10px;
        background: green;
        color: white;
        padding: 5px 10px;
        font-size: 12px;
        z-index: 9999;
        border-radius: 3px;
        /* Entferne nach Tests */
    }
}
    /* Hauptinhalt in Safari: Flex vermeiden, volle Höhe ermöglichen */
    .main-content {
        display: block !important;
        height: auto !important;
        min-height: calc(100vh - var(--header-height) - var(--footer-height)) !important;
        min-height: -webkit-fill-available !important;
        box-sizing: border-box !important;
        padding-bottom: 0 !important; /* Footer-Abstand übernimmt body padding */
    }

    /* Standard-Container: kein Flex in Safari, volle Breite */
    .container {
        display: block !important;
        width: 100% !important;
        max-width: var(--container-width-max) !important;
        box-sizing: border-box !important;
    }
