/* iPhone PWA & Mobile Safe-Area Stylesheet (Dark & Light Mode) */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

html[data-theme="dark"] {
    --bg-app: #0b1120;
    --text-main: #f8fafc;
    --glass-bg: rgba(15, 23, 42, 0.84);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-bg: linear-gradient(145deg, rgba(30, 41, 59, 0.78), rgba(15, 23, 42, 0.92));
    --card-border: rgba(255, 255, 255, 0.07);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.45);
    --segmented-bg: rgba(15, 23, 42, 0.9);
    --sheet-bg: #0f172a;
}

html[data-theme="light"] {
    --bg-app: #f1f5f9;
    --text-main: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(15, 23, 42, 0.08);
    --card-bg: #ffffff;
    --card-border: rgba(15, 23, 42, 0.08);
    --card-shadow: 0 10px 25px -8px rgba(15, 23, 42, 0.08);
    --segmented-bg: #e2e8f0;
    --sheet-bg: #ffffff;
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", sans-serif;
    background-color: var(--bg-app) !important;
    color: var(--text-main) !important;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
    user-select: none;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Prevent iOS Safari auto-zoom on focus by enforcing 16px minimum */
input,
select,
textarea {
    font-size: 16px !important;
    user-select: text;
}

.safe-top-header {
    padding-top: calc(var(--safe-top) + 0.75rem);
}

.safe-bottom-nav {
    padding-bottom: calc(var(--safe-bottom) + 0.5rem);
}

.main-scroll-area {
    padding-bottom: calc(var(--safe-bottom) + 6rem);
}

/* iOS Glassmorphism Surfaces */
.ios-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.ios-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: background 0.25s ease, border-color 0.25s ease;
}

/* Smooth Segmented Pill Slider */
.segmented-control {
    position: relative;
    background: var(--segmented-bg);
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0.25rem;
}

/* Custom Prominent Euro Input */
.euro-giant-input {
    font-size: 2.5rem !important;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: transparent !important;
    border: none !important;
    outline: none;
    text-align: center;
    width: 100%;
}

/* iOS Bottom Sheet Backdrop & Sheet */
.bottom-sheet-panel {
    background-color: var(--sheet-bg) !important;
    padding-bottom: calc(var(--safe-bottom) + 1.5rem);
    border-top-left-radius: 1.75rem;
    border-top-right-radius: 1.75rem;
    box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.35);
}

/* Light Mode Adaptive Overrides for Inner Surfaces & Text */
html[data-theme="light"] .text-white {
    color: #0f172a !important;
}

html[data-theme="light"] button.bg-rose-500 .text-white,
html[data-theme="light"] button.bg-emerald-500 .text-white,
html[data-theme="light"] button.bg-blue-500 .text-white,
html[data-theme="light"] button.bg-indigo-600,
html[data-theme="light"] button.bg-emerald-600,
html[data-theme="light"] button.bg-rose-500,
html[data-theme="light"] button.bg-emerald-500,
html[data-theme="light"] button.bg-blue-500,
html[data-theme="light"] button.bg-indigo-500,
html[data-theme="light"] [class*="bg-gradient-to-r"].text-white,
html[data-theme="light"] [style*="background-color"].text-white {
    color: #ffffff !important;
}

html[data-theme="light"] .text-slate-200,
html[data-theme="light"] .text-slate-300 {
    color: #334155 !important;
}

html[data-theme="light"] .text-slate-400 {
    color: #64748b !important;
}

html[data-theme="light"] .bg-slate-950,
html[data-theme="light"] .bg-slate-950\/90,
html[data-theme="light"] .bg-slate-950\/80,
html[data-theme="light"] .bg-slate-900,
html[data-theme="light"] .bg-slate-900\/90,
html[data-theme="light"] .bg-slate-900\/80,
html[data-theme="light"] .bg-slate-900\/75,
html[data-theme="light"] .bg-slate-900\/70,
html[data-theme="light"] .bg-slate-900\/60 {
    background-color: #f8fafc !important;
}

html[data-theme="light"] .bg-slate-800,
html[data-theme="light"] .bg-slate-800\/80 {
    background-color: #e2e8f0 !important;
}

html[data-theme="light"] .border-slate-800,
html[data-theme="light"] .border-slate-800\/90,
html[data-theme="light"] .border-slate-800\/80,
html[data-theme="light"] .border-slate-700,
html[data-theme="light"] .border-slate-700\/80,
html[data-theme="light"] .border-slate-700\/70 {
    border-color: #cbd5e1 !important;
}

html[data-theme="light"] .border-white {
    border-color: #4f46e5 !important;
}

html[data-theme="light"] nav .bg-white\/10 {
    background-color: rgba(79, 70, 229, 0.12) !important;
}

[x-cloak] {
    display: none !important;
}
