:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --white: #ffffff;
    --gray-light: #f3f4f6;
    --text-color: #333;
    --shadow-soft: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
    --transition: all 0.6s ease-in-out;
}

/* Wrapper interno para transições suaves de conteúdo (Reset pass) */
.form-wrapper-inner {
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease-in-out;
}


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

body {
    background: #f6f5f7;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    height: 100vh;
}

h1 {
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
    font-size: 1.8rem;
}

h2 {
    text-align: center;
    margin-bottom: 10px;
}

p {
    font-size: 14px;
    font-weight: 100;
    line-height: 20px;
    letter-spacing: 0.5px;
    margin: 20px 0 30px;
}

.subtitle {
    font-size: 13px;
    color: #666;
    margin: 10px 0 20px;
}

span {
    font-size: 12px;
}

a {
    color: var(--text-color);
    font-size: 14px;
    text-decoration: none;
    margin: 15px 0;
    transition: 0.3s;
}

a:hover {
    color: var(--primary-color);
}

button {
    border-radius: 20px;
    border: 1px solid var(--primary-dark);
    background-color: var(--primary-dark);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: bold;
    padding: 12px 45px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 80ms ease-in;
    cursor: pointer;
}

button:active {
    transform: scale(0.95);
}

button:focus {
    outline: none;
}

button.ghost {
    background-color: transparent;
    border-color: #FFFFFF;
}

/* Formulários */
form {
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 50px;
    min-height: 100%;
    height: auto;
    text-align: center;
}

/* Inputs Bonitos */
.input-group {
    position: relative;
    width: 100%;
    margin: 8px 0;
}

input {
    background-color: #eee;
    border: none;
    padding: 12px 15px;
    padding-left: 40px;
    /* Espaço para icone */
    margin: 0;
    width: 100%;
    border-radius: 8px;
    outline: none;
    transition: 0.3s;
}

input:focus {
    background-color: #e0e7ff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    opacity: 0.5;
}

/* Container Principal */
.container {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    width: 1000px;
    /* Ajuste de largura desktop para caber melhor na tela */
    max-width: 95vw;
    height: 650px;
    /* Base height, reduzido de 750px para não esticar no Y em notebooks */
    max-height: 95vh;
    /* Garante que o container nao suma pela base ou topo da janela */
}

/* Containers de Sign In / Sign Up */
.form-container {
    position: absolute;
    top: 0;
    height: 100%;
    transition: var(--transition);
    overflow-y: auto;
    /* Scroll Ativado para paineis grandes como o Register no Desktop */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Sign In (Login) - Fica na esquerda por padrão */
.sign-in-container {
    left: 0;
    width: 50%;
    z-index: 2;
}

/* Sign Up (Cadastro) - Fica na direita oculto */
.sign-up-container {
    left: 0;
    width: 50%;
    opacity: 0;
    z-index: 1;
}

/* Animação: Quando painel direito ativo */
.container.right-panel-active .sign-in-container {
    transform: translateX(100%);
    /* Move login para direita */
}

.container.right-panel-active .sign-up-container {
    transform: translateX(100%);
    /* Traz cadastro para a visão */
    opacity: 1;
    z-index: 5;
    animation: show 0.6s;
}

@keyframes show {

    0%,
    49.99% {
        opacity: 0;
        z-index: 1;
    }

    50%,
    100% {
        opacity: 1;
        z-index: 5;
    }
}

/* Overlay (A parte colorida que desliza) */
.overlay-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 0.6s ease-in-out;
    z-index: 100;
}

.container.right-panel-active .overlay-container {
    transform: translateX(-100%);
    /* Move overlay para esquerda */
}

.overlay {
    background: #4f46e5;
    background: -webkit-linear-gradient(to right, #667eea, #764ba2);
    background: linear-gradient(to right, #667eea, #764ba2);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 0 0;
    color: #FFFFFF;
    position: relative;
    left: -100%;
    height: 100%;
    width: 200%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.container.right-panel-active .overlay {
    transform: translateX(50%);
}

.overlay-panel {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 40px;
    text-align: center;
    top: 0;
    height: 100%;
    width: 50%;
    transform: translateX(0);
    transition: transform 0.6s ease-in-out;
}

.overlay-panel p {
    color: rgba(255, 255, 255, 0.9);
}

.overlay-left {
    transform: translateX(-20%);
}

.container.right-panel-active .overlay-left {
    transform: translateX(0);
}

.overlay-right {
    right: 0;
    transform: translateX(0);
}

.container.right-panel-active .overlay-right {
    transform: translateX(20%);
}

.mobile-toggle-text {
    display: none;
    /* Escondido em desktop */
}

.logo-img {
    max-width: 80px;
    margin-bottom: 10px;
}

/* Alerts Django */
.messages {
    width: 100%;
    margin-bottom: 15px;
}

.alert {
    padding: 10px;
    border-radius: 5px;
    font-size: 13px;
    margin-bottom: 5px;
    text-align: left;
}

.alert-error {
    background: #fee2e2;
    color: #b91c1c;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
}

/* Campos de Registro Específicos */
.register-field {
    width: 100%;
    margin-bottom: 15px;
    text-align: left;
}

.register-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 6px;
    text-align: left;
}

.register-hint {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    line-height: 1.3;
}

.input-group--phone {
    display: flex;
    align-items: center;
    background-color: #eee;
    border-radius: 8px;
    padding-left: 12px;
    transition: 0.3s;
}

.input-group--phone:focus-within {
    background-color: #e0e7ff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.phone-prefix {
    font-size: 14px;
    font-weight: 500;
    color: #4b5563;
    padding-right: 8px;
    border-right: 1px solid #d1d5db;
}

.input-group--phone input {
    background-color: transparent;
    padding-left: 12px;
    margin: 0;
    border-radius: 0;
}

.input-group--phone input:focus {
    box-shadow: none;
    background-color: transparent;
}

.terms-check-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    text-align: left;
    color: #4b5563;
    margin-bottom: 20px;
    line-height: 1.4;
    cursor: pointer;
}

.terms-check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    cursor: pointer;
}

