/**
 * PWA / çentik / iPhone + Türkçe tipografi
 */
:root {
    --ik-safe-top-fallback: 0px;
    --ik-app-height: 100dvh;
}

.swal2-container.swal2-top,
.swal2-container.swal2-top-start,
.swal2-container.swal2-top-end,
.swal2-container.ik-toast-safe-top {
    top: calc(max(env(safe-area-inset-top, 0px), var(--ik-safe-top-fallback, 0px)) + 0.5rem) !important;
    padding-top: 0 !important;
}

.swal2-container.swal2-top > .swal2-popup.swal2-toast,
.swal2-container.swal2-top-start > .swal2-popup.swal2-toast,
.swal2-container.swal2-top-end > .swal2-popup.swal2-toast {
    margin-top: 0 !important;
}

.ik-tr-text,
.ik-tr-text * {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif !important;
    text-transform: none !important;
    font-feature-settings: normal !important;
    font-variant: normal !important;
    letter-spacing: normal !important;
}

.ik-tr-brand {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, sans-serif !important;
    text-transform: none !important;
    font-feature-settings: normal !important;
    letter-spacing: 0.05em;
}

/* Splash — tam ekran (alt safe-area dahil) */
.ik-splash-screen,
#splashScreen.ik-splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100svh;
    min-height: -webkit-fill-available;
    max-height: none;
    z-index: 99999;
    margin: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    box-sizing: border-box;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1E40AF 100%);
    background-color: #1E40AF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity .5s ease;
    pointer-events: all;
    overflow: hidden;
}

html.ik-ios.ik-pwa-installed .ik-splash-screen::after {
    display: none !important;
}

/* Ana uygulama (index) */
html.ik-ios body#appBody {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

html[data-ik-safe-source="flutter"] {
    --ik-safe-bottom-eff: var(--ik-safe-bottom, 0px);
    --ik-safe-top-eff: max(var(--ik-safe-top, 0px), var(--ik-safe-top-fallback, 0px));
}

html[data-ik-safe-source="flutter"].ik-ios #appBottomNav {
    padding-bottom: max(0.35rem, var(--ik-safe-bottom, 0px)) !important;
}

html.ik-ios:not(.ik-pwa-installed) main.flex-1 {
    padding-bottom: calc(4.75rem + var(--ik-safe-bottom-eff, env(safe-area-inset-bottom, 0px))) !important;
}

html.ik-ios.ik-pwa-installed {
    --ik-bottom-stack: 4.75rem;
}

html.ik-ios.ik-pwa-installed main.flex-1 {
    padding-bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px)) !important;
}

html.ik-ios.ik-pwa-installed .view.active:not(#view-home) {
    padding-bottom: calc(0.5rem + 4.75rem) !important;
}

.sub-page:not(.show) {
    display: none !important;
    pointer-events: none !important;
}

.sub-page.show {
    display: flex !important;
    flex-direction: column;
    pointer-events: auto !important;
}

/* Tüm platformlar: alt sayfa uygulama kartı içinde (viewport fixed kaydırma hissi yok) */
#appContainer .sub-page {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

html.ik-ios.ik-pwa-installed .sub-page {
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}

html.ik-ios.ik-pwa-installed .sub-page.show,
html.ik-pwa-installed:not(.ik-flutter-app) .sub-page.show {
    z-index: 110 !important;
}

html.ik-pwa-installed:not(.ik-flutter-app) body.ik-subpage-open #appBottomNav {
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 15 !important;
}

html.ik-pwa-installed:not(.ik-flutter-app) #appBottomNav {
    padding-bottom: calc(0.55rem + max(var(--ik-safe-bottom-measured, 0px), var(--ik-safe-bottom, 0px), env(safe-area-inset-bottom, 0px))) !important;
}

