/* Login & Signup - Premium Modern Design */

/* === GOOGLE FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* === BASE STYLES === */
body {
    min-height: 100vh;
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #0f172a 25%, #1e1b4b 50%, #0f172a 75%, #0a0a1a 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* === ANIMATED BACKGROUND === */
.login-bg-animation {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.login-bg-gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 20%, rgba(99, 102, 241, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse 60% 80% at 80% 80%, rgba(139, 92, 246, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(6, 182, 212, 0.1) 0%, transparent 60%);
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {

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

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Floating orbs */
.login-bg-animation::before,
.login-bg-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: floatOrbs 20s ease-in-out infinite;
}

.login-bg-animation::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.login-bg-animation::after {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.3) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -10s;
}

@keyframes floatOrbs {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(50px, 50px) rotate(90deg);
    }

    50% {
        transform: translate(0, 100px) rotate(180deg);
    }

    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }
}

/* Particles */
.login-bg-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.login-bg-particles span {
    position: absolute;
    display: block;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.5), rgba(139, 92, 246, 0.5));
    border-radius: 50%;
    animation: floatParticle 20s linear infinite;
    opacity: 0;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.login-bg-particles span:nth-child(1) {
    left: 10%;
    width: 50px;
    height: 50px;
    animation-delay: 0s;
    animation-duration: 18s;
}

.login-bg-particles span:nth-child(2) {
    left: 20%;
    width: 20px;
    height: 20px;
    animation-delay: 2s;
    animation-duration: 24s;
}

.login-bg-particles span:nth-child(3) {
    left: 35%;
    width: 12px;
    height: 12px;
    animation-delay: 4s;
    animation-duration: 20s;
}

.login-bg-particles span:nth-child(4) {
    left: 50%;
    width: 35px;
    height: 35px;
    animation-delay: 0s;
    animation-duration: 22s;
}

.login-bg-particles span:nth-child(5) {
    left: 65%;
    width: 16px;
    height: 16px;
    animation-delay: 3s;
    animation-duration: 19s;
}

.login-bg-particles span:nth-child(6) {
    left: 75%;
    width: 60px;
    height: 60px;
    animation-delay: 6s;
    animation-duration: 25s;
}

.login-bg-particles span:nth-child(7) {
    left: 85%;
    width: 28px;
    height: 28px;
    animation-delay: 8s;
    animation-duration: 21s;
}

.login-bg-particles span:nth-child(8) {
    left: 25%;
    width: 40px;
    height: 40px;
    animation-delay: 10s;
    animation-duration: 23s;
}

.login-bg-particles span:nth-child(9) {
    left: 55%;
    width: 14px;
    height: 14px;
    animation-delay: 5s;
    animation-duration: 17s;
}

.login-bg-particles span:nth-child(10) {
    left: 90%;
    width: 22px;
    height: 22px;
    animation-delay: 7s;
    animation-duration: 26s;
}

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) rotate(0deg) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.6;
        transform: translateY(80vh) rotate(72deg) scale(1);
    }

    90% {
        opacity: 0.6;
        transform: translateY(-80vh) rotate(648deg) scale(1);
    }

    100% {
        transform: translateY(-100vh) rotate(720deg) scale(0);
        opacity: 0;
    }
}

/* === FORM CONTAINER === */
.form-container {
    position: relative;
    z-index: 1;
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
    animation: formEntrance 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-form-enhanced {
    background: linear-gradient(135deg,
            rgba(15, 23, 42, 0.9) 0%,
            rgba(30, 27, 75, 0.85) 50%,
            rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 28px;
    box-shadow:
        0 32px 64px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 100px rgba(99, 102, 241, 0.1);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    position: relative;
    overflow: hidden;
}

/* Shine effect on top */
.login-form-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg,
            transparent,
            rgba(99, 102, 241, 0.7),
            rgba(139, 92, 246, 0.7),
            rgba(236, 72, 153, 0.5),
            transparent);
    border-radius: 2px;
}

