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

:root {
    --primary-green: #2ecc71;
    --secondary-green: #27ae60;
    --accent-lime: #a2d149;
    --bg-gradient: radial-gradient(circle at top right, #1a2f1c, #0f1710, #080c08);
    --container-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8f9f8;
    --text-muted: #a0a8a0;
    --input-bg: rgba(255, 255, 255, 0.05);
    --overlay-gradient: linear-gradient(135deg, var(--secondary-green), #0f1710);
    --transition-speed: 0.6s;
    --shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    --loader-bg: rgba(0, 0, 0, 0.85);
    --glass-glow: rgba(46, 204, 113, 0.15);
    --grid-color: rgba(46, 204, 113, 0.05);
}

body.light {
    --bg-gradient: linear-gradient(135deg, #f0f4f0, #e0e8e0);
    --container-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.15);
    --text-main: #0a2d0d;
    --text-muted: #2d4a2d;
    --input-bg: #ffffff;
    --overlay-gradient: linear-gradient(135deg, #27ae60, #2ecc71);
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --loader-bg: rgba(255, 255, 255, 0.8);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: background 0.5s ease, color 0.5s ease;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    transform: rotate(15deg) translate(-25%, -25%);
    animation: gridMove 60s linear infinite;
}

@keyframes gridMove {
    from {
        transform: rotate(15deg) translate(-25%, -25%);
    }

    to {
        transform: rotate(15deg) translate(-25%, -20%);
    }
}

/* Background Animation */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(46, 204, 113, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(80px);
    animation: move 20s infinite alternate linear;
}

.blob-1 {
    top: -100px;
    left: -100px;
}

.blob-2 {
    bottom: -150px;
    right: -150px;
    background: radial-gradient(circle, rgba(162, 209, 73, 0.1) 0%, transparent 70%);
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(150px, 150px) scale(1.2);
    }
}

.float-icon {
    position: absolute;
    color: var(--primary-green);
    opacity: 0.15;
    pointer-events: none;
    z-index: -1;
    filter: drop-shadow(0 0 10px var(--primary-green));
    transition: transform 0.1s ease-out;
}

/* Controls (Theme & Language) */
.controls-top {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    gap: 15px;
}




/* Container & Forms */
.container {
    position: relative;
    width: 1100px;
    /* Use min-height instead of fixed height */
    min-height: 750px;
    height: auto;
    margin: 20px auto;
    /* Allows scrolling if the form is long */
    display: flex;
    overflow: hidden;
    background: var(--container-bg);
    backdrop-filter: blur(40px);
    border-radius: 40px;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(46, 204, 113, 0.15), transparent 40%);
    z-index: 12;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.container:hover::before {
    opacity: 1;
}

.container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    z-index: 11;
}

.form-box {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    padding: 50px;
    transition: var(--transition-speed) ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form {
    left: 0;
    z-index: 2;
}

.signup-form {
    left: 0;
    /* Slide logic fix */
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

.container.active .login-form {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.container.active .signup-form {
    transform: translateX(100%);
    opacity: 1;
    pointer-events: all;
    z-index: 6;
}

/* Overlay & Sliding Animation Fix */
.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    background: var(--overlay-gradient);
    transition: var(--transition-speed) ease-in-out;
    z-index: 5;
    overflow: hidden;
}

.container.active .overlay-container {
    transform: translateX(-100%);
}

.overlay-panel {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px;
    gap: 25px;
    transition: var(--transition-speed) ease-in-out;
}

.overlay-left {
    transform: translateX(-20%);
    opacity: 0;
    pointer-events: none;
}

.container.active .overlay-left {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

.overlay-right {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

.container.active .overlay-right {
    transform: translateX(20%);
    opacity: 0;
    pointer-events: none;
}

/* UI Elements */
body h1 {
    font-size: 4rem;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--text-main) 10%, var(--primary-green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -3px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

body p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 30px;
}

.scroll-form {
    overflow-y: auto;
    padding-right: 15px;
    margin-bottom: 20px;
    max-height: 480px;
    /* Set height for scrollability */
}

.scroll-form::-webkit-scrollbar {
    width: 6px;
}

.scroll-form::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-form::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary-green);
    letter-spacing: 0.5px;
    opacity: 0.9;
}

body input,
body textarea,
body select {
    width: 100%;
    padding: 14px 18px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

body input:focus,
body textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    background: rgba(46, 204, 113, 0.05);
}

body select:focus {
    outline: none;
    border-color: var(--primary-green);
}

.row {
    display: flex;
    gap: 20px;
}

.row .input-group {
    flex: 1;
}

body button {
    padding: 22px 60px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary-green), var(--secondary-green));
    color: white;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease, transform 0.1s ease-out;
    text-transform: none;
    letter-spacing: 0px;
    position: relative;
    overflow: hidden;
    font-size: 1.4rem;
}

body button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: 0.4s;
}

body button:hover::before {
    opacity: 1;
}