html.ik-pwa-installed:not(.ik-flutter-app) .sub-page .ik-sub-footer-bar,
html.ik-pwa-installed:not(.ik-flutter-app) .sub-page .ik-scroll-pad-with-footer {
    padding-bottom: calc(1rem + max(var(--ik-safe-bottom-measured, 0px), var(--ik-safe-bottom, 0px), env(safe-area-inset-bottom, 0px))) !important;
    z-index: 20;
    position: relative;
}

html.ik-pwa-installed:not(.ik-flutter-app) .sub-page .ik-fab-bottom {
    bottom: calc(1rem + max(var(--ik-safe-bottom-measured, 0px), var(--ik-safe-bottom, 0px), env(safe-area-inset-bottom, 0px))) !important;
    z-index: 70 !important;
}

#ik-safe-top-fixed {
    display: none !important;
}

html.ik-ios.ik-pwa-installed .view,
html.ik-ios.ik-pwa-installed .view.active {
    opacity: 1 !important;
    transition: none !important;
}

html.ik-ios.ik-pwa-installed body.ik-subpage-open #view-home.active {
    overflow: hidden;
    transform: none !important;
}

html.ik-ios.ik-pwa-installed {
    transition: none !important;
}

html.ik-ios.ik-pwa-installed .sub-page .ik-sub-footer-bar {
    flex-shrink: 0;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 12;
    position: relative;
}

html.ik-ios.ik-pwa-installed .sub-page .ik-scroll-pad {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
}

html.ik-ios.ik-pwa-installed .sub-page .ik-fab-bottom {
    position: absolute !important;
    left: auto !important;
    right: 1.25rem !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 55;
}

/* iOS PWA: eski düzen — flex ortalı kart (çift fixed = sağdan slide/ghosting) */
html.ik-ios.ik-pwa-installed {
    height: 100%;
    min-height: 100svh;
    min-height: -webkit-fill-available;
    background-color: #ffffff;
    overflow: hidden;
    transition: none !important;
    position: fixed;
    inset: 0;
    width: 100%;
}

html.dark.ik-ios.ik-pwa-installed {
    background-color: #0f172a;
}

html.ik-ios.ik-pwa-installed.ik-auth-html {
    background-color: #ffffff;
}

html.ik-ios.ik-pwa-installed body#appBody {
    transition: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #F3F4F6;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden;
    box-sizing: border-box;
    transform: none !important;
    transform-origin: center center !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html.dark.ik-ios.ik-pwa-installed body#appBody {
    background-color: #0f172a !important;
}

html.ik-ios.ik-pwa-installed #appContainer {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    transform: none !important;
    transition: none !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden;
    box-sizing: border-box;
    flex-shrink: 0;
    box-shadow: none !important;
    transform-origin: center center !important;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

html.ik-ios.ik-pwa-installed #appContainer,
html.ik-ios.ik-pwa-installed #appContainer main,
html.ik-ios.ik-pwa-installed #view-home,
html.ik-ios.ik-pwa-installed .view.active {
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    translate: none !important;
    transition: none !important;
}

html.ik-ios.ik-pwa-installed main > header.app-home-topbar {
    margin-top: 0 !important;
    padding-top: calc(var(--ik-safe-top-eff) + 8px) !important;
}

html.ik-ios.ik-pwa-installed body#appBody {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

html.ik-ios.ik-pwa-installed .active\:scale-95:active,
html.ik-ios.ik-pwa-installed .active\:scale-98:active,
html.ik-ios.ik-pwa-installed .active\:scale-\[0\.98\]:active {
    transform: none !important;
}

html.ik-ios.ik-pwa-installed #appBottomNav {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transform: none !important;
    width: 100% !important;
    max-width: none !important;
    bottom: 0 !important;
    padding-top: 0.1rem !important;
    padding-bottom: calc(0.55rem + var(--ik-safe-bottom-eff, env(safe-area-inset-bottom, 0px))) !important;
    box-sizing: border-box;
    margin-top: 0;
    overflow: visible;
    z-index: 100;
    background-color: #ffffff !important;
}

html.dark.ik-ios.ik-pwa-installed #appBottomNav {
    background-color: #1e293b !important;
    border-top-color: #334155 !important;
}