/* Subtle glow border animation */
.login-form-enhanced::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 30px;
    background: linear-gradient(45deg,
            rgba(99, 102, 241, 0.3),
            transparent 40%,
            transparent 60%,
            rgba(139, 92, 246, 0.3));
    z-index: -1;
    animation: borderGlow 4s linear infinite;
}

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

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

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

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

/* === TITLE === */
h1 {
    margin: 0 0 2rem;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    border-radius: 3px;
}

/* === FORM GROUPS === */
.form-group {
    margin-bottom: 1.5rem;
}

.login-input-group {
    margin-bottom: 1.5rem;
}

.login-input-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(165, 180, 252, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* === INPUT WRAPPER === */
.login-input-wrapper {
    position: relative;
    display: flex;
}

.login-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(148, 163, 184, 0.6);
    z-index: 2;
    pointer-events: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.login-input-wrapper:focus-within .login-input-icon {
    color: rgba(99, 102, 241, 0.9);
}

.login-input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem !important;
    background: rgba(30, 41, 59, 0.5);
    border: 2px solid rgba(71, 85, 105, 0.3);
    border-radius: 14px;
    color: #f1f5f9;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.login-input-wrapper input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.login-input-wrapper input:focus {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.15),
        0 4px 20px rgba(99, 102, 241, 0.2);
    outline: none;
}

.login-input-wrapper input:hover:not(:focus) {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(30, 41, 59, 0.6);
}

/* Password toggle */
.login-input-wrapper .password-toggle,
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(148, 163, 184, 0.6);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 2;
}

.password-toggle:hover {
    color: rgba(99, 102, 241, 0.9);
    background: rgba(99, 102, 241, 0.1);
}

/* Error message */
.login-error-msg {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #f87171;
    min-height: 1rem;
    padding-left: 4px;
}

/* === REMEMBER ME GROUP === */
.login-remember-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem !important;
}

.login-remember-group .login-toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    gap: 0.75rem;
    user-select: none;
    position: relative;
    margin: 0;
    flex-wrap: nowrap;
}

.login-toggle-label input[type=checkbox] {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
}

