:root {
    --auth-bg-1: #050b18;
    --auth-bg-2: #0a1630;
    --auth-card: rgba(9, 17, 34, 0.72);
    --auth-border: rgba(255, 255, 255, 0.12);
    --auth-text: #f4f8ff;
    --auth-muted: rgba(227, 236, 255, 0.72);
    --auth-primary: #4a7aff;
    --auth-secondary: #c043e5;
    --auth-cyan: #50dfdb;
    --auth-danger: #ff6f91;
    --auth-radius-lg: 22px;
    --auth-radius-md: 14px;
    --auth-shadow: 0 20px 55px rgba(3, 8, 20, 0.55);
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    color: var(--auth-text);
    background:
        radial-gradient(1200px 700px at 15% 10%, rgba(80, 223, 219, 0.12), transparent 65%),
        radial-gradient(1000px 600px at 90% 20%, rgba(192, 67, 229, 0.16), transparent 70%),
        linear-gradient(145deg, var(--auth-bg-1), var(--auth-bg-2));
    background-attachment: fixed;
    background-size: 140% 140%;
    animation: ambientGradient 18s ease-in-out infinite;
    overflow-x: hidden;
    font-family: "Bahnschrift", "Segoe UI", sans-serif;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    margin: 0;
    padding: 50px 0 50px;
    min-height: auto;
    position: relative;
    flex: 1;
    z-index: 2;
    overflow-x: clip;
    width: 100%;
}

#connexion-container {
    width: min(1200px, 94vw);
    margin: 0 auto;
    padding: 24px 0;
    position: relative;
    z-index: 3;
}

#connexion-container::before,
#connexion-container::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(42px);
    pointer-events: none;
    z-index: 0;
}

#connexion-container::before {
    width: 220px;
    height: 220px;
    left: -40px;
    top: 30px;
    background: rgba(80, 223, 219, 0.22);
    animation: floatGlow 9s ease-in-out infinite;
}

#connexion-container::after {
    width: 260px;
    height: 260px;
    right: -60px;
    bottom: 20px;
    background: rgba(192, 67, 229, 0.22);
    animation: floatGlow 11s ease-in-out infinite reverse;
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 22px;
    align-items: stretch;
    position: relative;
    z-index: 1;
    width: 100%;
}

.auth-left,
.auth-right {
    min-width: 0;
    width: 100%;
}

#conn,
.signup-panel {
    border-radius: var(--auth-radius-lg);
    border: 1px solid var(--auth-border);
    background: var(--auth-card);
    box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.28s ease, box-shadow 0.28s ease, border-color 0.28s ease;
    width: 100%;
    max-width: 100%;
}

#conn:hover,
.signup-panel:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 26px 64px rgba(3, 8, 20, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#conn {
    padding: clamp(24px, 3vw, 36px);
    position: relative;
    overflow: hidden;
    animation: cardRevealLeft 0.7s ease both;
}

#conn::before {
    content: "";
    position: absolute;
    inset: -120px auto auto -120px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(80, 223, 219, 0.3), transparent 70%);
    pointer-events: none;
}

#conn::after {
    content: "";
    position: absolute;
    inset: auto -120px -120px auto;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 122, 255, 0.28), transparent 72%);
    pointer-events: none;
    animation: pulseSoft 6s ease-in-out infinite;
}

#conn-form h1 {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: clamp(1.6rem, 2.2vw, 2rem);
    color: var(--auth-text);
}

.separation {
    height: 2px;
    width: 100%;
    margin: 16px 0 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--auth-cyan), var(--auth-primary), var(--auth-secondary));
    background-size: 200% 100%;
    animation: lineFlow 4.5s linear infinite;
}

.form-stack {
    display: grid;
    gap: 12px;
}

.form-stack label {
    color: var(--auth-muted);
    font-weight: 700;
    font-size: 0.96rem;
}

