* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a0f1a 0%, #2d1b1b 50%, #3d1a00 100%);
    min-height: 100vh;

    display: flex;
    justify-content: center;
    align-items: center;

    padding: 20px;

    overflow-x: hidden;
    overflow-y: auto;

    position: relative;
}

/* Animated background particles */
.particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: #ff8a4c;
    border-radius: 50%;
    animation: float 6s infinite linear;
    opacity: 0.3;
}

@keyframes float {
    0% {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-10px) translateX(100px);
        opacity: 0;
    }
}

/* Glowing orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 138, 76, 0.1) 0%, transparent 70%);
    animation: pulse 4s infinite ease-in-out;
}

.orb:nth-child(1) {
    width: 200px;
    height: 200px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.orb:nth-child(2) {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.2);
        opacity: 0.1;
    }
}

/* Main container */
.container {
    background: rgba(26, 15, 26, 0.9);
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 138, 76, 0.2);
    border-radius: 20px;
    padding: 35px 20px;
    width: 95vw;
    max-width: 420px;
    box-sizing: border-box;
    max-height: none;
    box-shadow:
        0 0 60px rgba(255, 138, 76, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.8s ease-out;
    position: relative;
    z-index: 10;
    transition: transform 0.3s ease-out;
    height: fit-content;
    min-height: fit-content;
    margin: auto;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.container:hover {
    transform: none;
}

/* @keyframes containerGlow {
    0% {
        box-shadow:
            0 0 60px rgba(255, 138, 76, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.05),
            0 20px 60px rgba(0, 0, 0, 0.5);
    }

    100% {
        box-shadow:
            0 0 80px rgba(255, 138, 76, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.1),
            0 20px 80px rgba(0, 0, 0, 0.6);
    }
} */

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }

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

/* ================= LOGO ================= */

.logo {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.logo h1 {
    position: relative;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    cursor: pointer;
    display: inline-block;
}

/* MAIN TEXT */

.logo h1 span {
    color: #ff8a4c;
    transition: opacity 0.3s ease;
    position: relative;
    z-index: 1;
    display: inline-block;
}

/* TYPING OVERLAY */

.logo h1::after {

    content: "CoDEV";

    position: absolute;

    top: 0;
    left: 0;

    width: 0;

    overflow: hidden;

    white-space: nowrap;

    color: #ff8a4c;

    border-right: 2px solid #ff8a4c;

    opacity: 0;

    z-index: 2;

    /* pointer-events: none; */

}

/* HOVER EFFECT */

.logo h1:hover span {
    opacity: 0;
}

.logo h1:hover::after {

    opacity: 1;

    animation:
        logoTyping 1s steps(5, end) forwards,
        logoCaret 0.75s step-end infinite;

}

/* ANIMATIONS */

@keyframes logoTyping {

    from {
        width: 0;
    }

    to {
        width: 100%;
    }

}

@keyframes logoCaret {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: #ff8a4c;
    }

}

/* LIGHT MODE */

.light-theme .logo h1 span {
    color: #ff6b35 !important;
}

.light-theme .logo h1::after {
    color: #ff6b35 !important;
    border-right-color: #ff6b35 !important;
}


.form-group {
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
}

.form-group input {

    width: 100%;

    padding: 12px 20px;

    background: rgba(255, 255, 255, 0.06);

    border: 2px solid rgba(255, 255, 255, 0.12);

    border-radius: 10px;

    color: #ffffff;

    font-size: 15px;

    font-weight: 500;

    letter-spacing: 0.3px;

    opacity: 1;

    transition: all 0.3s ease-out;

    outline: none;

}


.form-group::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 138, 76, 0.2),
            transparent);
    transition: 0.5s;
}

.form-group:hover::before {
    left: 100%;
}

.form-group::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #ff8a4c, #ff6b35);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.form-group:focus-within::after {
    transform: translateX(0);
}

.form-group input:focus {
    background: rgba(255, 138, 76, 0.05);
    animation: focusField 0.5s ease forwards;
}