.terms-check-label a {
    color: var(--primary-color);
    margin: 0;
    display: inline;
}

.terms-check-label a:hover {
    text-decoration: underline;
}

/* ===== Botao Google Sign-In (Google Brand Guidelines) ===== */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    border-radius: 20px;
    border: 1px solid #dadce0;
    background-color: #ffffff;
    color: #3c4043;
    font-size: 12px;
    font-weight: bold;
    padding: 12px 45px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
    margin: 0;
    box-sizing: border-box;
    line-height: 1;
}

.btn-google:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3);
    color: #3c4043;
}

.btn-google:active {
    transform: scale(0.95);
    background-color: #f1f3f4;
}

.btn-google-icon {
    flex-shrink: 0;
    display: block;
}

.btn-google-text {
    flex: 1;
    text-align: center;
}

/* ===== Divisor visual "ou" ===== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 16px 0;
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background-color: #e2e8f0;
    display: block;
}

.auth-divider-text {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ===== RESPONSIVIDADE ===== */

/* Tablet e Telas Menores */
@media (max-width: 1024px) {
    .container {
        width: 95%;
        min-height: 700px;
    }

    form {
        padding: 0 30px;
    }
}

/* Mobile (Critico) */
@media (max-width: 768px) {
    body {
        /* Restaura flexbox no nivel raiz - body fixo */
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        min-height: 100vh;
        overflow: hidden;
        /* Nenhum scroll global */
        padding: 10px;
        /* Previne encostar o container na base do celular */
    }

    .container {
        /* Container não estoura os paddings raiz */
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 12px;
        box-shadow: var(--shadow-soft);
        /* Mantém o escopo da animação restrito à caixa (essencial pro Right Panel Slider Mobile) */
        overflow: hidden;
    }

    /* Esconde o Overlay (rosto visual roxo/gradiente deslizante desktop) */
    .overlay-container {
        display: none;
    }

    .form-container {
        /* Força Painéis brancos a ocuparem área total do container pai do cel */
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        /* HABILITA O SCROLL SOMENTE NO PAINEL */
        overflow-y: auto;
        overflow-x: hidden;
        /* Padding inferior para respiro no final da rolagem */
        padding: 20px 15px 40px;
        transition: opacity 0.3s ease;
        -webkit-overflow-scrolling: touch;
    }

    /* Login ocupa tudo por padrão (fica na "frente") */
    .sign-in-container {
        z-index: 5;
        opacity: 1;
        transform: none !important;
    }

    /* Cadastro fica transparente de fundo */
    .sign-up-container {
        z-index: 1;
        opacity: 0;
        transform: none !important;
    }

    /* Estados Ativos da Animação CSS JavaScript no Mobile */

    /* Quando "Criar Conta" é acionado (Slider simulado) */
    .container.right-panel-active .sign-in-container {
        opacity: 0;
        pointer-events: none;
        z-index: 1;
    }

    .container.right-panel-active .sign-up-container {
        opacity: 1;
        pointer-events: auto;
        z-index: 5;
    }

    /* Links nativos inseridos via HTML para atuar no slide no Mobile (Toggle Text JS) */
    .mobile-toggle-text {
        display: block;
        margin-top: 15px;
        margin-bottom: 30px;
        font-size: 14px;
        color: #666;
        text-align: center;
    }

    .mobile-toggle-text a {
        color: var(--primary-color);
        font-weight: bold;
    }

    form {
        padding: 0 10px;
        /* Libera a altura do form (conteúdo interno) no painel de scrollable */
        height: auto;
        min-height: 100%;
        justify-content: center;
        /* Centraliza pequenos formulários caso a tela seja grande */
        margin-top: 5px;
    }

    .logo-area {
        margin-top: 15px;
        margin-bottom: 25px;
    }

    h1 {
        font-size: 1.6rem;
    }
}