.form-stack input[type="text"],
.form-stack input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--auth-radius-md);
    background: rgba(7, 14, 28, 0.9);
    color: var(--auth-text);
    padding: 13px 14px;
    font-size: 0.98rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-stack input[type="text"]:hover,
.form-stack input[type="password"]:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.form-stack input::placeholder {
    color: rgba(228, 237, 255, 0.46);
}

.form-stack input:focus {
    outline: none;
    border-color: rgba(80, 223, 219, 0.9);
    box-shadow: 0 0 0 3px rgba(80, 223, 219, 0.2);
    transform: translateY(-1px);
}

.actions-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
    margin-top: 10px;
}

.submit-button,
#google-btn,
.btn-ghost,
.btn-google {
    border: 0;
    border-radius: 13px;
    min-height: 50px;
    font-weight: 700;
    font-size: 0.98rem;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.22s ease, filter 0.22s ease, background 0.22s ease;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
}

.submit-button::after,
#google-btn::after,
.btn-ghost::after,
.btn-google::after {
    content: "";
    position: absolute;
    top: 0;
    left: -140%;
    width: 70%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-18deg);
    transition: left 0.55s ease;
    pointer-events: none;
}

.submit-button:hover::after,
#google-btn:hover::after,
.btn-ghost:hover::after,
.btn-google:hover::after {
    left: 180%;
}

.submit-button {
    color: #fff;
    background: linear-gradient(100deg, var(--auth-primary), var(--auth-secondary));
    box-shadow: 0 14px 28px rgba(74, 122, 255, 0.28);
}

.submit-button:hover,
.submit-button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 18px 36px rgba(74, 122, 255, 0.34);
}

#google-btn,
.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 12px 22px rgba(0, 0, 0, 0.2);
}

#google-btn:hover,
.btn-google:hover,
#google-btn:focus-visible,
.btn-google:focus-visible {
    transform: translateY(-2px);
    filter: brightness(0.98);
}

.links-row {
    margin-top: 4px;
    display: flex;
    justify-content: flex-end;
}

.link-muted {
    color: var(--auth-cyan);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.94rem;
}

.link-muted:hover {
    text-decoration: underline;
}

.error-message {
    padding: 11px 12px;
    border-radius: 12px;
    margin: 14px 0 2px;
    font-size: 0.94rem;
    text-align: center;
    color: #fff;
    border: 1px solid rgba(255, 111, 145, 0.5);
    background: rgba(255, 78, 119, 0.18);
}

.signup-panel {
    height: 100%;
    box-sizing: border-box;
    padding: clamp(24px, 3vw, 34px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    text-align: left;
    animation: cardRevealRight 0.75s ease both;
}

.signup-panel h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    line-height: 1.25;
}

.signup-panel p,
.signup-note {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.55;
}

.signup-choices {
    margin-top: 6px;
    display: grid;
    gap: 10px;
}

.btn-ghost {
    color: var(--auth-text);
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.06);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
}

#popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 20, 0.72);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

#popup-box {
    width: min(500px, 90vw);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(9, 17, 34, 0.9);
    box-shadow: var(--auth-shadow);
    padding: 24px;
    text-align: center;
    animation: popupIn 0.32s ease both;
}

#popup-box p {
    margin: 0;
    color: var(--auth-text);
    line-height: 1.65;
}

#popup-box button {
    margin-top: 16px;
    background: linear-gradient(100deg, var(--auth-cyan), var(--auth-primary));
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 11px 24px;
    font-weight: 700;
    cursor: pointer;
}

@font-face {
    font-family: "Bahnschrift";
    src: url("https://db.onlinewebfonts.com/t/0a6ee448d1bd65c56f6cf256a7c6f20a.ttf") format("truetype");
    font-display: swap;
}

@media (max-width: 1024px) {
    #connexion-container {
        width: 100%;
        max-width: 640px;
        padding: 10px 8px;
    }

    .auth-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .signup-panel {
        text-align: center;
    }
}