@keyframes focusField {
    0% {
        transform: scale(0.98);
    }

    50% {
        transform: scale(1.01);
    }

    100% {
        transform: scale(1);
    }
}

.form-group input:focus {
    border-color: #ff8a4c;
    background: rgba(255, 138, 76, 0.05);
    box-shadow: 0 0 20px rgba(255, 138, 76, 0.2);
    transform: translateY(-2px);
}

.form-group input::placeholder {

    color: rgba(255, 255, 255, 0.72);

    opacity: 1;

    font-weight: 500;

}

.form-group .icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.82);
    font-size: 18px;
    transition: color 0.3s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.form-group .password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: color 0.3s ease;
}

.form-group .password-toggle:hover {
    color: rgba(255, 255, 255, 0.8);
}

.form-group .password-toggle:active {
    color: rgba(255, 255, 255, 1);
}

.form-group .password-toggle:active {
    transform: translateY(-50%);
}

.form-group input:focus+.icon {
    color: #ff8a4c;
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ff8a4c, #ff6b35);
    background-size: 200% 200%;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    animation: gradientShift 3s ease infinite;
}

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

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

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

.login-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.login-btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

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

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 138, 76, 0.3);
}

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

.login-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;
}

.login-btn:hover::before {
    left: 100%;
}

.forgot-password {
    text-align: center;
    margin-bottom: 20px;
}

.forgot-password a {
    color: #ff8a4c;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
}

.forgot-password a:hover {
    color: #fff;
    text-shadow: 0 0 10px #ff8a4c;
}

.social-login {

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    flex-direction: row;
}

.social-btn {
    flex: 1;
    max-width: 110px;
    min-width: 0;
    height: 55px;

    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.05);

    color: #fff;

    text-decoration: none;

    text-align: center;

    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    font-size: 14px;

    display: flex;

    align-items: center;

    justify-content: center;

    position: relative;

    overflow: hidden;

    cursor: pointer;

    flex-shrink: 0;
}

.social-btn::before {
    content: '';

    position: absolute;

    top: 50%;

    left: 50%;

    width: 0;

    height: 0;

    background: rgba(255, 138, 76, 0.2);

    border-radius: 50%;

    transform: translate(-50%, -50%);

    transition: width 0.6s ease-out, height 0.6s ease-out;
}

.social-btn:hover {
    border-color: #ff8a4c;

    background: rgba(255, 138, 76, 0.1);

    transform: translateY(-2px) scale(1.05);

    box-shadow: 0 5px 15px rgba(255, 138, 76, 0.2);
}

.social-btn:hover::before {
    width: 150%;

    height: 150%;
}

.social-btn svg {
    width: 22px;

    height: 22px;

    transition: transform 0.3s ease;

    z-index: 2;
}

.social-btn:hover svg {
    transform: rotate(360deg);
}

/* Loading animation */
.loading {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Extra small phones
@media (max-width: 480px) {
    body {
        align-items: flex-start;
        justify-content: center;
        padding-top: 30px;
    }

    .container {
        width: 100%;
        padding: 24px;
        border-radius: 12px;
        box-shadow: none;
    }

    .logo h1 {
        font-size: 1.8rem;
    }

    .form-title {
        font-size: 20px;
    }

    .form-group input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .login-btn {
        font-size: 16px;
        padding: 14px;
        min-height: 48px;
    }
} */

/* Large desktops */
@media (min-width: 1200px) {
    .container {
        width: 520px;
        padding: 60px 48px;
    }

    .logo h1 {
        font-size: 3rem;
    }

    .form-title {
        font-size: 28px;
    }

    .social-btn {
        min-height: 50px;
    }
}

.success-message {
    display: none;
    background: rgba(255, 138, 76, 0.1);
    border: 1px solid rgba(255, 138, 76, 0.3);
    color: #ff8a4c;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-top: 20px;
    animation: fadeIn 0.5s ease;
    transform: rotateY(0deg);
    backface-visibility: hidden;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: rotateY(0deg) translateY(-10px);
    }

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

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 99999;
}

.theme-switch {
    display: none;
}

