:root {
    --theme-primary: #8B5CF6;
    --theme-secondary: #E96BB5;
    --theme-accent: #FFB36B;
    --theme-navy: #18142A;

    --text-dark: #242033;
    --text-muted: #6B6680;

    --bg-light: linear-gradient(135deg, #F5F1FF 0%, #FFF5F0 100%);
    --card-bg: rgba(255, 255, 255, 0.92);
    --input-bg: rgba(245, 241, 255, 0.5);

    /* Dashboard Design Tokens */
    --bg-card: #ffffff;
    --border-color: #E9E3F2;
    --text-main: #242033;
    --text-heading: #18142A;
    --shadow-card: 0 15px 40px rgba(60, 30, 100, 0.07);
    --shadow-glow: 0 0 25px rgba(168, 85, 247, 0.15);
    --transition-speed: 0.3s;
}

[data-theme="dark"] {
    --theme-primary: #9B6BFF;
    --theme-secondary: #E96BB5;
    --theme-accent: #FFB36B;
    --theme-navy: #ffffff;

    --text-dark: #eef2ff;
    --text-muted: #e5e5e5;

    --bg-light: #5b5b5b;
    --card-bg: rgba(61, 61, 61, 0.94);
    --input-bg: rgba(45, 45, 48, 0.8);

    --bg-card: #3d3d3d;
    --border-color: #8a8a8a;
    --text-main: #eef2ff;
    --text-heading: #ffffff;
    --shadow-card: 0 15px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(107, 56, 251, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--theme-primary) rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

::-webkit-scrollbar-thumb {
    background: var(--theme-primary);
    border-radius: 10px;
}

.bg-image {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url(../images/login-bg.jpg);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    z-index: 0;
}

.bg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(245, 241, 255, 0.65), rgba(255, 245, 240, 0.85));
    z-index: 1;
    animation: gradientShift 8s infinite alternate ease-in-out;
}

[data-theme="dark"] .bg-overlay {
    background: linear-gradient(135deg, rgba(30, 31, 34, 0.85), rgba(61, 61, 61, 0.9));
}

@keyframes gradientShift {
    0% {
        opacity: 0.85;
    }

    100% {
        opacity: 1;
    }
}

#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.main-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
}

