/* common.css - Общие стили для Регистрации и Входа */

:root {
    --main-blue: #809EFF;
    --error: #FF3B30;
    --text-primary: #000000;
    --text-placeholder: rgba(176, 176, 176, 0.7);
    --text-input: #787E88;
    --bg-input: #F5F5F5;
    --border-active: #809EFF;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Golos Text", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
}

html {
    height: 100%;
    /* Магия для iOS: высота равна видимой области без учета плашек браузера */
    height: -webkit-fill-available;
}

body {
    display: flex;
    justify-content: center;
    background-color: #fff;
    min-height: 100vh;
    /* Фикс для мобильных: используем доступное пространство */
    min-height: -webkit-fill-available;
}

.container {
    width: 100%;
    max-width: 390px;
    /* Контейнер тоже должен стремиться занять всю доступную высоту */
    min-height: 100vh;
    min-height: -webkit-fill-available;

    display: flex;
    flex-direction: column;

    /* Отступы */
    padding: 20px 16px;

    /* ВАЖНО: Добавляем отступ снизу для iPhone X и новее (Safe Area),
       чтобы черная полоска "домой" не перекрывала кнопку */
    padding-bottom: calc(20px + env(safe-area-inset-bottom));

    box-sizing: border-box;
}

form {
    display: flex;
    flex-direction: column;
    flex: 1; /* Растягивает форму, занимая всё свободное место */
}

/* Форма и инпуты */
.input-group {
    margin-bottom: 16px;
    position: relative;
}

input {
    width: 100%;
    height: 50px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0 16px;
    font-size: 16px;
    color: var(--text-input);
    outline: none;
    transition: all 0.2s ease;
}

input::placeholder {
    color: var(--text-placeholder);
}

input:focus {
    border-color: var(--border-active);
    background-color: #fff;
}

input.error {
    border-color: var(--error);
    background-color: #fff;
}

/* Текст ошибки */
.error-message {
    color: var(--error);
    font-size: 12px;
    margin-top: 6px;
    display: none;
}

/* Группа пароля */
.password-group {
    position: relative;
}

.password-group input {
    padding-right: 40px;
}

.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%; /* Будет переопределено для выравнивания, если есть ошибка, но базовая позиция здесь */
    transform: translateY(-50%);
    cursor: pointer;
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* Специальный фикс для иконки, когда input высотой 50px */
.input-group:not(.has-error) .password-toggle {
    top: 25px; /* Середина инпута */
}
/* Если есть ошибка, позиционируем относительно верха инпута */
.input-group.has-error .password-toggle {
    top: 25px;
}

.password-toggle.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Кнопка отправки */
.btn-primary {
    width: 100%;
    height: 50px;
    background-color: var(--main-blue);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.btn-primary:active {
    opacity: 0.8;
}

.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Дисклеймер */
.disclaimer {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin-top: 12px;
    line-height: 1.4;
}

.disclaimer a {
    color: var(--main-blue);
    text-decoration: none;
}

/* Футер ссылка */
.footer-link {
    text-align: center;
    font-size: 14px;
    color: #999;
    margin-top: auto;
    padding-bottom: 20px;
}

.footer-link a {
    color: var(--main-blue);
    text-decoration: none;
    font-weight: 500;
}

.footer-link,
.footer-action {
    /* Если форма имеет flex: 1, то margin-top: auto здесь уже не обязателен,
       но лучше оставить для надежности */
    margin-top: auto;

    /* Убираем лишние отступы, так как отступ уже задан в padding-bottom контейнера */
    padding-bottom: 0;
}

/* Утилита для растягивания контейнера на всю высоту, чтобы футер прижался */
.full-height {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 34px; /* Учет safe-area на iPhone */
}

/* --- Хедер --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 10px;
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--main-blue);
}

.header-placeholder {
    width: 24px; /* Балансирует кнопку назад */
}

/* Прогресс бар */
.progress-container {
    height: 4px;
    background-color: #F5F5F5;
    width: 100%;
    margin-bottom: 24px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--main-blue);
}

/* --- iOS Modal Styles --- */
.ios-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    display: none; /* Скрыто */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ios-modal-overlay.visible {
    opacity: 1;
}

.ios-modal {
    width: 270px; /* Стандартная ширина iOS алерта */
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    overflow: hidden;
    transform: scale(1.1);
    transition: transform 0.2s ease;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.ios-modal-overlay.visible .ios-modal {
    transform: scale(1);
}

.ios-modal-body {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(60, 60, 67, 0.2);
}

.ios-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #000;
    line-height: 1.3;
}

.ios-modal-footer {
    display: flex;
    height: 44px;
}

.ios-modal-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #007AFF; /* iOS Blue */
    cursor: pointer;
    font-weight: 400;
}

.ios-modal-btn:first-child {
    border-right: 1px solid rgba(60, 60, 67, 0.2);
    font-weight: 400; /* Regular для отмены */
}

/* Кнопка "Да" (удалить) - Красная */
.ios-modal-btn.destructive {
    color: var(--error);
    font-weight: 600; /* Bold для важного действия */
}

.ios-modal-btn:active {
    background-color: rgba(0,0,0,0.05);
}
