/* =====================================================================
   MODERN AUTH DESIGN - LOGIN & REGISTER
   Design moderno, responsivo 100%, animações fluidas e sem limitações
   ===================================================================== */

:root {
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ===== ANIMAÇÕES AUTH ===== */

@keyframes authBgDrift1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(10vw, 8vh) scale(1.2);
    }
}

@keyframes authBgDrift2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-8vw, -10vh) scale(1.15);
    }
}

@keyframes authBgDrift3 {
    0%, 100% {
        transform: translate(-50%, 0) scale(1);
    }
    50% {
        transform: translate(-48%, -12vh) scale(1.25);
    }
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fieldSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes buttonHoverGlow {
    0%, 100% {
        box-shadow: 0 12px 28px -8px rgba(124, 58, 237, 0.5);
    }
    50% {
        box-shadow: 0 16px 36px -8px rgba(236, 72, 153, 0.6);
    }
}

@keyframes inputFocus {
    from {
        box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.3);
    }
    to {
        box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
    }
}

@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.4))
                drop-shadow(0 0 16px rgba(236, 72, 153, 0.2));
    }
    50% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 16px rgba(124, 58, 237, 0.8))
                drop-shadow(0 0 28px rgba(236, 72, 153, 0.5));
    }
}

/* ===== AUTH BODY ===== */

.auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
    padding: 20px;
    padding-top: max(20px, calc(20px + env(safe-area-inset-top)));
    padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
}

/* ===== VÍDEO DE FUNDO (LOGIN / REGISTRO) ===== */
/* Coloque o arquivo em assets/video/auth-bg.mp4 — se não existir, o vídeo
   simplesmente não aparece e o fundo animado de sempre continua funcionando. */

.auth-bg-video-wrap {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-bg-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    /* desfoque forte pra deixar o foco no card de login/registro */
    filter: blur(18px) brightness(0.55) saturate(1.1);
    transform-origin: center center;
}

/* leve escurecida por cima do vídeo pra garantir contraste do card,
   sem depender só do blur */
.auth-bg-video-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(8, 6, 15, 0.35) 0%, rgba(8, 6, 15, 0.75) 100%);
}

/* quando existe vídeo, os shapes animados ficam mais discretos por cima dele */
.auth-bg-video-wrap ~ .auth-bg-shape {
    opacity: 0.25;
}

/* o conteúdo (form) precisa ficar acima do vídeo/overlay */
.auth-wrapper {
    position: relative;
    z-index: 2;
}

/* ===== ANIMATED BACKGROUND SHAPES ===== */

.auth-bg-shape {
    position: absolute;
    filter: blur(80px);
    opacity: 0.45;
    will-change: transform;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -100px;
    left: -100px;
    animation: authBgDrift1 25s ease-in-out infinite;
}

.shape-2 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--primary-2) 0%, transparent 70%);
    bottom: -80px;
    right: -80px;
    animation: authBgDrift2 28s ease-in-out infinite;
    animation-delay: 2s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    animation: authBgDrift3 32s ease-in-out infinite;
    animation-delay: 4s;
}

/* ===== AUTH WRAPPER ===== */

.auth-wrapper {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 420px;
    animation: cardSlideIn 0.6s ease-out;
}

/* ===== AUTH CARD ===== */

.auth-card {
    background: linear-gradient(155deg, rgba(26, 20, 40, 0.92) 0%, rgba(20, 16, 31, 0.88) 100%);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 32px;
    padding: 40px 32px;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8),
                0 0 0 1px rgba(139, 92, 246, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(236, 72, 153, 0.8), transparent);
    pointer-events: none;
}

.auth-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 32px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.05));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ===== AUTH LOGO ===== */

.auth-logo {
    text-align: center;
    font-size: 44px;
    font-weight: 800;
    letter-spacing: -1px;
    margin: 0 0 8px;
    font-family: 'Fraunces', 'Instrument Serif', Georgia, serif;
    font-style: italic;
    background: linear-gradient(100deg, #60a5fa 0%, #3b82f6 40%, #22d3ee 70%, #60a5fa 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pulseGlow 3.5s ease-in-out infinite;
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.35));
    will-change: filter, transform;
}