@media (max-width: 700px) {
    .main-content {
        padding: 70px 0 18px;
        flex: 0 0 auto;
    }

    #connexion-container {
        width: 100%;
        max-width: 480px;
        padding: 8px 6px;
    }

    #conn,
    .signup-panel {
        max-width: 440px;
        margin: 0 auto;
        border-radius: 16px;
        padding: 16px 12px;
    }

    .signup-panel {
        gap: 12px;
    }

    .signup-choices {
        gap: 8px;
    }

    .actions-row {
        gap: 10px;
    }

    .submit-button,
    #google-btn,
    .btn-ghost,
    .btn-google {
        min-height: 44px;
        font-size: 0.9rem;
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 66px 0 14px;
        flex: 0 0 auto;
    }

    #connexion-container {
        width: 100%;
        max-width: 390px;
        padding: 4px 5px;
    }

    #connexion-container::before,
    #connexion-container::after {
        display: none;
    }

    #conn,
    .signup-panel {
        max-width: 360px;
        margin: 0 auto;
        padding: 14px 10px;
    }

    .form-stack {
        gap: 8px;
    }

    .form-stack label {
        font-size: 0.92rem;
    }

    .form-stack input[type="text"],
    .form-stack input[type="password"] {
        padding: 10px;
        font-size: 0.9rem;
    }

    .submit-button,
    #google-btn,
    .btn-ghost,
    .btn-google {
        min-height: 42px;
        font-size: 0.88rem;
        padding: 9px 10px;
        width: 100%;
    }

    #google-btn img,
    .btn-google img {
        width: 16px;
        height: 16px;
    }

    #google-btn,
    .btn-google {
        white-space: normal;
        text-wrap: balance;
        line-height: 1.2;
    }

    .links-row {
        justify-content: center;
    }

    .link-muted {
        text-align: center;
    }

    #popup-box {
        width: 92vw;
        padding: 18px 14px;
    }
}

@media (max-width: 420px) {
    .main-content {
        padding: 64px 0 12px;
        flex: 0 0 auto;
    }

    #connexion-container {
        width: 100%;
        max-width: 340px;
        padding: 4px;
    }

    #conn,
    .signup-panel {
        max-width: 320px;
        margin: 0 auto;
        padding: 12px 8px;
    }

    #conn-form h1 {
        font-size: 1.08rem;
    }

    .signup-panel h2 {
        font-size: 0.98rem;
        line-height: 1.3;
    }

    .signup-panel p,
    .signup-note {
        font-size: 0.82rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .separation {
        margin: 12px 0 14px;
    }

    .link-muted {
        font-size: 0.82rem;
    }

    .submit-button,
    #google-btn,
    .btn-ghost,
    .btn-google {
        min-height: 40px;
        font-size: 0.82rem;
    }

    .form-stack label {
        font-size: 0.84rem;
    }
}

@media (hover: none) and (pointer: coarse) {
    #conn:hover,
    .signup-panel:hover,
    .submit-button:hover,
    #google-btn:hover,
    .btn-ghost:hover,
    .btn-google:hover {
        transform: none;
        filter: none;
        box-shadow: var(--auth-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .submit-button::after,
    #google-btn::after,
    .btn-ghost::after,
    .btn-google::after {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

@keyframes ambientGradient {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes floatGlow {
    0%,
    100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-16px) scale(1.06);
    }
}

@keyframes pulseSoft {
    0%,
    100% {
        opacity: 0.68;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.08);
    }
}

@keyframes lineFlow {
    from {
        background-position: 0% 0;
    }
    to {
        background-position: 200% 0;
    }
}

@keyframes cardRevealLeft {
    from {
        opacity: 0;
        transform: translateY(14px) translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

@keyframes cardRevealRight {
    from {
        opacity: 0;
        transform: translateY(14px) translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
