/* ==========================================================================
   SULVPN - Авторизация, Регистрация и Восстановление пароля (auth.css)
   Премиальный темный интерфейс с глассморфизмом, неоновыми сферами и анимацией
   ========================================================================== */

/* Страничный контейнер и фон */
.auth-page-wrapper {
    position: relative;
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.25rem 4rem;
    overflow: hidden;
    background: radial-gradient(circle at 50% 20%, rgba(30, 27, 75, 0.5) 0%, transparent 75%);
}

.auth-bg-wrapper {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.auth-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.85;
}

.auth-grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 80%);
    z-index: 2;
}

/* Плавающие неоновые сферы */
.auth-glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
    opacity: 0.38;
    mix-blend-mode: screen;
    will-change: transform;
}

.auth-glow-orb.orb-1 {
    width: 440px;
    height: 440px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.6) 0%, transparent 70%);
    top: 10%;
    left: 15%;
    animation: floatAuthOrb1 18s ease-in-out infinite alternate;
}

.auth-glow-orb.orb-2 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.5) 0%, transparent 70%);
    bottom: 12%;
    right: 15%;
    animation: floatAuthOrb2 22s ease-in-out infinite alternate;
}

.auth-glow-orb.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.35) 0%, transparent 70%);
    top: 45%;
    right: 30%;
    animation: floatAuthOrb3 15s ease-in-out infinite alternate;
}

@keyframes floatAuthOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 30px) scale(1.08); }
    100% { transform: translate(-30px, -25px) scale(0.95); }
}

@keyframes floatAuthOrb2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-40px, -30px) scale(1.06); }
    100% { transform: translate(30px, 20px) scale(0.94); }
}

@keyframes floatAuthOrb3 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.1); }
    100% { transform: translate(-20px, 25px) scale(0.92); }
}

/* Карточка авторизации / регистрации */
.auth-container {
    position: relative;
    z-index: 3;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.auth-container.wide {
    max-width: 500px;
}

.auth-card {
    background: rgba(17, 24, 39, 0.76);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    padding: 2.5rem 2.25rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), 0 0 35px rgba(99, 102, 241, 0.12);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
    border-color: rgba(99, 102, 241, 0.28);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 45px rgba(99, 102, 241, 0.18);
}

/* Заголовок карточки */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 9999px;
    color: #a5b4fc;
    font-size: 0.84rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.auth-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.auth-title {
    font-size: 2.15rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.5;
}

/* Форма и поля */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.auth-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-control-auth {
    width: 100%;
    padding: 0.85rem 1rem 0.85rem 2.85rem;
    background: rgba(13, 19, 32, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.form-control-auth.has-toggle {
    padding-right: 3rem;
}

.form-control-auth:focus {
    border-color: #6366f1;
    background: rgba(13, 19, 32, 0.95);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.25);
}

.form-control-auth::placeholder {
    color: rgba(156, 163, 175, 0.6);
}

.form-control-auth:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-toggle-auth-pwd {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.btn-toggle-auth-pwd:hover {
    color: #ffffff;
}

.auth-field-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
}

/* Чекбокс согласия с условиями */
.auth-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-top: 0.25rem;
}

.cyber-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(13, 19, 32, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: all 0.2s ease;
}

.cyber-checkbox:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.cyber-checkbox:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.cyber-checkbox:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.cyber-checkbox-label {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.45;
    cursor: pointer;
}

.cyber-checkbox-label a {
    color: #a5b4fc;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.cyber-checkbox-label a:hover {
    color: #ffffff;
}

/* Кнопка отправки формы */
.btn-submit-auth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.35);
    transition: all 0.25s ease;
    margin-top: 0.5rem;
}

.btn-submit-auth:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.btn-submit-auth:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-auth-spinner {
    display: inline-block;
    animation: authSpin 1s linear infinite;
    line-height: 1;
}

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

/* Подвал карточки с ссылками */
.auth-footer {
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
}

