/* Reset e Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0f;
    position: relative;
    overflow-x: hidden;
}

/* Background com gradiente animado */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 120%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse 50% 30% at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Container Principal */
.login-container {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    position: relative;
    z-index: 1;
}

/* Box de Login */
.login-box {
    background: linear-gradient(145deg, rgba(20, 20, 30, 0.9) 0%, rgba(15, 15, 22, 0.95) 100%);
    border-radius: 20px;
    padding: 32px 32px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 24px 48px rgba(0, 0, 0, 0.3),
        0 48px 80px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Logo */
.logo {
    text-align: center;
    margin-bottom: 8px;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    box-shadow: 
        0 8px 32px rgba(99, 102, 241, 0.35),
        0 4px 12px rgba(99, 102, 241, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.logo-icon:hover {
    transform: rotate(0deg) scale(1.02);
}

.logo-icon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.logo-icon:hover::before {
    opacity: 1;
}

.logo-icon i {
    font-size: 24px;
    color: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo h1 {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.logo h1 span {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Subtítulo */
.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 24px;
    letter-spacing: 0.2px;
}

/* Grupos de Input */
.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

/* Wrapper do Input */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.input-wrapper input {
    width: 100%;
    height: 44px;
    padding: 0 44px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    font-weight: 400;
    transition: all 0.25s ease;
    outline: none;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.25);
    font-weight: 400;
}

.input-wrapper input:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.input-wrapper input:focus {
    border-color: rgba(99, 102, 241, 0.6);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 
        0 0 0 4px rgba(99, 102, 241, 0.12),
        0 0 20px rgba(99, 102, 241, 0.08);
}

.input-wrapper:has(input:focus) .input-icon {
    color: #6366f1;
}

/* Botão de Toggle Senha */
.toggle-password {
    position: absolute;
    right: 4px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.25s ease;
    z-index: 2;
}

.toggle-password:hover {
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-password:active {
    transform: scale(0.95);
}

/* Mensagem de Erro */
.error-message {
    display: block;
    min-height: 16px;
    padding-top: 4px;
    color: #f87171;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Opções (Lembrar-me e Esqueceu senha) */
.options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Checkbox Customizado */
.remember-me {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    transition: color 0.25s ease;
}

.remember-me:hover {
    color: rgba(255, 255, 255, 0.75);
}

.remember-me input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    position: relative;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.remember-me:hover .checkmark {
    border-color: rgba(99, 102, 241, 0.5);
}

.remember-me input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s ease;
}

.remember-me input[type="checkbox"]:checked + .checkmark::after {
    transform: rotate(45deg) scale(1);
}

/* Link Esqueceu Senha */
.forgot-password {
    color: rgba(99, 102, 241, 0.9);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s ease;
}

.forgot-password:hover {
    color: #818cf8;
}

/* Botão de Login */
.btn-login {
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    background-size: 200% 200%;
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(99, 102, 241, 0.3),
        0 8px 32px rgba(139, 92, 246, 0.2);
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.5s ease;
}

.btn-login:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(99, 102, 241, 0.4),
        0 16px 48px rgba(139, 92, 246, 0.25);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.btn-login:hover i {
    transform: translateX(4px);
}

/* Loading State */
.btn-login.loading {
    pointer-events: none;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.btn-login.loading span,
.btn-login.loading i {
    visibility: hidden;
}

.btn-login.loading::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinner 0.7s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.divider span {
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Link de Registro */
.register-link {
    text-align: center;
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    font-weight: 400;
}

.register-link a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
    position: relative;
}

.register-link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: #818cf8;
    transition: width 0.25s ease;
}

.register-link a:hover {
    color: #a5b4fc;
}

.register-link a:hover::after {
    width: 100%;
}

/* Elementos Decorativos */
.decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}

.glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -150px;
    animation: float1 8s ease-in-out infinite;
}

.glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: float2 10s ease-in-out infinite;
}

.glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
    top: 40%;
    left: 60%;
    animation: float3 12s ease-in-out infinite;
}

/* Grid de pontos decorativos */
.grid-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.5;
}

@keyframes float1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(-30px, 30px) scale(1.05);
    }
}

@keyframes float2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, -20px) scale(1.03);
    }
}

@keyframes float3 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
        opacity: 0.3;
    }
}

/* Input com erro */
.input-wrapper.error input {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(248, 113, 113, 0.05);
}

.input-wrapper.error .input-icon {
    color: #f87171;
}

/* Responsividade */
@media (max-width: 480px) {
    .login-container {
        padding: 16px;
    }
    
    .login-box {
        padding: 24px 20px;
        border-radius: 16px;
    }
    
    .logo h1 {
        font-size: 24px;
    }
    
    .logo-icon {
        width: 48px;
        height: 48px;
    }
    
    .logo-icon i {
        font-size: 20px;
    }
    
    .options {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .input-wrapper input {
        height: 42px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .btn-login {
        height: 42px;
    }
}

@media (max-width: 360px) {
    .login-box {
        padding: 20px 16px;
    }
}

/* Suporte para preferência de movimento reduzido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para acessibilidade */
.btn-login:focus-visible,
.toggle-password:focus-visible,
.forgot-password:focus-visible,
.register-link a:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.input-wrapper input:focus-visible {
    outline: none;
}