.theme-label {
    cursor: pointer;
    width: 60px;
    height: 30px;
    background: rgba(255, 138, 76, 0.2);
    border-radius: 50px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    transform-origin: center;
    transition: all 0.3s ease;
}

.theme-label:hover {
    transform: scale(1.05);
}

.theme-label::after {
    content: '';
    width: 24px;
    height: 24px;
    background: #ff8a4c;
    border-radius: 50%;
    position: absolute;
    left: 3px;
    transition: all 0.3s ease;
}

.theme-switch:checked+.theme-label::after {
    left: 33px;
}

.sun,
.moon {
    font-size: 14px;
}

/* Remember Me Checkbox */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.remember-me {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.remember-me input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 138, 76, 0.5);
    border-radius: 4px;
    margin-right: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.remember-me:hover .checkmark {
    border-color: #ff8a4c;
    transform: scale(1.05);
}

.remember-me input:checked+.checkmark {
    background: #ff8a4c;
    border-color: #ff8a4c;
}

.remember-me input:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    left: 4px;
    top: 0px;
}

/* Auto Save Indicator */
.auto-save-indicator {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auto-save-indicator.active {
    opacity: 1;
}

.auto-save-indicator .icon {
    margin-right: 5px;
    animation: saveIcon 0.5s ease;
}

@keyframes saveIcon {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Light Theme Styles */
body.light-theme {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 50%, #d4d4d4 100%);
}

.light-theme .container {
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 60px rgba(255, 138, 76, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.1);
}

.light-theme .form-group input {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.light-theme .form-title {
    color: #333;
}

.light-theme .switch-form {
    color: #666;
}

.light-theme .forgot-password a {
    color: #ff6b35;
}

.light-theme .switch-form a {
    color: #ff6b35;
}

.light-theme .remember-me {
    color: #666;
}

.light-theme .form-group input::placeholder {
    color: #888;
}

.light-theme .form-group .icon {
    color: #666;
}

.light-theme .auto-save-indicator {
    color: #666;
}

.light-theme .logo h1 span {
    color: #ff6b35;
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.2);
}

.light-theme .logo h1::after {
    color: #ff8a4c;
}

.light-theme .social-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #666;
}

/* Form switching animations - 3D Flip Effect with Fade */
.form-container {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 500px;
}

.form-flip-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
}

/* .form-flip-wrapper.flipped {
    transform: rotateY(180deg);
} */

.form {
    width: 100%;
}

.register-form {
    display: none;
}

.form-flip-wrapper.flipped .login-form {
    display: none;
}

.form-flip-wrapper.flipped .register-form {
    display: block;
}

.switch-form {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    position: relative;
    z-index: 100;
}

.switch-form a {
    color: #ff8a4c;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.switch-form a:hover {
    color: #fff;
    text-shadow: 0 0 10px #ff8a4c;
}

.form-title {
    text-align: center;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 300;
    margin-bottom: 20px;
    opacity: 0.9;
}

/* Name input styling for registration */
.name-row {
    display: flex;
    gap: 15px;
}

.name-row .form-group {
    flex: 1;
}


.password-group {
    position: relative;
}

/* Password Toggle */

.toggle-password {

    position: absolute;

    right: 45px;

    top: 50%;

    transform: translateY(-50%);

    background: none;

    border: none;

    color: #999;

    cursor: pointer;

    font-size: 16px;

    z-index: 5;

    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #ff8a4c;
}

/* Blury Text Fix */

/* TEXT SHARPNESS FIX */

body {

    -webkit-font-smoothing: antialiased;

    -moz-osx-font-smoothing: grayscale;

    text-rendering: optimizeLegibility;

}

/*------------- REMOVE TEXT BLUR-------------- */

h1,
h2,
h3,
p,
span,
a,
button,
input,
label {

    text-shadow: none !important;

    filter: none !important;

}

/* INPUT TEXT FIX */

input {

    font-weight: 500;

    color: #ffffff;

}

/* LIGHT MODE INPUT FIX */

.light-theme input {
    color: #222;
}

/* BUTTON TEXT */

