/* 
* N.O. Immobilien - iOS-spezifische Fixes
* Version: 1.2
*/

/* Grundlegende Fixes für iOS-Geräte */
@supports (-webkit-touch-callout: none) {
    /* Verhindert unerwünschtes Verhalten beim Scrollen */
    html {
        -webkit-text-size-adjust: 100%;
        -webkit-overflow-scrolling: touch; /* Verbessert das Scrollverhalten */
    }
    
    body {
        /* KEIN overflow: hidden auf body! */
        /* KEIN position: fixed auf body! */
        /* KEIN touch-action: none auf body! */
        -webkit-text-size-adjust: 100%;
    }
    
    /* Verbessert die Darstellung von Formularelementen */
    input, 
    textarea, 
    select, 
    button {
        -webkit-appearance: none;
        border-radius: 0;
        font-size: 16px; /* Verhindert Zoom auf iOS bei Fokus */
    }
    
    /* Verbessert die Darstellung von Bildern */
    img {
        -webkit-user-drag: none;
    }
    
    /* Verbessert die Darstellung von Links und interaktiven Elementen */
    a, button, [role="button"], input[type="button"], input[type="submit"] {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }
    
    /* Verbessert die Darstellung von Formularen */
    form {
        margin: 0;
    }
    
    /* Verbessert die Darstellung von Listen */
    ul, ol {
        -webkit-padding-start: 0;
        padding-left: 0;
    }
    
    /* Verbessert die Darstellung von Tabellen */
    table {
        -webkit-text-size-adjust: 100%;
    }
    
    /* Verbessert die Darstellung von Bildern in der Galerie */
    .property-slide img,
    .gallery-slide img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        touch-action: manipulation;
        -webkit-user-drag: none;
    }
    
    /* Verbessert die Darstellung des Headers */
    .header {
        position: sticky;
        -webkit-position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    /* Verbessert die Darstellung des Footers */
    .footer {
        position: relative;
        z-index: 1;
    }
    
    /* Verbessert die Darstellung der Navigation */
    .nav-menu {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Verbessert die Darstellung der Dropdown-Menüs */
    .dropdown-menu {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Verbessert die Darstellung der Property-Grid */
    .property-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Verbessert die Darstellung der Property-Cards */
    .property-card {
        flex: 1 1 300px;
        display: flex;
        flex-direction: column;
    }
    
    /* Verbessert die Darstellung der Property-Images */
    .property-image {
        position: relative;
        overflow: hidden;
        height: 0;
        padding-bottom: 66.67%; /* 2:3 Verhältnis */
    }
    
    .property-image img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        -webkit-user-drag: none;
    }
    
    /* Verbessert das Scrollverhalten in Containern */
    .scrollable-container {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Verbessert das Scrollverhalten in Containern */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* Spezifische Fixes für iPhone X und neuere Modelle mit Notch */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-top: max(0px, env(safe-area-inset-top));
    }
    
    .footer {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
    
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Verbessert die Darstellung von Fixed-Elementen auf Geräten mit Notch */
    .fixed-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .fixed-top {
        padding-top: env(safe-area-inset-top);
    }
    
    /* Verbessert die Darstellung der Navigation auf Geräten mit Notch */
    .nav-menu.active {
        padding-top: calc(6rem + env(safe-area-inset-top));
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* Spezifische Fixes für ältere iOS-Versionen */
@media screen and (max-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
    /* Verbessert die Darstellung auf älteren iPhones */
    .container {
        width: 100%;
        padding-left: 15px;
        padding-right: 15px;
        overflow-x: hidden;
    }
    
    /* Verbessert die Darstellung von Bildern */
    img {
        max-width: 100%;
        height: auto;
        touch-action: manipulation;
    }
    
    /* Verbessert das Scrollverhalten auf älteren iOS-Geräten */
    body, html {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
    }
    
    /* Verbessert die Touch-Reaktion auf älteren iOS-Geräten */
    a, button, [role="button"] {
        touch-action: manipulation;
    }
}

/* Spezifische Fixes für iOS 15+ */
@supports (height: 100dvh) {
    .hero, .fullscreen-section {
        height: 52dvh; /* Dynamische Viewport-Höhe, berücksichtigt UI-Elemente */
    }
}