.login-toggle-switch {
    position: relative;
    display: inline-flex;
    width: 48px;
    height: 26px;
    background: rgba(71, 85, 105, 0.5);
    border-radius: 13px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border: 2px solid rgba(71, 85, 105, 0.4);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #ffffff, #e2e8f0);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.login-toggle-label input[type=checkbox]:checked~.login-toggle-switch {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: rgba(99, 102, 241, 0.8);
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.login-toggle-label input[type=checkbox]:checked~.login-toggle-switch .login-toggle-slider {
    transform: translateX(22px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.login-toggle-label:hover .login-toggle-switch {
    border-color: rgba(99, 102, 241, 0.5);
    transform: scale(1.02);
}

/* Remember me text */
.login-toggle-text {
    font-size: 0.9rem;
    color: rgba(148, 163, 184, 0.9);
    font-weight: 500;
    text-transform: none !important;
    letter-spacing: normal;
    order: 2;
    white-space: nowrap;
}

.login-toggle-switch {
    order: 1;
}

/* Forgot password link */
.login-forgot-link {
    font-size: 0.85rem;
    color: rgba(139, 92, 246, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.login-forgot-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    transition: width 0.3s ease;
}

.login-forgot-link:hover {
    color: #c4b5fd;
}

.login-forgot-link:hover::after {
    width: 100%;
}

/* === SUBMIT BUTTON === */
.login-submit-btn,
.form-group #submit {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 8px 24px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: buttonGlow 3s ease-in-out infinite;
}

@keyframes buttonGlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.login-submit-btn:hover:not(:disabled),
.form-group #submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow:
        0 12px 32px rgba(99, 102, 241, 0.5),
        0 0 40px rgba(139, 92, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.login-submit-btn:active:not(:disabled),
.form-group #submit:active:not(:disabled) {
    transform: translateY(-1px);
}

.login-submit-btn:disabled,
.form-group #submit:disabled {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.5) 0%, rgba(51, 65, 85, 0.5) 100%);
    color: rgba(148, 163, 184, 0.5);
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

/* Button shine effect */
.login-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.5s ease;
}

.login-submit-btn:hover:not(:disabled)::before {
    left: 100%;
}

.login-btn-text {
    transition: opacity 0.2s ease;
}

.login-btn-loader {
    display: none;
    position: absolute;
}

.login-btn-arrow {
    font-size: 0.9rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-submit-btn:hover:not(:disabled) .login-btn-arrow {
    transform: translateX(6px);
}

.login-submit-btn.loading .login-btn-text,
.login-submit-btn.loading .login-btn-arrow {
    opacity: 0;
}

.login-submit-btn.loading .login-btn-loader {
    display: block;
}

/* === DIVIDER === */
.login-divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
}

.login-divider span {
    padding: 0 1rem;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

/* === FOOTER === */
.login-footer {
    text-align: center;
}

.login-footer p {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(148, 163, 184, 0.8);
}

.login-signup-link {
    color: rgba(139, 92, 246, 0.95);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.login-signup-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    transition: width 0.3s ease;
}

.login-signup-link:hover {
    color: #c4b5fd;
}

.login-signup-link:hover::after {
    width: 100%;
}

/* === LOADING OVERLAY === */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#loading-overlay.active {
    display: flex;
}

.spinner-large {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top-color: #6366f1;
    border-right-color: #8b5cf6;
    animation: spinGradient 1s linear infinite;
    position: relative;
}

.spinner-large::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top-color: #a855f7;
    animation: spinGradient 0.8s linear infinite reverse;
}

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

/* === RESPONSIVE === */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }

    .form-container {
        padding: 1.75rem 1.25rem;
    }

    .login-form-enhanced {
        border-radius: 20px;
    }

    h1 {
        font-size: 1.65rem;
    }

    .login-remember-group {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .login-forgot-link {
        align-self: flex-end;
    }

    .login-bg-animation::before,
    .login-bg-animation::after {
        width: 300px;
        height: 300px;
    }

    /* Touch-friendly password toggle */
    .password-toggle {
        padding: 12px;
        min-width: 44px;
        min-height: 44px;
    }

    /* Larger toggle switch for touch */
    .login-toggle-switch {
        width: 52px;
        height: 30px;
    }

    .login-toggle-slider {
        width: 20px;
        height: 20px;
    }

    .login-toggle-label input[type=checkbox]:checked~.login-toggle-switch .login-toggle-slider {
        transform: translateX(22px);
    }
}

/* === REDUCED MOTION SUPPORT === */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
    }

    .login-bg-gradient {
        animation: none;
    }

    .login-bg-animation::before,
    .login-bg-animation::after {
        animation: none;
    }

    .login-bg-particles span {
        animation: none;
        opacity: 0.3;
    }

    .form-container {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .login-form-enhanced::after {
        animation: none;
    }

    .login-submit-btn {
        animation: none;
        background-position: 0% 50%;
    }

    * {
        transition-duration: 0.01ms !important;
    }
}

/* === PASSWORD CONTAINER (legacy support) === */
.password-container {
    position: relative;
}

/* === TEXT CENTER === */
.text-center {
    margin-top: 1.5rem;
    text-align: center;
}

/* === LEGACY FORM GROUP INPUT === */
.form-group label {
    font-size: 0.8rem;
    color: rgba(165, 180, 252, 0.9);
    margin-bottom: 0.5rem;
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.form-group input:not([type="checkbox"]):not([type="submit"]) {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(71, 85, 105, 0.3);
    border-radius: 14px;
    box-sizing: border-box;
    background: rgba(30, 41, 59, 0.5);
    outline: none;
    color: #f1f5f9;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-group input:not([type="checkbox"]):not([type="submit"]):focus {
    border-color: rgba(99, 102, 241, 0.7);
    background: rgba(30, 41, 59, 0.7);
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.15),
        0 4px 20px rgba(99, 102, 241, 0.2);
}