body button:hover {
    box-shadow: 0 10px 30px rgba(46, 204, 113, 0.4);
}

/* Distinct Button Styles */
.login-form button[type="submit"] {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.login-form button[type="submit"]:hover {
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.5), 0 0 15px rgba(46, 204, 113, 0.2);
}

.signup-form button[type="submit"] {
    background: linear-gradient(135deg, #a2d149, #2ecc71);
    box-shadow: 0 4px 15px rgba(162, 209, 73, 0.4);
    color: #0c1c0e;
    font-weight: 800;
}

.signup-form button[type="submit"]:hover {
    box-shadow: 0 8px 30px rgba(162, 209, 73, 0.6), 0 0 20px rgba(162, 209, 73, 0.3);
}

button.ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

button.ghost:hover {
    background: white;
    color: var(--secondary-green);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
    border-color: white;
}

.mobile-toggle {
    display: none;
}

/* Inline Form Alerts */
.form-alert {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: center;
    font-weight: 600;
    display: block;
}

.form-alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.form-alert-success {
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: var(--primary-green);
}

body.light .form-alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: #b91c1c;
}

body.light .form-alert-success {
    background: rgba(46, 204, 113, 0.1);
    color: #15803d;
}

/* Password Visibility Toggle */
.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0;
    box-shadow: none;
    transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle::before {
    display: none;
}

.password-toggle:hover {
    background: rgba(46, 204, 113, 0.1);
    color: var(--primary-green);
    box-shadow: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--loader-bg);
    backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s ease;
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: contentScale 0.5s ease;
}

@keyframes contentScale {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tech-spinner {
    width: 120px;
    height: 120px;
    position: relative;
}

.tech-spinner svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.base-circle {
    fill: none;
    stroke: var(--glass-border);
    stroke-width: 2;
}

.inner-circle {
    fill: none;
    stroke: var(--primary-green);
    stroke-width: 1;
    stroke-dasharray: 10, 20;
    transform-origin: center;
    animation: rotate 10s linear infinite reverse;
    opacity: 0.5;
}

.orbiting-dot {
    fill: none;
    stroke: var(--primary-green);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 0.1, 282.6;
    transform-origin: center;
    animation: orbit 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 0 5px var(--primary-green));
}

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

    to {
        transform: rotate(360deg);
    }
}

@keyframes orbit {
    0% {
        stroke-dashoffset: 0;
        transform: rotate(0deg);
        stroke: var(--primary-green);
    }

    50% {
        stroke: var(--accent-lime);
        stroke-width: 8;
    }

    100% {
        stroke-dashoffset: -282.7;
        transform: rotate(360deg);
        stroke: var(--primary-green);
    }
}

.loading-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.loading-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Detect Location Button */
.detect-location-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px dashed var(--primary-green);
    border-radius: 15px;
    color: var(--primary-green);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detect-location-btn:hover {
    background: rgba(46, 204, 113, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.2);
}

.detect-location-btn::after {
    display: none;
}

.location-info {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--primary-green);
    text-align: center;
    font-weight: 500;
}

/* Responsiveness */
@media (max-width: 1100px) {
    .container {
        width: 95%;
        height: 750px;
    }

    body h1 {
        font-size: 3rem;
    }
}

@media (max-width: 950px) {
    body {
        overflow-y: auto;
        padding: 80px 0 40px;
    }

    .controls-top {
        top: 16px;
        right: 16px;
    }

    .container {
        width: 90%;
        max-width: 480px;
        height: auto;
        margin-top: 10px;
        flex-direction: column;
        overflow: visible;
        border-radius: 30px;
    }

    body h1 {
        font-size: 2.5rem;
        letter-spacing: -2px;
        margin-bottom: 10px;
    }

    body button {
        padding: 16px 40px;
        font-size: 1.1rem;
    }

    .form-box {
        position: relative;
        width: 100%;
        height: auto;
        padding: 40px 25px;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: all !important;
    }

    .signup-form {
        display: none;
        opacity: 0;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        padding-right: 5px;
    }

    .container.active .login-form {
        display: none;
    }

    .container.active .signup-form {
        display: block;
        position: relative;
        transform: translateY(20px) !important;
        animation: mobileFadeIn 0.5s forwards;
    }

    .row {
        flex-direction: column;
        gap: 18px;
    }

    @keyframes mobileFadeIn {
        to {
            opacity: 1;
            transform: translateY(0) !important;
        }
    }

    .overlay-container {
        display: none;
    }

    .mobile-toggle {
        display: block;
        margin-top: 25px;
        text-align: center;
        font-size: 1rem;
    }

    .mobile-toggle span {
        color: var(--primary-green);
        cursor: pointer;
        font-weight: 700;
        text-decoration: underline;
    }
}

@media (max-width: 380px) {
    .form-box {
        padding: 30px 18px;
    }

    body h1 {
        font-size: 2.1rem;
    }
}