:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);
}

.auth-main {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 32px 16px 48px;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 32px;
    overflow: hidden;
    background: var(--nav-bg);
    border: 1px solid var(--nav-border);
    border-radius: 20px;
    box-shadow:
        var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.auth-card[data-mode="login"] [data-panel="register"],
.auth-card[data-mode="register"] [data-panel="login"] {
    display: none;
}

.auth-main .auth-card {
    animation: cardIn 0.6s var(--ease-spring) both;
}

.auth-card.animate-in > * {
    animation: itemIn 0.55s var(--ease-out) both;
}

.auth-card.animate-in > :nth-child(1) { animation-delay: 0.06s; }
.auth-card.animate-in > :nth-child(2) { animation-delay: 0.1s; }
.auth-card.animate-in > :nth-child(3) { animation-delay: 0.14s; }
.auth-card.animate-in > :nth-child(4) { animation-delay: 0.18s; }
.auth-card.animate-in > :nth-child(5) { animation-delay: 0.22s; }
.auth-card.animate-in > :nth-child(6) { animation-delay: 0.26s; }
.auth-card.animate-in > :nth-child(7) { animation-delay: 0.3s; }

.panel-in {
    animation: panelIn 0.4s var(--ease-out) both;
}

.auth-header {
    margin-bottom: 24px;
    text-align: center;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    margin-top: 6px;
    font-size: 13.5px;
    color: #a3a6ad;
}

.auth-tabs {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.auth-tabs-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.45s var(--ease-spring);
}

.auth-card[data-mode="register"] .auth-tabs-indicator {
    transform: translateX(100%);
}

.auth-tabs a {
    position: relative;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #a3a6ad;
    transition: color 0.3s;
}

.auth-tabs a:hover,
.auth-card[data-mode="login"] [data-tab="login"],
.auth-card[data-mode="register"] [data-tab="register"] {
    color: var(--text);
}

.auth-alerts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 12px;
    border: 1px solid;
}

.alert-success {
    color: #86efac;
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
}

.alert-warning {
    color: #fcd34d;
    background: rgba(234, 179, 8, 0.1);
    border-color: rgba(234, 179, 8, 0.25);
}

.alert-error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
}

.alert-action button {
    margin-top: 8px;
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
}

.btn-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 44px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: #5865f2;
    border-radius: 12px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 6px 18px rgba(88, 101, 242, 0.25);
    transition: background 0.2s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.btn-discord:hover {
    background: #4f5bdb;
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 10px 24px rgba(88, 101, 242, 0.35);
}

.btn-discord:active {
    transform: scale(0.98);
    transition-duration: 0.08s;
}

.btn-discord svg {
    width: 20px;
    height: 20px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    font-size: 12px;
    color: #80848e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 12.5px;
    font-weight: 600;
    color: #c4c7cd;
}

.field input {
    height: 44px;
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    color: var(--text);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.field input:focus {
    background: rgba(0, 0, 0, 0.26);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.06);
}

.field-error {
    font-size: 12px;
    color: #fca5a5;
    animation: shake 0.4s var(--ease-out);
}

.btn-primary {
    height: 44px;
    margin-top: 6px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #1e1f22;
    background: linear-gradient(180deg, #ffffff 0%, #e4e6ea 100%);
    border: none;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
}

.btn-primary:active {
    transform: scale(0.98);
    transition-duration: 0.08s;
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    padding: 16px;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 0.4s;
}

.auth-modal.open {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.auth-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 13, 15, 0.55);
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
    opacity: 0;
    transition: opacity 0.4s var(--ease-out), backdrop-filter 0.4s var(--ease-out), -webkit-backdrop-filter 0.4s var(--ease-out);
}

.auth-modal.open .auth-backdrop {
    opacity: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: auto;
    opacity: 0;
    transform: translateY(24px) scale(0.92);
    transition: opacity 0.25s var(--ease-out), transform 0.3s var(--ease-out);
}

.auth-modal.open .auth-dialog {
    opacity: 1;
    transform: none;
    transition: opacity 0.35s var(--ease-out), transform 0.55s var(--ease-spring);
}

.auth-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: #a3a6ad;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.35s var(--ease-spring);
}

.auth-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.auth-close svg {
    width: 16px;
    height: 16px;
}

body.modal-open {
    overflow: hidden;
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.94);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes itemIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-2px); }
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
    }
}
