/* ============================================
   АВТОРИЗАЦИЯ - СОВРЕМЕННЫЙ МОБИЛЬНЫЙ ДИЗАЙН
   ============================================ */

/* Основной контейнер */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

/* Анимированный фон */
.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 20s linear infinite;
    pointer-events: none;
}

@keyframes backgroundMove {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(50px, 50px);
    }
}

/* Контейнер карточки */
.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

/* Карточка авторизации */
.auth-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: cardSlideIn 0.5s ease-out;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.auth-title {
    font-size: 32px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

/* Блок ошибки */
.auth-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    margin-bottom: 24px;
    color: #dc2626;
    font-size: 14px;
    animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #dc2626;
}

.auth-error span {
    flex: 1;
    line-height: 1.5;
}

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

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

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

/* Обертка для input */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    width: 20px;
    height: 20px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 1;
    transition: color 0.3s ease;
}

.password-wrapper {
    position: relative;
}

/* Поле ввода */
.form-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    font-size: 16px;
    color: #1a1a1a;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    background: #ffffff;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: #667eea;
}

.form-input::placeholder {
    color: #9ca3af;
    font-size: 15px;
}

/* Кнопка показа пароля */
.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    transition: color 0.3s ease;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle:hover,
.password-toggle:focus {
    color: #667eea;
    outline: none;
}

.password-toggle:active {
    transform: scale(0.95);
}

.eye-icon {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

/* Кнопка входа */
.auth-submit {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(102, 126, 234, 0.4);
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.auth-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.submit-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* Футер формы */
.auth-footer {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.auth-footer-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.auth-link {
    display: inline-block;
    font-size: 15px;
    font-weight: 600;
    color: #667eea;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 8px 16px;
    border-radius: 8px;
}

.auth-link:hover {
    color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
}

.auth-link:active {
    transform: scale(0.98);
}

/* ============================================
   МОБИЛЬНАЯ ОПТИМИЗАЦИЯ
   ============================================ */

@media (max-width: 480px) {
    .auth-page {
        padding: 16px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }

    .auth-card {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .auth-title {
        font-size: 28px;
    }

    .auth-subtitle {
        font-size: 15px;
    }

    .form-input {
        padding: 14px 14px 14px 44px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }

    .input-icon {
        left: 14px;
        width: 18px;
        height: 18px;
    }

    .auth-submit {
        padding: 14px 20px;
        font-size: 16px;
    }

    .auth-error {
        padding: 12px 14px;
        font-size: 13px;
    }

    .error-icon {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 360px) {
    .auth-card {
        padding: 28px 20px;
    }

    .auth-title {
        font-size: 24px;
    }

    .form-input {
        padding: 12px 12px 12px 40px;
    }
}

/* Улучшение для очень маленьких экранов */
@media (max-height: 600px) {
    .auth-page {
        padding: 12px;
        align-items: flex-start;
        padding-top: 20px;
    }

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

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

    .auth-form {
        gap: 18px;
    }
}

/* Поддержка темной темы (если нужно) */
@media (prefers-color-scheme: dark) {
    .auth-card {
        background: rgba(17, 24, 39, 0.98);
    }

    .auth-title {
        color: #ffffff;
    }

    .auth-subtitle {
        color: #9ca3af;
    }

    .form-label {
        color: #e5e7eb;
    }

    .form-input {
        background: #1f2937;
        border-color: #374151;
        color: #ffffff;
    }

    .form-input:focus {
        background: #111827;
        border-color: #667eea;
    }

    .auth-footer {
        border-top-color: #374151;
    }

    .auth-footer-text {
        color: #9ca3af;
    }
}

/* Анимация загрузки (для будущего использования) */
.auth-submit.loading {
    pointer-events: none;
}

.auth-submit.loading .submit-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Улучшение доступности */
.form-input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.auth-submit:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.password-toggle:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Плавная прокрутка для мобильных */
@media (max-width: 768px) {
    html {
        scroll-behavior: smooth;
    }
}