/* Home indicator: padding ile doldurulur (::after overflow-hidden’da kesiliyordu) */
html.ik-ios.ik-pwa-installed #appBottomNav::after {
    display: none !important;
}

html.ik-ios.ik-pwa-installed #appBottomNav .tab-btn {
    padding-bottom: 0 !important;
}

#appBottomNav {
    padding-top: 0.1rem !important;
    padding-bottom: 0.7rem !important;
    box-sizing: border-box;
}

#appBottomNav .ik-nav-fab-wrap {
    align-self: flex-end;
    margin-top: 0;
    padding: 0;
    box-sizing: border-box;
}

#appBottomNav .ik-nav-fab-btn {
    margin-bottom: 0 !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#appBottomNav .ik-nav-fab-btn:active {
    transform: none !important;
}

.ik-nav-fab-wrap {
    position: relative;
    z-index: 30;
}

.ik-fab-menu {
    position: absolute !important;
    left: 50%;
    bottom: calc(100% + 0.5rem);
    margin-left: -7rem;
    width: 14rem;
    max-width: calc(100vw - 2rem);
    z-index: 80;
    display: none !important;
    flex-direction: column;
    pointer-events: none;
    transform: none !important;
    transition: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
}

.ik-fab-menu.is-open {
    display: flex !important;
    pointer-events: auto;
}

html.ik-ios.ik-pwa-installed #fabIcon {
    transition: none !important;
    transform: none !important;
}

html.dark.ik-ios.ik-pwa-installed #appBottomNav::after {
    display: none !important;
}

/* Login / şifre sıfırlama */
html.ik-ios.ik-pwa-installed.ik-auth-html,
html.ik-ios.ik-pwa-installed.ik-auth-html body.ik-auth-page {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #1E40AF !important;
}

html.ik-ios.ik-pwa-installed #ik-login-shell {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none;
    display: flex;
    flex-direction: column;
    background: #1E40AF !important;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
    box-sizing: border-box;
    overflow: hidden;
}

html.ik-ios.ik-pwa-installed #ik-login-shell .ik-login-hero-slot {
    flex: 0 0 38%;
    min-height: 200px;
    max-height: 42vh;
    background: #1E40AF !important;
}

html.ik-ios.ik-pwa-installed #ik-login-shell .ik-login-form-slot {
    flex: 1 1 auto;
    min-height: 0;
    background: #ffffff !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
}

html.ik-ios.ik-pwa-installed #ik-login-shell .ik-login-hero-slot {
    flex: 0 0 38%;
    min-height: 200px;
    max-height: 42vh;
}

html.ik-ios.ik-pwa-installed #ik-login-shell .ik-login-form-slot {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
}

html.ik-ios.ik-pwa-installed #ik-login-shell .ik-login-footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* SweetAlert2 — iOS PWA */
.swal2-container {
    z-index: 200000 !important;
}

.swal2-close,
.swal2-confirm,
.swal2-cancel {
    pointer-events: auto !important;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
}

.swal2-close {
    font-size: 2rem !important;
    line-height: 2.5rem !important;
    min-width: 44px;
    min-height: 44px;
}

/* iPhone PWA: yatay çevirince dikey kalsın — yalnızca kart döner, body sabit */
@media (orientation: landscape) and (max-height: 520px) {
    html.ik-ios.ik-pwa-installed:not(.ik-flutter-app) body#appBody {
        align-items: center !important;
        justify-content: center !important;
        transform: none !important;
        overflow: hidden !important;
    }
    html.ik-ios.ik-pwa-installed:not(.ik-flutter-app) #appContainer {
        width: 100vh !important;
        height: 100vw !important;
        max-width: 100vh !important;
        max-height: none !important;
        transform: rotate(-90deg) !important;
        transform-origin: center center !important;
    }
    html.ik-ios.ik-pwa-installed:not(.ik-flutter-app) #appBottomNav {
        position: absolute !important;
    }
}
