@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap');

:root {
    --auth-page-bg: linear-gradient(160deg, #eef4ff 0%, #f9fbff 52%, #edf7f3 100%);
    --auth-surface: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(247, 250, 255, 0.88));
    --auth-border: rgba(148, 163, 184, 0.22);
    --auth-shadow: 0 40px 120px -46px rgba(15, 23, 42, 0.55), 0 24px 54px rgba(148, 163, 184, 0.18);
    --auth-text: #334155;
    --auth-muted: #6b7a90;
    --auth-title-gradient: linear-gradient(135deg, #0f172a 0%, #0f62fe 52%, #14b8a6 100%);
    --auth-label: #64748b;
    --auth-tab-track: rgba(241, 245, 249, 0.82);
    --auth-tab-border: rgba(148, 163, 184, 0.16);
    --auth-tab-text: #64748b;
    --auth-tab-active-text: #0f172a;
    --auth-tab-active-bg: rgba(255, 255, 255, 0.88);
    --auth-tab-active-shadow: 0 14px 28px -22px rgba(15, 23, 42, 0.4);
    --auth-input-bg: rgba(248, 250, 252, 0.92);
    --auth-input-border: rgba(148, 163, 184, 0.26);
    --auth-input-text: #0f172a;
    --auth-input-focus-glow: rgba(15, 98, 254, 0.18);
    --auth-input-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
    --auth-decor-1: rgba(15, 98, 254, 0.18);
    --auth-decor-2: rgba(20, 184, 166, 0.14);
    --auth-footer-border: rgba(148, 163, 184, 0.16);
    --auth-modal-bg: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    --auth-modal-border: rgba(148, 163, 184, 0.16);
    --auth-modal-shadow: 0 32px 90px -34px rgba(15, 23, 42, 0.55);
    --auth-loggedin-bg: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(244, 249, 255, 0.88));
}

body {
    background: var(--auth-page-bg) !important;
}

.custom-auth-container,
.custom-auth-loggedin {
    position: relative;
    width: min(96%, 760px);
    max-width: 760px;
    margin: clamp(28px, 5vw, 64px) auto;
    padding: clamp(30px, 4.5vw, 54px);
    border: 1px solid var(--auth-border);
    border-radius: 30px;
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow);
    color: var(--auth-text);
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    box-sizing: border-box;
    overflow: hidden;
    isolation: isolate;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.custom-auth-container::before,
.custom-auth-container::after,
.custom-auth-loggedin::before,
.custom-auth-loggedin::after {
    content: '';
    position: absolute;
    inset: auto;
    border-radius: 999px;
    filter: blur(0);
    pointer-events: none;
    z-index: -1;
}

.custom-auth-container::before,
.custom-auth-loggedin::before {
    top: -78px;
    right: -36px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, var(--auth-decor-1) 0%, transparent 72%);
}

.custom-auth-container::after,
.custom-auth-loggedin::after {
    bottom: -110px;
    left: -70px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, var(--auth-decor-2) 0%, transparent 72%);
}

