/* --- БАЗОВЫЕ НАСТРОЙКИ --- */
html, body {
    /* Блокирует скролл всей страницы, кроме разрешенных блоков */
    overscroll-behavior: none; 
    /* Запрещает случайный зум и улучшает реакцию на тач */
    touch-action: manipulation;
    /* Фикс для iOS, чтобы не прыгало */
    height: 100%;
    overflow: hidden; 
    background-color: #F1F5F9;
}

input, textarea {
    -webkit-user-select: text;
    user-select: text;
}

::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* --- ЛОГИКА ЭКРАНОВ --- */
.screen {
    display: none;
    min-height: 100vh;
    flex-direction: column;
    padding-bottom: 90px;
    animation: fadeIn 0.25s ease-out;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- ЛОАДЕР --- */
.loader {
    width: 32px;
    height: 32px;
    border: 3px solid #E2E8F0;
    border-top-color: #4F46E5;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pb-safe {
    padding-bottom: env(safe-area-inset-bottom);
}

/* --- УВЕДОМЛЕНИЯ (TOASTS) --- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    right: 20px;
    /* Самый высокий слой, чтобы быть поверх всего */
    z-index: 9999; 
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Отступ для iPhone */
    padding-top: env(safe-area-inset-top);
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Для Safari */
    color: white;
    padding: 14px 16px;
    border-radius: 16px;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.toast.success .icon { color: #4ADE80; }
.toast.error .icon { color: #F87171; }
.toast.info .icon { color: #60A5FA; }

/* --- АНИМАЦИИ МОДАЛОК --- */
.modal-backdrop {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-sheet {
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal-sheet.open {
    transform: translateY(0);
}

.modal-center {
    transform: scale(0.9) translateY(10px);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.modal-center.open {
    transform: scale(1) translateY(0);
    opacity: 1;
}