/* ===== AUTH SUBTITLE ===== */

.auth-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 28px;
    animation: fieldSlideIn 0.5s ease-out 0.1s both;
}

/* ===== FORM ===== */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fieldSlideIn 0.5s ease-out both;
}

.field:nth-child(1) {
    animation-delay: 0.15s;
}

.field:nth-child(2) {
    animation-delay: 0.25s;
}

.field:nth-child(3) {
    animation-delay: 0.35s;
}

.field:nth-child(4) {
    animation-delay: 0.45s;
}

.field:nth-child(5) {
    animation-delay: 0.55s;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.field input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: all 0.3s var(--spring);
    backdrop-filter: blur(10px);
    font-family: inherit;
}

.field input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.field input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
    animation: inputFocus 0.4s ease-out;
}

.field input:focus + label,
.field label:has(+ input:focus) {
    color: var(--primary-2);
}

/* ===== BUTTONS ===== */

.btn-primary {
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.3px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.3s var(--spring);
    box-shadow: 0 12px 28px -8px rgba(124, 58, 237, 0.5);
    position: relative;
    overflow: hidden;
    /* Sem animation aqui: quando o hover terminava, a animação reiniciava
       com fill-mode "both" e o botão sumia por 0.65s (bug reportado). */
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.8s var(--ease-out);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px -8px rgba(236, 72, 153, 0.6);
}

.btn-primary:hover::before {
    transform: translateX(100%);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: var(--text);
    border-radius: 14px;
    padding: 14px;
    font-weight: 700;
    margin-top: 12px;
    cursor: pointer;
    transition: all 0.3s var(--spring);
    backdrop-filter: blur(10px);
    font-family: inherit;
    font-size: 15px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-2);
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

.btn-secondary:active {
    transform: scale(0.97);
}

.btn-secondary.full {
    width: 100%;
}

/* ===== AUTH FOOTER ===== */

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
    animation: fieldSlideIn 0.5s ease-out 0.75s both;
}

.auth-footer a {
    color: var(--primary-2);
    font-weight: 700;
    transition: all 0.3s var(--spring);
    text-decoration: none;
}

.auth-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===== ALERTS ===== */

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 18px;
    animation: slideInUp 0.4s ease-out;
    border-left: 4px solid;
}

.alert-error {
    background: rgba(225, 29, 72, 0.12);
    color: #fca5b1;
    border-left-color: #e11d48;
    border: 1px solid rgba(225, 29, 72, 0.35);
    border-left: 4px solid #e11d48;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-left-color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-left: 4px solid #10b981;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE MOBILE ===== */

@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
        border-radius: 28px;
    }

    .auth-logo {
        font-size: 38px;
    }

    .auth-sub {
        font-size: 13px;
        margin-bottom: 24px;
    }

    .auth-form {
        gap: 14px;
    }

    .field input {
        padding: 12px 14px;
        font-size: 14px;
    }

    .btn-primary {
        padding: 14px;
        font-size: 15px;
    }

    .btn-secondary {
        padding: 12px;
        font-size: 14px;
    }

    .shape-1 {
        width: 300px;
        height: 300px;
    }

    .shape-2 {
        width: 250px;
        height: 250px;
    }

    .shape-3 {
        width: 200px;
        height: 200px;
    }
}

/* ===== RESPONSIVE TABLET ===== */

@media (min-width: 768px) and (max-width: 1024px) {
    .auth-card {
        padding: 44px 36px;
    }

    .auth-logo {
        font-size: 48px;
    }

    .auth-wrapper {
        max-width: 450px;
    }
}

/* ===== RESPONSIVE DESKTOP ===== */

@media (min-width: 1025px) {
    .auth-wrapper {
        max-width: 480px;
    }

    .auth-card {
        padding: 48px 40px;
    }

    .auth-logo {
        font-size: 52px;
    }

    .shape-1 {
        width: 500px;
        height: 500px;
    }

    .shape-2 {
        width: 450px;
        height: 450px;
    }

    .shape-3 {
        width: 400px;
        height: 400px;
    }
}

/* ===== REDUCE MOTION ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
