:root {
    --auth-bg: #F3E9FF;
    --auth-ink: #241B2F;
    --auth-muted: rgba(36, 27, 47, .65);
    --auth-card: rgba(255, 255, 255, .38);
    --auth-stroke: rgba(255, 255, 255, .55);
    --auth-shadow: 0 18px 60px rgba(26, 12, 40, .18);
    --auth-shadow-soft: 0 10px 30px rgba(26, 12, 40, .10);
    --auth-radius: 22px;
    --auth-radius-sm: 14px;
    --auth-accent: #6C2BD9;
    --auth-accent-2: #FF8A5C;
    --auth-focus: rgba(108, 43, 217, .28);
}

.user-name {
    color: #a78bfa;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    margin-left: 8px;
    white-space: nowrap;
}

.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(243, 233, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: authFadeIn 0.3s ease;
}

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

.auth-modal-content {
    width: min(440px, 100%);
    border-radius: calc(var(--auth-radius) + 6px);
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .40), rgba(255, 255, 255, .18));
    border: 1px solid rgba(255, 255, 255, .55);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(18px) saturate(145%);
    -webkit-backdrop-filter: blur(18px) saturate(145%);
    position: relative;
    overflow: hidden;
    animation: authSlideUp 0.3s ease;
}

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

.auth-modal-content::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 55%),
        radial-gradient(900px 300px at 20% 10%, rgba(255, 255, 255, .45), transparent 55%);
    opacity: .55;
    pointer-events: none;
}

.auth-modal-content::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    top: 10px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
    opacity: .9;
    pointer-events: none;
}

.auth-modal-inner {
    position: relative;
    z-index: 1;
    padding: 8px;
}

.close-modal-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.2s ease;
    border-radius: 50%;
    z-index: 10;
}

.close-modal-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.6);
}

.close-modal-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--auth-ink);
}

.auth-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 24px;
}

.modal-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(108, 43, 217, .22);
    margin-bottom: 12px;
}

.auth-modal-header h2 {
    font-family: 'Instrument Serif', serif;
    font-weight: 700;
    letter-spacing: .2px;
    font-size: 24px;
    line-height: 1.1;
    color: var(--auth-ink);
    margin: 0;
}

.auth-modal-header .logo-sub {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--auth-muted);
    letter-spacing: .2px;
}

.auth-tabs {
    display: flex;
    padding: 4px;
    border-radius: 999px;
    background: transparent;
    border: none;
    gap: 6px;
    margin-bottom: 16px;
}

.auth-tab {
    flex: 1;
    padding: 10px 12px;
    border-radius: 999px;
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s ease;
}

.auth-tab[aria-selected="true"] {
    background: rgba(255, 255, 255, .62);
    color: var(--auth-ink);
    box-shadow: var(--auth-shadow-soft);
}

.auth-tab:hover:not([aria-selected="true"]) {
    background: rgba(255, 255, 255, 0.2);
}

.auth-tab:active {
    transform: scale(.98);
}

.auth-panel {
    padding: 8px 4px;
    border-radius: calc(var(--auth-radius) - 2px);
    animation: authPanelFade 0.5s ease forwards;
}

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

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

.auth-form label {
    font-size: 11px;
    color: var(--auth-muted);
    font-weight: 700;
    display: block;
    margin: 12px 0 6px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-form .field {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .40);
    border: 1px solid rgba(36, 27, 47, .06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .40);
    transition: all .2s ease;
}

.auth-form .field:focus-within {
    border-color: rgba(108, 43, 217, .30);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .50),
        0 0 0 4px var(--auth-focus);
    background: rgba(255, 255, 255, .60);
}

.auth-form .field .icon {
    width: 18px;
    height: 18px;
    opacity: .6;
    flex: 0 0 auto;
}

.auth-form .field input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: var(--auth-ink);
    font-family: inherit;
}

.auth-form .field input::placeholder {
    color: rgba(36, 27, 47, .3);
}

.auth-form .password-field {
    position: relative;
}

.auth-form .toggle-password {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.auth-form .toggle-password:hover {
    opacity: 1;
}

.auth-form .eye-icon {
    width: 20px;
    height: 20px;
}

.auth-form .forgot-password-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.auth-form .forgot-password-link {
    background: transparent;
    border: none;
    color: var(--auth-accent);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s ease;
}

.auth-form .forgot-password-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.btn-auth {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: .5px;
    background: linear-gradient(135deg, var(--auth-accent), var(--auth-accent-2));
    color: white;
    box-shadow: 0 10px 25px rgba(108, 43, 217, .20);
    transition: all .2s ease;
    font-size: 14px;
}

.btn-auth:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(108, 43, 217, .25);
}

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

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--auth-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(36, 27, 47, 0.15), transparent);
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(36, 27, 47, 0.08);
    color: var(--auth-ink);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        0 4px 12px rgba(0, 0, 0, 0.06);
}

.btn-google:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 6px 16px rgba(0, 0, 0, 0.08);
}

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

.btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-fineprint {
    margin-top: 20px;
    font-size: 11px;
    text-align: center;
    color: var(--auth-muted);
}

.auth-fineprint a {
    color: rgba(108, 43, 217, .92);
    text-decoration: none;
    font-weight: 800;
}

.auth-fineprint a:hover {
    text-decoration: underline;
}

.forgot-modal {
    position: fixed;
    inset: 0;
    background: rgba(243, 233, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: authFadeIn 0.3s ease;
}

.forgot-modal[hidden] {
    display: none;
}

.forgot-modal-card {
    width: min(400px, 100%);
    border-radius: var(--auth-radius);
    padding: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--auth-shadow);
    animation: authSlideUp 0.3s ease;
}

.forgot-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.forgot-modal-header h3 {
    font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
    font-weight: 700;
    font-size: 22px;
    margin: 0;
    color: var(--auth-ink);
}

@media (max-width: 480px) {
    .auth-modal {
        padding: 16px;
    }

    .auth-modal-content {
        padding: 14px;
    }

    .auth-modal-header h2 {
        font-size: 20px;
    }
}