.auth-footer-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-link {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.auth-link:hover {
    color: #ffffff;
    text-shadow: 0 0 12px rgba(165, 180, 252, 0.6);
}

.auth-link-forgot {
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.auth-link-forgot:hover {
    color: #a5b4fc;
}

/* Оповещения */
.auth-alert {
    padding: 0.9rem 1.15rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.auth-alert.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.auth-alert.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
}

/* ==========================================================================
   Модальные окна (Восстановление пароля, Предупреждение о почте, Успех)
   ========================================================================== */

.modal-cyber-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 10000;
    animation: modalOverlayFadeIn 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-cyber-card {
    background: rgba(17, 24, 39, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.65), 0 0 40px rgba(99, 102, 241, 0.2);
    animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    position: relative;
}

.modal-cyber-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    background: rgba(17, 24, 39, 0.98);
    z-index: 5;
}

.modal-title-with-icon {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.modal-icon-badge {
    font-size: 1.4rem;
    line-height: 1;
}

.modal-cyber-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.modal-cyber-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.modal-cyber-close:hover {
    color: #ffffff;
}

.modal-cyber-body {
    padding: 1.25rem 1.75rem;
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.6;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
}

/* Стилизация скроллбара в теле модалки */
.modal-cyber-body::-webkit-scrollbar {
    width: 6px;
}

.modal-cyber-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.modal-cyber-body::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.35);
    border-radius: 4px;
}

.modal-cyber-body::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.65);
}

.modal-cyber-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 19, 32, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-shrink: 0;
    z-index: 5;
    position: sticky;
    bottom: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}

.btn-modal-cancel {
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.btn-modal-action {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    transition: all 0.2s ease;
}

.btn-modal-action:hover:not(:disabled) {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

.btn-modal-action:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@keyframes modalOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalScaleIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Детали для предупреждений и уведомлений внутри модалок */
.cyber-info-box {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.88rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.cyber-info-box.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.cyber-info-box.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.cyber-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0 1.25rem;
}

.cyber-service-chip {
    padding: 0.3rem 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    font-size: 0.82rem;
    color: #e5e7eb;
}

.cyber-tips-list {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.88rem;
}

.cyber-tips-list li {
    position: relative;
    padding-left: 1.25rem;
}

.cyber-tips-list li::before {
    content: "•";
    position: absolute;
    left: 0.3rem;
    color: #6366f1;
    font-size: 1.2rem;
    line-height: 1;
}

/* ==========================================================================
   Страница Сброса Пароля (ResetPassword)
   ========================================================================== */

.reset-pwd-box {
    text-align: center;
}

.reset-status-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

.reset-status-icon.success {
    background: rgba(16, 185, 129, 0.15);
    border: 2px solid rgba(16, 185, 129, 0.4);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.reset-status-icon.error {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.reset-status-icon.loading {
    background: rgba(99, 102, 241, 0.15);
    border: 2px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.new-password-display {
    background: rgba(13, 19, 32, 0.85);
    border: 1px dashed rgba(99, 102, 241, 0.45);
    border-radius: 14px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.new-password-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.new-password-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.75rem;
    font-weight: 800;
    color: #a5b4fc;
    letter-spacing: 0.1em;
    user-select: all;
}

.btn-copy-pwd {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 8px;
    color: #a5b4fc;
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-copy-pwd:hover {
    background: rgba(99, 102, 241, 0.3);
    color: #ffffff;
}

.reset-actions-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Адаптивность */
@media (max-width: 640px) {
    .auth-card {
        padding: 2rem 1.5rem;
        border-radius: 20px;
    }

    .auth-title {
        font-size: 1.85rem;
    }

    .auth-glow-orb.orb-1 {
        width: 260px;
        height: 260px;
    }

    .auth-glow-orb.orb-2 {
        width: 240px;
        height: 240px;
    }

    .auth-glow-orb.orb-3 {
        display: none;
    }

    /* Мобильные модальные окна */
    .modal-cyber-overlay {
        padding: 0.5rem;
        align-items: center;
    }

    .modal-cyber-card {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
        border-radius: 18px;
    }

    .modal-cyber-header {
        padding: 1rem 1.15rem 0.85rem;
    }

    .modal-cyber-title {
        font-size: 1.05rem;
    }

    .modal-cyber-body {
        padding: 0.95rem 1.15rem;
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .modal-cyber-footer {
        padding: 0.85rem 1.15rem;
        padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
        flex-direction: column-reverse;
        gap: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }

    .btn-modal-action,
    .btn-modal-cancel {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 0.85rem 1rem;
        font-size: 0.95rem;
        box-sizing: border-box;
    }

    .cyber-info-box {
        padding: 0.75rem 0.85rem;
        margin: 0.75rem 0;
        font-size: 0.84rem;
    }

    .cyber-badge-list {
        gap: 0.35rem;
        margin: 0.65rem 0 1rem;
    }

    .cyber-service-chip {
        padding: 0.25rem 0.6rem;
        font-size: 0.78rem;
    }
}
