/* Correções específicas para iPhone/iPad: viewport, notch, zoom automático e modais */

html,
body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    -webkit-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;
}

body {
    position: relative;
    overscroll-behavior-x: none;
}

.app-shell,
.hero-header,
.content-view,
.bottom-nav,
.bottom-sheet,
.sheet-backdrop,
.dialog-backdrop {
    max-width: 100vw !important;
}

.app-shell,
.hero-header,
.content-view {
    transform: none;
}

input,
textarea,
select,
button {
    -webkit-font-smoothing: antialiased;
}

input,
textarea,
select {
    font-size: 16px !important;
    transform: translateZ(0);
}

.login-form input,
.input-group input,
.category-form input,
.limit-input-wrap input {
    font-size: 16px !important;
}

.amount-field input {
    font-size: 28px !important;
}

.bottom-sheet {
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
}

body.ios-device {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

body.ios-device .app-shell {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    width: 100% !important;
    overflow-x: hidden !important;
}

body.ios-device .content-view {
    width: 100% !important;
    overflow-x: hidden !important;
    contain: paint;
}

body.ios-device .hero-header {
    width: 100% !important;
    overflow: hidden !important;
    transform: none !important;
}

body.ios-standalone .hero-header {
    padding-top: calc(14px + env(safe-area-inset-top)) !important;
}

body.ios-standalone .app-shell {
    padding-top: 0 !important;
}

body.ios-standalone .bottom-nav {
    padding-bottom: calc(7px + env(safe-area-inset-bottom)) !important;
}

body.ios-device .bottom-sheet {
    width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    transform: translateY(105%) !important;
    max-height: calc(100dvh - env(safe-area-inset-top) - 10px) !important;
    padding-bottom: calc(22px + env(safe-area-inset-bottom)) !important;
}

body.ios-device .bottom-sheet.open {
    transform: translateY(0) !important;
}

body.ios-device .bottom-sheet.sheet-dragging {
    transition: none !important;
}

body.ios-device.sheet-lock,
body.ios-device.sheet-lock-ios {
    overflow: hidden !important;
    position: fixed !important;
    inset-inline: 0 !important;
    width: 100% !important;
    touch-action: none !important;
}

body.ios-device.sheet-lock .app-shell,
body.ios-device.sheet-lock-ios .app-shell {
    height: 100dvh !important;
    overflow: hidden !important;
}

body.ios-device .sheet-backdrop:not(.hidden) {
    touch-action: none !important;
}

body.ios-device .month-page-next,
body.ios-device .month-page-prev,
body.ios-device .is-month-dragging {
    will-change: transform, opacity;
}

body.ios-device input:focus,
body.ios-device textarea:focus,
body.ios-device select:focus {
    font-size: 16px !important;
}

@media (max-width: 430px) {
    body.ios-device .content-view {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    body.ios-device .bottom-sheet {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}