.main-logo img {
    max-width: 280px;
    height: auto;
    border-radius: 5px;
    opacity: 0;
    animation: fadeInDown 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.wrapper {
    position: relative;
    z-index: 3;
}

.scene {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform-origin: center;
    animation: premiumCardEntrance 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes premiumCardEntrance {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

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

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding: 45px 30px;
    width: 415px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    box-shadow: var(--shadow-card), 0 0 30px rgba(139, 92, 246, 0.1);
    transition: transform 0.4s ease, box-shadow 0.4s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.login-card::before,
.login-card::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(135deg, #8B5CF6 0%, #A875F5 32%, #D878B8 58%, #F28A78 80%, #FFB36B 100%);
    background-size: 200% auto;
    z-index: 10;
    animation: borderFlow 3s linear infinite;
}

.login-card::before {
    top: 0;
    box-shadow: 0 2px 15px rgba(139, 92, 246, 0.4);
}

.login-card::after {
    bottom: 0;
    animation-direction: reverse;
    box-shadow: 0 -2px 15px rgba(216, 120, 184, 0.4);
}

/* @keyframes borderFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
} */

/* Element Animations inside Card */
.login-card>.login-header,
.login-card>form>* {
    opacity: 0;
    animation: slideUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Staggered Delays for all elements across all 4 pages */
.login-header {
    animation-delay: 0.2s;
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.instruction-text {
    animation-delay: 0.3s;
}

.form-group:nth-of-type(1) {
    animation-delay: 0.4s;
}

.form-group:nth-of-type(2) {
    animation-delay: 0.5s;
}

.form-group:nth-of-type(3) {
    animation-delay: 0.6s;
}

.otp-wrapper {
    animation-delay: 0.5s;
}

.forgot-link {
    animation-delay: 0.7s;
}

.login-btn {
    animation-delay: 0.8s;
}

.back-link-wrapper,
.resend-link-wrapper {
    animation-delay: 0.9s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
}

.aifi-text {
    font-size: clamp(3rem, 6vw, 4.2rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #8B5CF6 0%, #E96BB5 50%, #FFB36B 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: all 0.3s ease;
}

.login-subtitle {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--theme-navy);
    letter-spacing: 0.5px;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.login-subtitle::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, #8B5CF6, #E96BB5, #FFB36B);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.login-card:hover .login-subtitle::after {
    width: 80%;
}

.instruction-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 15px;
    line-height: 1.5;
    padding: 0 10px;
}

.form-group {
    position: relative;
    margin-bottom: 24px;
    margin-top: 10px;
}

.form-input {
    width: 100%;
    padding: 18px 22px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    font-size: 1.05rem;
    background: var(--input-bg);
    color: var(--theme-navy);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.with-icon .form-input {
    padding-left: 52px;
}

.has-toggle .form-input {
    padding-right: 60px;
}

.input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.input-icon svg,
.toggle-password svg {
    width: 20px;
    height: 20px;
    display: block;
    stroke: currentColor;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.3s ease, color 0.3s ease;
    color: var(--text-muted);
}

.toggle-password:hover {
    background: rgba(139, 92, 246, 0.1);
    color: var(--theme-primary);
}

.toggle-password .eye-closed {
    display: none;
}

.toggle-password.is-visible .eye-open {
    display: none;
}

.toggle-password.is-visible .eye-closed {
    display: inline-block;
}

.form-input:focus {
    outline: none;
    border-color: var(--theme-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 8px 20px rgba(139, 92, 246, 0.08);
}

.form-input:focus~.input-icon {
    color: var(--theme-primary);
}

.form-label {
    position: absolute;
    top: 50%;
    left: 22px;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.15, 1.2);
    background: transparent;
    padding: 0 8px;
    font-weight: 500;
    z-index: 3;
}

.with-icon .form-label {
    left: 52px;
}

.form-input:focus+.form-label,
.form-input:not(:placeholder-shown)+.form-label {
    top: 0px;
    left: 15px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--theme-primary);
    background: var(--bg-card);
    border-radius: 4px;
    padding: 2px 10px;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.12);
}

.with-icon .form-input:focus+.form-label,
.with-icon .form-input:not(:placeholder-shown)+.form-label {
    left: 42px;
}

.otp-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 25px;
    margin-top: 15px;
}

.otp-box {
    width: 45px;
    height: 55px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    background: var(--input-bg);
    color: var(--theme-primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.otp-box:focus {
    outline: none;
    border-color: var(--theme-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 8px 15px rgba(139, 92, 246, 0.1);
    transform: translateY(-2px);
}

.otp-box:hover:not(:focus) {
    border-color: var(--theme-primary);
}

.forgot-link {
    display: block;
    text-align: right;
    margin: -8px 0 24px;
    font-size: 0.92rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.forgot-link:hover {
    color: var(--theme-secondary);
    transform: translateX(-3px);
}

.login-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fff;
    background: linear-gradient(135deg, #8B5CF6 0%, #A875F5 32%, #D878B8 58%, #F28A78 80%, #FFB36B 100%);
    background-size: 200% auto;
    position: relative;
    overflow: hidden;
    z-index: 1;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.login-btn:hover {
    background-position: right center;
    transform: translateY(-3px);
}

.login-btn:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.3);
}

/* Button Loading Spinner */
.login-btn.btn-loading {
    pointer-events: none;
    opacity: 0.9;
    cursor: wait;
    transform: none !important;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3) !important;
}

.btn-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: btnSpinnerRotate 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes btnSpinnerRotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Resend Link & Back Link Wrappers */
.resend-link-wrapper,
.back-link-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 25px;
    text-align: center;
}

.back-link-wrapper {
    margin-top: 10px;
}

.resend-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.resend-link,
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--theme-primary);
    background: transparent;
    text-decoration: none;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid var(--theme-primary);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.back-link {
    border: none;
    color: var(--text-muted);
    padding: 0;
}

.resend-link svg,
.back-link svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.resend-link:hover {
    background: linear-gradient(135deg, #8B5CF6, #D878B8);
    color: white;
    box-shadow: 0 5px 15px rgba(139, 92, 246, 0.25);
    transform: translateY(-2px);
    border-color: transparent;
}

.resend-link:hover svg {
    transform: rotate(180deg);
}

.back-link:hover {
    color: var(--theme-primary);
}

.back-link:hover svg {
    transform: translateX(-4px);
}

.resend-link:hover svg {
    transform: rotate(180deg);
}

.back-link:hover {
    color: var(--theme-primary);
}

.back-link:hover svg {
    transform: translateX(-4px);
}

@media (max-width: 1024px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .bg-image,
    .bg-overlay,
    #particles-canvas {
        position: fixed;
    }

    .scene {
        min-height: auto;
        padding: 60px 20px 40px;
    }

    .login-card {
        width: 92%;
        max-width: 420px;
        margin: 90px auto;
    }
}

@media (max-width: 768px) {
    .aifi-text {
        font-size: 3.2rem;
    }

    .login-subtitle {
        font-size: 0.95rem;
    }

    .login-card {
        padding: 50px 35px;
        border-radius: 18px;
    }

    .login-btn {
        padding: 16px;
        font-size: 1.05rem;
        border-radius: 10px;
    }

    .otp-box {
        width: 42px;
        height: 50px;
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .scene {
        padding: 15px;
    }

    .login-card {
        padding: 40px 25px;
        border-radius: 20px;
        width: 95%;
        margin: 0 auto;
        margin-top: 120px;
    }

    .aifi-text {
        font-size: 2.8rem;
    }

    .form-input {
        padding: 15px 18px;
        font-size: 1rem;
    }

    .login-btn {
        padding: 15px;
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .main-logo {
        left: 0;
        text-align: center;
        margin: 0 auto;
        width: 100%;
    }

    .main-logo img {
        max-width: 250px;
    }

    .otp-wrapper {
        gap: 5px;
    }

    .otp-box {
        width: 38px;
        height: 48px;
        font-size: 1.2rem;
        border-radius: 8px;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 30px 15px;
    }

    .aifi-text {
        font-size: 2.2rem;
    }

    .form-input {
        font-size: 0.95rem;
    }

    .instruction-text {
        font-size: 0.85rem;
    }

    .otp-box {
        width: 34px;
        height: 42px;
        font-size: 1.1rem;
    }

    .resend-link,
    .back-link {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}