/* ============================================= */
/*  AUTH PAGES — Premium Minimal Design          */
/* ============================================= */

/* === Фон страницы === */
.auth {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(16, 185, 129, 0.07), transparent),
        radial-gradient(ellipse 50% 60% at 90% 80%, rgba(59, 130, 246, 0.06), transparent),
        linear-gradient(175deg, #fafbfc 0%, #f3f5fa 50%, #eef1f8 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* === Карточка === */
.auth-card {
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow:
        0 1px 2px rgba(16, 24, 40, 0.03),
        0 4px 12px rgba(16, 24, 40, 0.04),
        0 20px 48px rgba(16, 24, 40, 0.06);
    border-radius: 28px;
    padding: 44px 40px;
    animation: authFadeIn 650ms cubic-bezier(0.16, 1, 0.3, 1) both;
    position: relative;
}

.auth-card.is-shaking {
    animation: authShake 480ms ease;
}

/* === Шапка с логотипом === */
.auth-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.28);
    flex-shrink: 0;
}

.auth-logo svg {
    width: 24px;
    height: 24px;
}

.auth-brand {
    font-weight: 800;
    font-family: var(--font-display, "Manrope", sans-serif);
    font-size: 19px;
    letter-spacing: -0.02em;
    color: #101828;
}

/* === Бейдж роли === */
.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.08);
    color: #047857;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

/* === Заголовок и подзаголовок === */
.auth-title {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display, "Manrope", sans-serif);
    color: #101828;
    margin: 0 0 8px;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.auth-subtitle {
    color: #667085;
    font-size: 15px;
    line-height: 1.55;
    margin: 0 0 28px;
}

/* === Блок алертов (ошибки / успех) === */
.auth-alerts {
    margin-bottom: 20px;
    display: grid;
    gap: 10px;
}

.auth-alerts [hidden] {
    display: none !important;
}

/* === Форма === */
.auth-form {
    display: grid;
    gap: 18px;
}

.auth-form .field {
    display: grid;
    gap: 6px;
}

.auth-form .label {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
}

.auth-form .input {
    width: 100%;
    min-height: 48px;
    border: 1.5px solid #e4e7ec;
    border-radius: 14px;
    padding: 12px 16px;
    font-size: 16px;
    font-family: inherit;
    color: #101828;
    background: rgba(255, 255, 255, 0.8);
    outline: none;
    transition: border-color 200ms ease, box-shadow 200ms ease;
    -webkit-appearance: none;
    appearance: none;
}

.auth-form .input::placeholder {
    color: #98a2b3;
}

.auth-form .input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Кнопка отправки */
.auth-form .btn-primary {
    width: 100%;
    min-height: 52px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    margin-top: 4px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
    position: relative;
    overflow: hidden;
}

.auth-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.32);
}

.auth-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.auth-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.auth-form .btn-primary.is-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 600ms linear infinite;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
}

.auth-form .btn-primary.is-loading {
    color: transparent;
}

/* === Ссылки под формой === */
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.auth-links a {
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 600;
    transition: color 180ms ease;
}

.auth-links a:hover {
    color: #4f46e5;
    text-decoration: underline;
}

.auth-switch {
    margin-top: 28px;
    text-align: center;
    color: #667085;
    font-size: 14px;
}

.auth-switch a {
    color: #10b981;
    font-weight: 700;
    text-decoration: none;
    transition: color 180ms ease;
}

.auth-switch a:hover {
    color: #059669;
    text-decoration: underline;
}

.auth-alt {
    margin-top: 12px;
    text-align: center;
    font-size: 13px;
    color: #98a2b3;
}

.auth-alt a {
    color: #667085;
    text-decoration: none;
    border-bottom: 1px dashed rgba(100, 116, 139, 0.35);
    transition: all 180ms ease;
}

.auth-alt a:hover {
    color: #101828;
    border-bottom-color: #101828;
}

/* ============================================= */
/*  PROFILE VIEW (пользователь уже вошёл)        */
/* ============================================= */
.auth-profile-view {
    display: flex;
    flex-direction: column;
    gap: 32px;
    animation: authFadeIn 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.auth-profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-display, "Manrope", sans-serif);
    flex-shrink: 0;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25);
}

.auth-profile-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.auth-profile-name {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-display, "Manrope", sans-serif);
    color: #101828;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.auth-profile-role {
    font-size: 11px;
    font-weight: 700;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-profile-email {
    font-size: 14px;
    color: #667085;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-profile-actions {
    display: flex;
    gap: 12px;
}

.auth-enter-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.25);
}

.auth-enter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.32);
}

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

.auth-logout-btn {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    background: rgba(240, 68, 56, 0.06);
    color: #f04438;
    border: 1.5px solid rgba(240, 68, 56, 0.12);
    border-radius: 16px;
    cursor: pointer;
    transition: all 200ms ease;
    flex-shrink: 0;
}

.auth-logout-btn:hover {
    background: #f04438;
    color: #fff;
    border-color: #f04438;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 68, 56, 0.22);
}

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

.auth-logout-btn.is-loading {
    opacity: 0.5;
    pointer-events: none;
    transform: none !important;
}

/* ============================================= */
/*  ANIMATIONS                                   */
/* ============================================= */
@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes authShake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(7px);
    }

    45% {
        transform: translateX(-5px);
    }

    60% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-2px);
    }

    90% {
        transform: translateX(1px);
    }
}

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

/* ============================================= */
/*  RESPONSIVE                                   */
/* ============================================= */

/* Планшеты и маленькие ноутбуки */
@media (max-width: 600px) {
    .auth {
        padding: 24px 16px;
        align-items: flex-start;
        padding-top: 48px;
    }

    .auth-card {
        padding: 36px 28px;
        border-radius: 24px;
    }

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

/* Мобильные устройства */
@media (max-width: 420px) {
    .auth {
        padding: 16px 12px;
        padding-top: 32px;
    }

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

    .auth-top {
        margin-bottom: 24px;
    }

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

    .auth-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .auth-form .input {
        min-height: 46px;
        padding: 10px 14px;
        border-radius: 12px;
    }

    .auth-form .btn-primary {
        min-height: 48px;
        border-radius: 12px;
    }

    /* Профиль на мобильных */
    .auth-profile-header {
        flex-direction: column;
        text-align: center;
        gap: 14px;
    }

    .auth-profile-info {
        align-items: center;
        width: 100%;
    }

    .auth-profile-name {
        font-size: 20px;
        white-space: normal;
        text-align: center;
    }

    .auth-profile-email {
        white-space: normal;
        text-align: center;
    }

    .auth-profile-actions {
        flex-direction: column;
    }

    .auth-logout-btn {
        width: 100%;
        height: 52px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        border-radius: 14px;
    }

    .auth-logout-btn::after {
        content: "Выйти из аккаунта";
        font-size: 15px;
        font-weight: 600;
        font-family: inherit;
    }
}

/* Очень маленькие экраны */
@media (max-width: 340px) {
    .auth-card {
        padding: 24px 16px;
        border-radius: 18px;
    }

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

    .auth-logo {
        width: 42px;
        height: 42px;
        border-radius: 12px;
    }

    .auth-brand {
        font-size: 17px;
    }
}

/* Предпочтение уменьшенного движения */
@media (prefers-reduced-motion: reduce) {

    .auth-card,
    .auth-profile-view {
        animation: none;
    }

    .auth-card.is-shaking {
        animation: none;
    }

    .auth-enter-btn,
    .auth-logout-btn,
    .auth-form .btn-primary {
        transition: none;
    }
}