/* --- RESET E TEMA BASE --- */
:root {
    --color-bg: #111111;
    --color-card: #1d1d1f;
    --color-border: #333333;
    --color-input-bg: #2a2a2a;
    --color-text-primary: #f5f5f7;
    --color-text-secondary: #a1a1a6;
    --color-accent: #007aff;
}

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

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden; /* Impede scroll */

    display: flex;
    justify-content: center;
    align-items: center;
    position: relative; /* Para o posicionamento do background */
}

/* --- 1. EFEITO DE BACKGROUND DINÂMICO --- */
.background-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0; /* Abaixo de tudo */
}

/* A imagem de fundo (iPhones) */
.bg-image {
    position: absolute;
    width: 100%; /* << CORRIGIDO: Deve ser 100% para a máscara funcionar */
    height: 100%; /* << CORRIGIDO: Deve ser 100% para a máscara funcionar */

    background-image: url('../../img/iphone-back.jpg');
    background-size: contain; /* 'contain' vai centralizar sua imagem de 60% */
    background-position: center;
    background-repeat: no-repeat; /* Adicionado */

    /* Filtro para a imagem revelada (pode ajustar o brilho) */
    filter: grayscale(100%) brightness(40%) blur(2px);

    /* --- A MÁGICA ESTÁ AQUI ---
      O "laser" agora é uma MÁSCARA aplicada na própria imagem.
      Onde a máscara é 'white', a imagem aparece.
      Onde a máscara é 'transparent', a imagem desaparece (fica preta).
    */
    mask-image: linear-gradient(
        135deg,
        transparent 40%, /* Área escura/invisível */
        white 50%,       /* O "laser" (branco = 100% visível) */
        transparent 60%  /* Área escura/invisível */
    );
    mask-size: 400% 400%;
    mask-repeat: no-repeat;

    /* A máscara é que será animada */
    animation: laserScan 25s linear infinite;
}

/* O "laser de degrade" (NÃO É MAIS NECESSÁRIO) */
/* .laser-gradient { ... } */ /* <- PODE DELETAR ESSA REGRA */


@keyframes laserScan {
    /* --- ANIMAÇÃO CORRIGIDA ---
      Agora animamos a 'mask-position' (posição da máscara)
      em um loop de "vai e volta" (patrulha).
    */
    0% {
        mask-position: 0% 0%; /* Começa no Top-Left */
    }
    50% {
        mask-position: 100% 100%; /* Vai até o Bottom-Right */
    }
    100% {
        mask-position: 0% 0%; /* Volta para o Top-Left */
    }
}


/* --- 2. LOGOS FLUTUANTES --- */
.floating-logos-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.floating-logo {
    position: absolute;
    width: 100px;
    height: auto;
    opacity: 0.06;
    filter: grayscale(100%) brightness(200%);
    animation: floatAndRotate 25s ease-in-out infinite alternate;
}

@keyframes floatAndRotate {
    0% { transform: translateY(0px) rotate(0deg) scale(1); }
    50% { transform: translateY(-30px) translateX(20px) rotate(10deg) scale(1.02); }
    100% { transform: translateY(0px) rotate(0deg) scale(1); }
}


/* --- 3. CARD DE LOGIN --- */
.login-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 380px;
    background: var(--color-card);
    padding: 3rem 2.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.08);
    text-align: center;
    opacity: 0;
    transform: scale(0.95);
    animation: fadeIn 0.5s ease-out 0.1s forwards;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.grecaptcha-badge {
    padding: 1px;
    width: 100% !important; /* Garante largura total */
    margin: 0 auto;      /* Espaçamento em cima/baixo */
    display: flex !important;
    justify-content: center;
    box-shadow: none !important; /* Remove a sombra padrão do Google se ficar feia no card */
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- 4. LOGO COM ANEL DE PARTÍCULAS --- */
.card-logo {
    width: 160px;
    height: 160px;
    margin: 0 auto 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.colorful-particles {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 2px rgba(0,255,255,0.7),
        inset 10px 0 0 -5px rgba(0,122,255,0.7),
        inset -10px 0 0 -5px rgba(88,86,214,0.7),
        inset 0 10px 0 -5px rgba(255,45,85,0.7),
        inset 0 -10px 0 -5px rgba(255,149,0,0.7),
        inset 5px 5px 0 -5px rgba(255,204,0,0.7),
        inset -5px -5px 0 -5px rgba(52,199,89,0.7);
    border: 2px solid transparent;
    border-image: linear-gradient(
        to bottom right,
        #00c7ff, #007aff, #5856d6, #ff2d55, #ff9500, #ffcc00, #34c759, #00c7ff
    ) 1;
    animation: spin 10s linear infinite;
    mask-image: radial-gradient(circle at center, transparent 60%, black 60.5%);
    -webkit-mask-image: radial-gradient(circle at center, transparent 60%, black 60.5%);
}

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

.logo-image {
    width: 100%;
    height: auto;
    position: relative;
    z-index: 2;
}

/* --- Títulos e Textos --- */
h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* --- INPUTS E FORMULÁRIO --- */
.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 14px 50px 14px 18px;
    background: var(--color-input-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.input-group input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.3);
}

#login-form.show-password #username {
    background: #252527;
    color: var(--color-text-secondary);
    border-color: #252527;
}

.arrow-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    background: #333;
    border: none;
    border-radius: 50%;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.arrow-btn:hover {
    background-color: #444;
    color: var(--color-text-primary);
}

.arrow-btn svg {
    width: 20px;
    height: 20px;
}

/* --- LÓGICA DAS ETAPAS --- */
.password-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, opacity 0.4s ease-in-out;
}

#login-form.show-password .password-wrapper {
    max-height: 100px;
    opacity: 1;
}

#login-form.show-password #next-btn {
    display: none;
}

/* --- Links do Rodapé --- */
.form-footer {
    margin-top: 1.5rem;
}

.form-link {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.form-link:hover {
    text-decoration: underline;
}

.error-message{
    background-color: red;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

.shake-error {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* --- (NOVO) Sistema de Toast (Notificação) --- */
#toast-container {
    position: fixed;
    bottom: 30px; /* Distância do topo */
    left: 50%;
    transform: translateX(-50%); /* Centraliza */
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none; /* Permite clicar através dele */
}

.toast-message {
    background-color: #ff3b30; /* Vermelho erro da Apple */
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    opacity: 0;

    /* Animação de entrada */
    animation: fadeInToast 0.3s ease-out forwards;
}

/* Classe para remoção */
.toast-message.fade-out {
    animation: fadeOutToast 0.4s ease-in forwards;
}

@keyframes fadeInToast {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutToast {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* Animação de Shake (você já deve ter) */
.shake-error {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}
@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