.custom-auth-container.custom-auth-fullscreen {
    width: min(100%, 1200px) !important;
    max-width: min(100%, 1200px) !important;
    min-height: auto !important;
    margin: 0 auto !important;
    padding: clamp(28px, 3.3vw, 56px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.custom-auth-container.custom-auth-fullscreen .custom-auth-tabs,
.custom-auth-container.custom-auth-fullscreen .custom-auth-title,
.custom-auth-container.custom-auth-fullscreen .custom-auth-footer {
    width: 100%;
    max-width: 100%;
}

.custom-auth-container.custom-auth-fullscreen .auth-form {
    width: 100%;
    max-width: 100%;
}

.custom-auth-container.custom-auth-fullscreen .custom-auth-tabs {
    margin-bottom: 32px;
}

.custom-auth-container.custom-auth-fullscreen .custom-auth-footer {
    margin-top: 32px;
}

.custom-auth-title {
    margin: 0 0 28px;
    text-align: center;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(2rem, 3vw, 3rem);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.05em;
    background: var(--auth-title-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.custom-auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: min(100%, 420px);
    margin: 0 auto 30px;
    padding: 8px;
    border: 1px solid var(--auth-tab-border);
    border-radius: 22px;
    background: var(--auth-tab-track);
    backdrop-filter: blur(18px);
    box-sizing: border-box;
}

.auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 12px 16px;
    border: none;
    border-radius: 16px;
    background: transparent;
    color: var(--auth-tab-text);
    cursor: pointer;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.22s ease, color 0.22s ease;
    outline: none;
    text-align: center;
}

.auth-tab:hover {
    color: var(--auth-tab-active-text);
    transform: translateY(-1px);
}

.auth-tab.active {
    color: var(--auth-tab-active-text);
    background: var(--auth-tab-active-bg);
    box-shadow: var(--auth-tab-active-shadow);
}

.auth-form {
    display: none;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

.auth-form.active {
    display: block;
    animation: authRise 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-form form {
    margin: 0;
}

@keyframes authRise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    display: block;
    margin: 0;
    color: var(--auth-label);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.form-group input {
    width: 100%;
    min-height: 58px;
    padding: var(--cl-input-padding, 17px 22px);
    border: 1px solid var(--auth-input-border);
    border-radius: max(14px, var(--cl-border-radius, 14px));
    background: var(--auth-input-bg);
    box-shadow: var(--auth-input-shadow);
    color: var(--auth-input-text);
    font-family: inherit;
    font-size: var(--cl-input-fontsize, 17px);
    font-weight: 600;
    line-height: 1.4;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input::placeholder {
    color: color-mix(in srgb, var(--auth-muted) 82%, white 18%);
    font-weight: 500;
}

.form-group input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 68%, white 32%);
    box-shadow: 0 0 0 5px var(--auth-input-focus-glow);
    background: color-mix(in srgb, var(--auth-input-bg) 78%, white 22%);
    transform: translateY(-1px);
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper input {
    padding-right: 56px !important;
}

.username-check-icon,
.password-toggle-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    z-index: 2;
}

.username-check-icon {
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.password-toggle-icon {
    color: var(--auth-muted);
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    font-style: normal;
}

.password-toggle-icon:hover {
    color: color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 82%, white 18%);
    transform: translateY(-50%) scale(1.04);
}

.input-wrapper.valid .username-check-icon::after {
    content: '✓';
    color: #10b981;
    font-size: 20px;
    font-weight: 800;
}

.input-wrapper.invalid .username-check-icon::after {
    content: 'x';
    color: #ef4444;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
}

.input-wrapper.loading .username-check-icon::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid color-mix(in srgb, var(--auth-input-border) 82%, white 18%);
    border-top-color: var(--cl-btn-bg, #0f62fe);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.form-group button,
.custom-auth-modal-close,
.pmpro-action-btn,
.custom-auth-loggedin a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    max-width: 100%;
    min-width: var(--cl-btn-min-width, 148px);
    padding: var(--cl-btn-padding, 12px 18px);
    border: none;
    border-radius: max(12px, calc(var(--cl-border-radius, 14px) - 2px));
    background: linear-gradient(135deg, color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 78%, white 22%) 0%, var(--cl-btn-bg, #0f62fe) 60%, color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 82%, black 18%) 100%);
    color: var(--cl-btn-text, #ffffff);
    box-shadow: 0 22px 34px -24px color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 78%, transparent 22%);
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: var(--cl-btn-fontsize, 14px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease, opacity 0.22s ease;
}

.form-group button::before,
.custom-auth-modal-close::before,
.pmpro-action-btn::before,
.custom-auth-loggedin a::before {
    content: '';
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    background: linear-gradient(115deg, rgba(255, 255, 255, 0.3), transparent 45%, transparent 60%, rgba(255, 255, 255, 0.18));
    opacity: 0.7;
    pointer-events: none;
}

.form-group button:hover,
.custom-auth-modal-close:hover,
.pmpro-action-btn:hover,
.custom-auth-loggedin a:hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 42px -28px color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 82%, transparent 18%);
    filter: saturate(1.04);
}

.form-group button:active,
.custom-auth-modal-close:active,
.pmpro-action-btn:active,
.custom-auth-loggedin a:active {
    transform: translateY(0);
}

.form-group button:disabled {
    opacity: 0.56;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.form-group button.loading {
    padding-right: 42px;
    opacity: 0.88;
}

.form-group button.loading::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.form-footer-links {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
    margin-bottom: 8px;
}

.lost-password-trigger,
.back-to-login,
.custom-auth-modal-close-text {
    color: color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 72%, var(--auth-text) 28%);
    font-size: 0.92rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
}

.lost-password-trigger:hover,
.back-to-login:hover,
.custom-auth-modal-close-text:hover {
    color: color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 86%, white 14%);
    text-decoration: none;
}

.custom-auth-modal-close-text {
    display: block;
    margin: 16px auto 0;
    background: none;
    border: none;
}

.auth-message {
    display: none;
    margin-top: 24px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.6;
    text-align: center;
    backdrop-filter: blur(12px);
}

.auth-message.error {
    display: block;
    background: rgba(254, 242, 242, 0.9);
    color: #c0392b;
    border-color: rgba(248, 113, 113, 0.22);
    animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Field-level error messages */
.field-error {
    display: none;
    margin-top: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #c0392b;
    background: rgba(254, 242, 242, 0.85);
    border-radius: 8px;
    border-left: 3px solid #ef4444;
    line-height: 1.4;
    animation: fadeIn 0.2s ease-out;
}

.input-wrapper.invalid + .field-error,
.form-group .field-error {
    margin-top: 6px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-message.success {
    display: block;
    background: rgba(240, 253, 244, 0.92);
    color: #12805c;
    border-color: rgba(74, 222, 128, 0.24);
}

.custom-auth-loggedin {
    max-width: 620px;
    background: var(--auth-loggedin-bg);
    text-align: center;
}

.custom-auth-loggedin.custom-auth-fullscreen {
    width: min(100%, 1200px) !important;
    max-width: min(100%, 1200px) !important;
    min-height: auto !important;
    margin: 0 auto !important;
    padding: clamp(28px, 3.3vw, 56px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.custom-auth-loggedin p {
    margin: 0 0 24px;
    color: var(--auth-input-text);
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(1.5rem, 2.4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.custom-auth-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--auth-footer-border);
    color: var(--auth-muted);
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.8;
    letter-spacing: 0.18em;
    font-weight: 700;
    text-transform: uppercase;
}

.custom-auth-footer a {
    color: var(--auth-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.custom-auth-footer a:hover {
    color: color-mix(in srgb, var(--cl-btn-bg, #0f62fe) 80%, white 20%);
}

.pmpro-modal-content {
    text-align: center;
}

.pmpro-action-btn {
    margin-top: 20px;
}

.custom-auth-modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 999999;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px 14px;
    background: rgba(3, 7, 18, 0.68);
    backdrop-filter: blur(16px);
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    animation: customAuthFadeIn 0.28s ease;
}

.custom-auth-modal-content {
    width: min(100%, 460px);
    margin: auto;
    padding: clamp(28px, 4vw, 40px);
    border: 1px solid var(--auth-modal-border);
    border-radius: 28px;
    background: var(--auth-modal-bg);
    box-shadow: var(--auth-modal-shadow);
    text-align: center;
    position: relative;
    box-sizing: border-box;
    animation: customAuthScaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-auth-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 18px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(226, 232, 240, 0.34));
    font-size: 2rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.custom-auth-modal h2 {
    margin: 0 0 12px;
    color: var(--auth-input-text);
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.custom-auth-modal p {
    margin: 0 0 24px;
    color: var(--auth-muted);
    font-size: 0.98rem;
    line-height: 1.7;
}

.custom-auth-modal-close {
    min-width: 150px;
}

.lockout-compact {
    max-width: 420px !important;
    padding: 30px !important;
}

.lockout-details-box {
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    border-radius: 18px !important;
    cursor: copy;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.lockout-details-box:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 28px -24px rgba(15, 23, 42, 0.3);
}

.lockout-details-box:active {
    transform: scale(0.985);
}

.auth-suspended-view {
    text-align: center;
    padding: clamp(34px, 5vw, 60px) clamp(22px, 4vw, 40px) !important;
    border: 1px solid rgba(248, 113, 113, 0.18) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 245, 245, 0.9)) !important;
    box-shadow: 0 36px 100px -54px rgba(220, 38, 38, 0.25) !important;
}

.suspension-content-full {
    animation: fadeInLockout 0.55s ease;
}

.suspension-icon-large {
    margin-bottom: 20px;
    font-size: clamp(3.4rem, 7vw, 5rem);
    filter: drop-shadow(0 16px 22px rgba(220, 38, 38, 0.15));
}

.suspension-title {
    margin: 0 0 12px;
    color: #991b1b;
    font-family: 'Space Grotesk', 'Manrope', sans-serif;
    font-size: clamp(1.75rem, 4vw, 2.3rem);
    font-weight: 700;
    letter-spacing: -0.04em;
}

.suspension-text {
    max-width: 520px;
    margin: 0 auto 28px;
    color: #7f1d1d;
    font-size: 1rem;
    line-height: 1.75;
}

.suspension-footer {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(248, 113, 113, 0.16);
}

.ip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 14px;
    background: #991b1b;
    color: #ffffff;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 14px;
}

.monitoring-notice {
    color: #dc2626;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

@keyframes customAuthFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes customAuthScaleIn {
    from {
        transform: scale(0.94) translateY(10px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shake {
    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

@keyframes fadeInLockout {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media screen and (max-width: 768px) {
    .custom-auth-container,
    .custom-auth-loggedin {
        width: min(100%, calc(100% - 20px));
        margin: 20px auto;
        padding: 24px 18px;
        border-radius: 22px;
    }

    .custom-auth-container.custom-auth-fullscreen,
    .custom-auth-loggedin.custom-auth-fullscreen {
        width: 100% !important;
        margin: 0 !important;
        padding: 24px 16px !important;
        border-radius: 18px !important;
    }

    .custom-auth-tabs {
        width: 100%;
        margin-bottom: 24px;
    }

    .auth-tab {
        min-height: 46px;
        font-size: 0.92rem;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group button,
    .custom-auth-modal-close,
    .pmpro-action-btn,
    .custom-auth-loggedin a {
        width: 100%;
        min-width: 0;
    }

    .form-footer-links {
        justify-content: flex-start;
    }

    .custom-auth-modal {
        padding: 14px;
    }

    .custom-auth-modal-content {
        border-radius: 22px;
    }

    .auth-suspended-view {
        padding: 34px 20px !important;
    }
}

@media screen and (max-width: 480px) {
    .custom-auth-title {
        font-size: 1.9rem;
    }

    .custom-auth-tabs {
        grid-template-columns: 1fr 1fr;
        padding: 6px;
    }

    .auth-tab {
        min-height: 44px;
        padding: 10px 12px;
    }

    .form-group input {
        min-height: 54px;
    }

    .input-wrapper input {
        padding-right: 50px !important;
    }
}