/* ================================================================
   Solid Medya — Apple / iOS / iPadOS / Safari uyumluluk katmanı
   Mevcut tasarımı bozmadan safe-area, form, dokunmatik ve PWA düzenleri
   ================================================================ */

@supports (padding: env(safe-area-inset-bottom)) {
    :root {
        --sm-safe-top: env(safe-area-inset-top, 0px);
        --sm-safe-right: env(safe-area-inset-right, 0px);
        --sm-safe-bottom: env(safe-area-inset-bottom, 0px);
        --sm-safe-left: env(safe-area-inset-left, 0px);
    }
}

/* ── iOS metin ölçekleme ve yatay taşma koruması ── */
@media (max-width: 991px) {
    html {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        overflow-x: clip;
    }

    body:not(.menu-is-open) {
        overflow-x: clip;
        max-width: 100%;
    }
}

/* ── Standalone / Home Screen web app ── */
@media all and (display-mode: standalone) {
    html.sm-standalone body {
        padding-top: var(--sm-safe-top, env(safe-area-inset-top, 0px));
    }

    .header-logo-fixed,
    .tp-header-2-area .tp-header-space {
        padding-top: max(0px, env(safe-area-inset-top, 0px));
    }

    .tp-copyright-2-area,
    .tp-copyright-2-border {
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
    }

    .master-mobile-nav {
        bottom: max(25px, env(safe-area-inset-bottom, 25px)) !important;
    }
}

/* ── Sabit mobil alt menü — Home Indicator ── */
@media (max-width: 767px) {
    .master-mobile-nav {
        bottom: max(25px, env(safe-area-inset-bottom, 25px)) !important;
        left: max(4%, env(safe-area-inset-left, 0px)) !important;
        right: max(4%, env(safe-area-inset-right, 0px)) !important;
        width: auto !important;
        max-width: min(400px, calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 8%)) !important;
    }

    main,
    .news-grid-section {
        padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    }

    #smooth-content {
        padding-bottom: 0 !important;
    }

    footer.pb-20 {
        padding-bottom: 0 !important;
    }

    footer > .dgm-footer-bg {
        padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .tp-copyright-2-area,
    .tp-copyright-2-border {
        padding-bottom: 8px !important;
    }

    .v38-wrapper {
        bottom: calc(132px + env(safe-area-inset-bottom, 0px)) !important;
        right: max(12px, env(safe-area-inset-right, 12px)) !important;
    }

    .back-to-top-wrapper,
    .back-to-top-btn {
        bottom: calc(110px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* ── iOS Safari yükseklik (100vh → dvh fallback) ── */
@supports (height: 100dvh) {
    html.smooth-ready #smooth-wrapper,
    body.smooth-ready #smooth-wrapper {
        height: 100dvh !important;
    }

    .tp-offcanvas-2-area,
    .tp-offcanvas-2-wrapper,
    .tp-offcanvas-2-area.opened {
        min-height: 100dvh;
        min-height: -webkit-fill-available;
    }

    .tp-offcanvas-2-area.opened {
        height: 100dvh !important;
    }

    .body-overlay.opened {
        height: 100dvh !important;
    }
}

html {
    min-height: -webkit-fill-available;
}

/* ── iOS form zoom önleme (min 16px) ── */
@media (max-width: 767px) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
    select,
    textarea {
        font-size: max(16px, 1rem) !important;
    }
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

select {
    -webkit-appearance: menulist;
    appearance: menulist;
}

/* ── Dokunmatik hedefler ve tap highlight ── */
a,
button,
.master-nav-item,
.btn,
.header-icon-btn,
.filter-btn,
.master-nav-main-btn {
    touch-action: manipulation;
}

a,
button,
.master-nav-item,
.btn,
.header-icon-btn {
    -webkit-tap-highlight-color: rgba(255, 215, 0, 0.12);
}

/* ── Kaydırma momentum (Safari) ── */
.tp-offcanvas-2-wrapper,
.tp-offcanvas-2-menu,
.sm-table-wrap,
.table-responsive,
.master-nav-backdrop,
.mfp-wrap {
    -webkit-overflow-scrolling: touch;
}

/* ── Fixed/sticky çakışma azaltma ── */
@supports (-webkit-touch-callout: none) {
    .header-logo-fixed {
        padding-top: max(8px, env(safe-area-inset-top, 0px));
    }

    .mfp-bg {
        height: 100%;
        height: 100dvh;
    }
}

/* ── Retina görseller ── */
img,
video {
    max-width: 100%;
    height: auto;
}

img[srcset],
img[data-src] {
    image-rendering: auto;
}

/* ── Medya: iOS inline oynatma uyumu ── */
video {
    object-fit: contain;
}

iframe[src*="youtube"],
iframe[src*="vimeo"],
iframe[src*="google.com/maps"] {
    max-width: 100%;
}

/* ── Klavye açıkken fixed alt menü gizle ── */
@media (max-width: 767px) {
    body.sm-ios-keyboard-open .master-mobile-nav {
        transform: translateY(calc(100% + 40px));
        opacity: 0;
        pointer-events: none !important;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    body.sm-ios-keyboard-open .back-to-top-wrapper,
    body.sm-ios-keyboard-open .back-to-top-btn,
    body.sm-ios-keyboard-open .v38-wrapper {
        opacity: 0;
        pointer-events: none !important;
    }
}

/* ── iOS Safari input/date görünümü ── */
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"] {
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px;
}
