/* =========================================================
   Сброс и глобальные настройки
   ========================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* iOS FIX: предотвращаем зум при фокусе на input */
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;

    /* iOS FIX: фиксируем высоту */
    min-height: -webkit-fill-available;
}

/* =========================================================
   Фон (iOS FIX: без background-attachment: fixed)
   ========================================================= */
.login-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* iOS FIX: используем абсолютное позиционирование вместо fixed attachment */
    background-image: url('../img/background-img/glemping.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* iOS FIX: НЕ используем background-attachment: fixed */
    z-index: -2;

    /* iOS FIX: предотвращаем зум фона */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Затемнение */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

/* =========================================================
   Контейнер формы
   ========================================================= */
.login-container {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    z-index: 10;
}

/* =========================================================
   Карточка формы (glassmorphism)
   ========================================================= */
.login-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

/* =========================================================
   Заголовок
   ========================================================= */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-weight: 400;
}

/* =========================================================
   Форма
   ========================================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Группа полей */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Метка */
.form-group label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.required {
    color: #ff8c00;
}

/* Поля ввода */
.form-group input[type="text"],
.form-group input[type="password"] {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 14px 16px;

    /* iOS FIX: минимальный размер шрифта 16px предотвращает автозум */
    font-size: 16px;

    color: #fff !important;
    outline: none;
    transition: all 0.3s ease;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Focus state */
.form-group input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ff8c00;
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.2);
}

/* Автозаполнение (отключаем синий фон) */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff !important;
    -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.25) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* =========================================================
   Опции формы (запомнить меня + забыли пароль)
   ========================================================= */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* Чекбокс "Запомнить меня" */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #ff8c00;
}

/* Ссылка "Забыли пароль" */
.forgot-password {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.forgot-password:hover {
    color: #ffa500;
    text-decoration: underline;
}

/* =========================================================
   Кнопка входа
   ========================================================= */
.btn-login {
    background: linear-gradient(90deg, #ff8c00, #ffa500);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;

    /* iOS FIX: отключаем синюю подсветку при тапе */
    -webkit-tap-highlight-color: transparent;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 140, 0, 0.4);
    background: linear-gradient(90deg, #ffa500, #ff8c00);
}

.btn-login:active {
    transform: translateY(0);
}

/* =========================================================
   Ссылка на регистрацию
   ========================================================= */
.register-link {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-top: 4px;
}

.register-link a {
    color: #ffa500;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.register-link a:hover {
    color: #ff8c00;
    text-decoration: underline;
}

/* =========================================================
   Кнопка "Назад"
   ========================================================= */
.btn-back {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
    margin-top: 16px;
    transition: color 0.2s ease;
}

.btn-back:hover {
    color: #fff;
}

/* =========================================================
   Мобильная адаптация
   ========================================================= */
@media (max-width: 600px) {
    .login-container {
        padding: 16px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-header h1 {
        font-size: 28px;
    }

    .btn-login {
        font-size: 16px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   iOS Специфичные фиксы
   ========================================================= */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari */
    body {
        min-height: -webkit-fill-available;
    }

    /* Отключаем резиновый скролл */
    body {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }

    /* Фикс фона для iOS */
    .login-bg {
        position: absolute;
        min-height: 100vh;
    }
}

/* =========================================================
   Ландшафтная ориентация (горизонтальный экран)
   ========================================================= */
@media (max-height: 600px) and (orientation: landscape) {
    .login-container {
        padding: 12px;
        margin: 20px auto;
    }

    .login-card {
        padding: 24px 20px;
    }

    .login-header {
        margin-bottom: 20px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .form-group {
        gap: 6px;
    }

    .form-group input {
        padding: 12px 14px;
    }
}
/* =========================================================
   стили ошибки 
   ========================================================= */

.messages {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* ERROR */
.message.error {
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.3);
    color: #ffb3b3;
}

/* SUCCESS */
.message.success {
    background: rgba(0, 255, 0, 0.12);
    border: 1px solid rgba(0, 255, 0, 0.25);
    color: #b7ffb7;
}