/**
 * Auth Modal — mostyfm
 * Login & Registration modal overlay, glassmorphism card, tabs, form fields.
 * NOTE: Only the current (new) auth modal styles. Old duplicate block removed.
 */

/* =============================================
   AUTH MODAL (Login & Registration)
   ============================================= */

/* ---------- Overlay ---------- */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-modal-overlay:not([hidden]) {
    opacity: 1;
}

.auth-modal-overlay[hidden] {
    display: none;
}

/* ---------- Карточка ---------- */
.auth-modal-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-6);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
    overflow: hidden;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal-overlay:not([hidden]) .auth-modal-box {
    transform: translateY(0) scale(1);
}

/* ---------- Glow эффект ---------- */
.auth-modal-glow {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(162, 156, 140, 0.25) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="dark"] .auth-modal-glow {
    background: radial-gradient(ellipse, rgba(220, 221, 215, 0.12) 0%, transparent 70%);
}

/* ---------- Декоративные точки ---------- */
.auth-modal-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.auth-dot {
    position: absolute;
    border-radius: 50%;
    background: var(--color-primary);
    opacity: 0.15;
    animation: auth-dot-float 6s ease-in-out infinite;
}

.auth-dot--1 {
    width: 120px;
    height: 120px;
    bottom: -40px;
    right: -30px;
    animation-delay: 0s;
}

.auth-dot--2 {
    width: 60px;
    height: 60px;
    top: 20px;
    left: -20px;
    opacity: 0.1;
    animation-delay: -2s;
    animation-duration: 8s;
}

.auth-dot--3 {
    width: 20px;
    height: 20px;
    top: 50%;
    right: 24px;
    opacity: 0.2;
    animation-delay: -4s;
    animation-duration: 5s;
}

@keyframes auth-dot-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-12px);
    }
}

/* ---------- Кнопка закрытия ---------- */
.auth-modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 10;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.auth-modal-close:hover {
    background: var(--color-text);
    color: var(--color-surface);
    transform: rotate(90deg);
}

/* ---------- Логотип ---------- */
.auth-modal-logo {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: var(--space-2);
}

.auth-modal-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.auth-modal-logo-img {
    height: 36px;
    width: auto;
    filter: brightness(0);
    flex-shrink: 0;
}

[data-theme="dark"] .auth-modal-logo-img {
    filter: invert(1);
}

.auth-modal-logo-text {
    font-family: var(--font-family);
    font-weight: 900;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
    color: var(--color-text);
    text-transform: uppercase;
}

.auth-modal-tagline {
    position: relative;
    z-index: 1;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
    margin-top: 0;
}

/* ---------- Табы ---------- */
.auth-tabs {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 4px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 4px;
    margin-bottom: var(--space-5);
}

.auth-tab {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.auth-tab--active {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}

/* ---------- Сообщения ---------- */
.auth-message {
    position: relative;
    z-index: 1;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
    line-height: 1.5;
}

.auth-message[hidden] {
    display: none;
}

.auth-message--success {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.auth-message--error {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .auth-message--error {
    color: #f87171;
}

/* ---------- Форма ---------- */
.auth-form-panel {
    position: relative;
    z-index: 1;
}

.auth-form-panel[hidden] {
    display: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: none;
    letter-spacing: normal;
}

/* ---------- Поле ввода с иконкой ---------- */
.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-field-icon {
    position: absolute;
    left: 14px;
    color: var(--color-text-muted);
    pointer-events: none;
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.auth-input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.auth-input-wrap input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.6;
}

.auth-input-wrap input:focus {
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .auth-input-wrap input:focus {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.auth-input-wrap input:focus~.auth-field-icon {
    color: var(--color-text);
}

/* ---------- Поле пароля (toggle) ---------- */
.auth-password-wrap input {
    padding-right: 42px;
}

.auth-password-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: color var(--transition-fast);
}

.auth-password-toggle:hover {
    color: var(--color-text);
}

/* ---------- Запомнить меня ---------- */
.auth-remember {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text-muted);
    user-select: none;
}

.auth-remember input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-remember-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    position: relative;
}

.auth-remember input:checked~.auth-remember-check {
    background: var(--color-text);
    border-color: var(--color-text);
}

.auth-remember input:checked~.auth-remember-check::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid var(--color-surface);
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

/* ---------- Кнопка Submit ---------- */
.auth-submit {
    width: 100%;
    padding: 14px var(--space-5);
    border: none;
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: var(--color-surface);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: opacity var(--transition-fast), transform var(--transition-fast), background var(--transition-fast);
    margin-top: var(--space-2);
}

.auth-submit:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Лоадер (спиннер) ---------- */
.auth-btn-loader .spin {
    animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ---------- Адаптивность ---------- */
@media (max-width: 480px) {
    .auth-modal-box {
        padding: var(--space-6) var(--space-4);
        border-radius: var(--radius-lg);
    }
}