button {
    font-weight: 600;
}

/* REMOVE TRANSFORM BLUR */

/* .container,
.form-container,
.form-group,
.social-btn {

    transform: translateZ(0);

    backface-visibility: hidden;

} */

/* ================= MOBILE RESPONSIVE ================= */

@media screen and (max-width: 768px) {

    body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;

        min-height: 100vh;

        overflow-y: auto;
        overflow-x: hidden;

        padding: 80px 15px 30px;
    }

    .container {
        width: 100%;
        max-width: 420px;

        padding: 28px 18px;

        border-radius: 18px;

        margin: auto;

        position: relative;
        z-index: 10;
    }

    .container:hover {
        transform: none;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .form-title {
        font-size: 2rem;
    }

    .name-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .social-login {
        display: flex;
        gap: 10px;
        width: 100%;
    }

    .social-btn {
        flex: 1;
        min-width: 0;
        height: 50px;
    }

    .switch-form {
        margin-top: 18px;
        margin-bottom: 10px;
        text-align: center;
        position: relative;
        z-index: 1000;
    }

    .theme-toggle {
        position: fixed;
        top: 15px;
        right: 15px;
        z-index: 99999;
    }

    .particles {
        pointer-events: none;
    }

    .orb {
        display: none;
    }
}

/* EXTRA SMALL PHONES */

@media screen and (max-width: 480px) {

    .container {

        width: 100%;

        padding: 20px 15px;

    }

    .logo h1 {

        font-size: 1.7rem;

    }

    .social-login {

        display: flex;
        flex-direction: row;
        gap: 10px;
        position: relative;
        z-index: 1;
    }

}

.social-btn {

    flex: 1;

    min-width: 0;

}

/* ================= MOBILE PERFORMANCE FIX =================

    @media screen and (max-width: 768px) {

        .particles {

            display: none !important;

        }

        .container {

            animation: none !important;

            transform: none !important;

            backdrop-filter: blur(4px);

        }

        .social-btn,
        .form-group input,
        .login-btn {

            transform: none !important;

            transition: 0.2s ease !important;

        }

        * {

            animation-duration: 0.2s !important;

        }

    } */

/* ===== PERFORMANCE STABILIZER ===== */

.container,
.social-btn,
.form-group input,
.login-btn {

    will-change: auto !important;

}

* {

    backface-visibility: hidden;

    -webkit-font-smoothing: antialiased;

}

/* ================= CLEAN MOBILE FIX =================

@media screen and (max-width: 768px) {

    body {

        align-items: flex-start;

        padding-top: 30px;

        padding-bottom: 30px;

    }

    .container {

        width: 100%;

        max-width: 420px;

        padding: 24px 18px;

        border-radius: 18px;

        animation: none;

    }

    .particles {

        opacity: 0.15;

    }

    .social-login {

        display: flex;

        flex-direction: row;

        gap: 10px;

    }

    .social-btn {

        flex: 1;

        min-width: 0;

        min-height: 48px;

    }

} */

@media screen and (max-width: 768px) {

    body {
        padding: 20px;
        overflow-y: auto;
        align-items: center;
        justify-content: center;
    }

    .container {

        width: 100%;

        max-width: 420px;

        padding: 28px 18px;

        border-radius: 18px;

        margin: auto;
    }

    .logo {
        margin-bottom: 25px;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .form-title {
        font-size: 2rem;
    }

    .name-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group input {

        width: 100%;

        font-size: 16px;

        padding: 14px 16px;
    }

    .social-login {

        display: flex;

        flex-direction: row;

        justify-content: center;

        align-items: center;

        gap: 10px;

        width: 100%;
    }

    .social-btn {

        flex: 1;

        max-width: 90px;

        min-width: 0;

        height: 50px;
    }

    .theme-toggle {

        position: fixed;

        top: 15px;

        right: 15px;

        z-index: 99999;
    }

    .particles {
        opacity: 0.2;
    }

    .orb {
        display: none;
    }

    .switch-form {
        margin-top: 15px;
        text-align: center;
        padding-bottom: 10px;
    }
}