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

:root {
    --white: #fff;
    --black: #333;
    --lightBlue: #667eea;
    --accent: #764ba2;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.back-to-home {
    position: absolute;
    top: 20px;
    left: 20px;
    background: white;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-to-home:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.wrapper {
    position: relative;
    width: 820px;
    max-width: 100%;
    height: 500px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.wrapper .form-box {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    justify-content: center;
    flex-direction: column;
}

.wrapper .form-box.login {
    left: 0;
    padding: 0 60px 0 40px;
}

.wrapper .form-box.register {
    right: 0;
    padding: 0 40px 0 60px;
    pointer-events: none;
}

.wrapper.active .form-box.register {
    pointer-events: auto;
}

.form-box h2 {
    position: relative;
    margin: 0 auto 10px auto;
    text-align: center;
    font-size: 32px;
}

.form-box h2::after {
    content: "";
    display: block;
    margin: 8px auto 0 auto;
    width: 40px;
    height: 4px;
    background: var(--lightBlue);
}

.form-box .input-box {
    position: relative;
    width: 100%;
    height: 50px;
    /* MODIFIED: Reduced vertical margin to make the form less crowded */
    margin: 15px 0;
}

.input-box input {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--black);
    font-size: 16px;
    font-weight: 500;
    border: none;
    outline: none;
    border-bottom: 2px solid #333;
    transition: .4s;
    padding-right: 23px;
}

.input-box input:focus,
.input-box input:valid {
    border-bottom-color: var(--lightBlue);
}

.input-box label {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--black);
    pointer-events: none;
    transition: 0.4s;
}

.input-box input:focus~label,
.input-box input:valid~label {
    top: -5px;
    color: var(--lightBlue);
}

.input-box i {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    font-size: 18px;
    transition: 0.4s;
}

.input-box input:focus~i,
.input-box input:valid~i {
    color: var(--lightBlue);
}

form button.btn {
    width: 100%;
    height: 45px;
    background: linear-gradient(135deg, var(--lightBlue), var(--accent));
    color: var(--white);
    border: none;
    outline: none;
    border-radius: 40px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: .3s;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
}

form button.btn:hover {
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
}

form button.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.linkTxt {
    font-size: 14px;
    text-align: center;
    margin: 15px 0 10px;
}

.linkTxt a {
    color: var(--lightBlue);
    text-decoration: none;
    font-weight: 600;
}

.linkTxt a:hover {
    text-decoration: underline;
}

.error-message, .success-message {
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
    min-height: 16px;
    font-weight: 500;
}

.error-message { color: #dc3545; }
.success-message { color: #28a745; }

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s ease-in-out infinite;
    margin-right: 8px;
}

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

/* --- Animation & Transition Logic --- */
.wrapper .form-box.login .animation {
    transform: translateX(0);
    opacity: 1; filter: blur(0);
    transition: 0.4s ease;
    transition-delay: calc(.05s * var(--j));
}

.wrapper.active .form-box.login .animation {
    transform: translateX(-120%);
    opacity: 0; filter: blur(10px);
    transition-delay: calc(.05s * var(--i));
}

.wrapper .form-box.register .animation {
    transform: translateX(120%);
    opacity: 0; filter: blur(10px);
    transition: .4s ease;
    transition-delay: calc(.05s * var(--j));
}

.wrapper.active .form-box.register .animation {
    transform: translateX(0);
    opacity: 1; filter: blur(0);
    transition-delay: calc(.05s * var(--i));
}

/* Info Text Styling */
.info-text {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: var(--white);
}

.info-text.login {
    right: 0;
    text-align: right;
    padding: 0 40px 60px 150px;
}

.info-text.register {
    left: 0;
    text-align: left;
    /* MODIFIED: Reduced horizontal padding to prevent overflow */
    padding: 0 60px 60px 40px;
    pointer-events: none;
}

.wrapper.active .info-text.register {
    pointer-events: auto;
}

.info-text h2 {
    font-size: 36px;
    line-height: 1.3;
    text-transform: uppercase;
}

.info-text p {
    font-size: 16px;
}

/* Info Text Animations */
.info-text.login .animation {
    transform: translateX(0);
    opacity: 1; filter: blur(0);
    transition: 0.4s ease;
    transition-delay: calc(.05s * var(--j));
}
.wrapper.active .info-text.login .animation {
    transform: translateX(120px);
    opacity: 0; filter: blur(10px);
    transition-delay: calc(.05s * var(--i));
}
.info-text.register .animation {
    transform: translateX(-120%);
    opacity: 0; filter: blur(10px);
    transition: .4s ease;
    transition-delay: calc(.05s * var(--j));
}
.wrapper.active .info-text.register .animation {
    transform: translateX(0);
    opacity: 1; filter: blur(0);
    transition-delay: calc(.05s * var(--i));
}

/* Decorative Backgrounds */
.rotate-bg {
    position: absolute;
    top: -4px;
    right: 0;
    width: 850px;
    height: 600px;
    background: linear-gradient(135deg, var(--lightBlue), var(--accent));
    transform: rotate(10deg) skewY(40deg);
    transform-origin: bottom right;
    transition: 0.8s ease;
    transition-delay: 0.6s;
}
.wrapper.active .rotate-bg {
    transform: rotate(0) skewY(0);
    transition-delay: 0.2s;
}
.rotate-bg2 {
    position: absolute;
    top: 100%;
    left: 250px;
    width: 850px;
    height: 700px;
    background: var(--white);
    transform: rotate(0) skewY(0);
    transform-origin: bottom left;
    transition: 0.8s ease;
    transition-delay: 0.2s;
}
.wrapper.active .rotate-bg2 {
    transform: rotate(-11deg) skewY(-40deg);
    transition-delay: 0.5s;
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 850px) {
    .wrapper {
        width: 100%;
        height: auto;
        display: flex;
        flex-direction: column;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    .wrapper.active {
        /* This ensures the registration form shows correctly on mobile */
        flex-direction: column-reverse;
    }

    .info-text {
        display: none; /* Hide decorative text on small screens */
    }

    .rotate-bg, .rotate-bg2 {
        display: none; /* Hide decorative backgrounds on small screens */
    }

    .wrapper .form-box {
        position: relative;
        width: 100%;
        height: auto;
        padding: 40px;
        background: var(--white);
        border-radius: 10px;
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.2);
    }
    
    .wrapper .form-box.register {
        display: none;
    }
    
    .wrapper.active .form-box.login {
        display: none;
    }

    .wrapper.active .form-box.register {
        display: flex;
        pointer-events: auto; /* Ensure it's interactive */
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .back-to-home {
        top: 10px;
        left: 10px;
        padding: 8px 15px;
        font-size: 14px;
    }

    .wrapper .form-box {
        padding: 30px;
    }
    
    .form-box h2 {
        font-size: 28px;
    }
}

