/* Premium Authentication Pages CSS */
:root {
    /* Cores Premium */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --danger-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Cores Base */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-glass: rgba(255, 255, 255, 0.05);
    
    /* Texto */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-accent: #667eea;
    
    /* Bordas e Sombras */
    --border-radius: 16px;
    --border-radius-lg: 24px;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);
    
    /* Transições */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Background Animado */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.2) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Header Premium */
.header {
    background: rgba(22, 33, 62, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition-smooth);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 45px;
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
    transition: var(--transition-smooth);
}

.logo img:hover {
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.8));
    transform: scale(1.05);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: var(--transition-smooth);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

/* Container Principal */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* Header da Página */
.page-header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp 0.8s ease-out;
}

.page-header img {
    height: 80px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Card de Autenticação */
.auth-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.8s ease-out 0.2s both;
    z-index: 5;
    /* Fallback para dispositivos que não suportam backdrop-filter */
    background-color: rgba(22, 33, 62, 0.95);
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--primary-gradient);
}

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

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

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

/* Formulário */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 10;
}

.form-group {
    position: relative;
    z-index: 10;
}

.form-input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-smooth);
    outline: none;
    position: relative;
    z-index: 10;
    /* Melhorias para mobile */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Previne zoom automático no iOS */
    font-size: max(1rem, 16px);
}

.form-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 0.08);
    /* Força o foco em mobile */
    z-index: 20;
}

.form-input:active {
    z-index: 20;
}

.form-input::placeholder {
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.form-input:focus::placeholder {
    opacity: 0.7;
    transform: translateY(-2px);
}

/* Botão Premium */
.btn-primary {
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--border-radius);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

/* Links */
.auth-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
    text-align: center;
}

.auth-link {
    color: var(--text-accent);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
    padding: 0.5rem;
    border-radius: var(--border-radius);
}

.auth-link:hover {
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

/* Mensagens de Erro */
.error-message {
    background: rgba(250, 112, 154, 0.1);
    border: 1px solid rgba(250, 112, 154, 0.3);
    color: #ff6b9d;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 500;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Mensagens de Sucesso */
.success-message {
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.3);
    color: #43e97b;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 500;
    animation: fadeInUp 0.5s ease-out;
}

/* Notificações */
.notification-container {
    position: fixed;
    top: 100px;
    right: 2rem;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.notification {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.5s ease-out;
    max-width: 350px;
    position: relative;
    overflow: hidden;
}

.notification::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--success-gradient);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Campo Honeypot (invisível) */
.honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* Responsividade */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .auth-container {
        padding: 1rem;
        /* Garante que o container não interfira com os inputs */
        position: relative;
        z-index: 1;
    }
    
    .auth-card {
        padding: 2rem;
        margin-top: 2rem;
        /* Melhora a interação em mobile */
        z-index: 5;
        /* Remove backdrop-filter em mobile para melhor performance */
        backdrop-filter: none;
        background-color: rgba(22, 33, 62, 0.98);
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .page-header img {
        height: 60px;
    }
    
    .notification-container {
        right: 1rem;
        left: 1rem;
        /* Reduz z-index para não interferir com inputs */
        z-index: 2;
    }
    
    .notification {
        max-width: none;
    }
    
    /* Melhorias específicas para inputs em mobile */
    .form-input {
        min-height: 48px;
        padding: 0.75rem 1rem;
        /* Garante que o input seja clicável */
        position: relative;
        z-index: 15;
        /* Remove backdrop-filter dos inputs em mobile */
        backdrop-filter: none;
        background-color: rgba(255, 255, 255, 0.08);
    }
    
    .form-input:focus,
    .form-input:active {
        z-index: 25;
        background-color: rgba(255, 255, 255, 0.12);
        /* Força o foco visual */
        border-color: rgba(102, 126, 234, 0.8);
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
    }
    
    /* Melhora a área de toque dos botões */
    .btn-primary {
        min-height: 48px;
        padding: 1rem 2rem;
        position: relative;
        z-index: 15;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .auth-card {
        padding: 1.5rem;
        /* Força background sólido em telas muito pequenas */
        background-color: rgba(22, 33, 62, 1);
        backdrop-filter: none;
    }
    
    .page-header {
        margin-bottom: 2rem;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    /* Melhorias adicionais para telas muito pequenas */
    .form-input {
        font-size: 16px !important; /* Previne zoom no iOS */
        min-height: 50px;
        padding: 1rem;
        background-color: rgba(255, 255, 255, 0.1);
        border: 2px solid rgba(255, 255, 255, 0.2);
    }
    
    .form-input:focus,
    .form-input:active {
        background-color: rgba(255, 255, 255, 0.15);
        border-color: rgba(102, 126, 234, 1);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4);
    }
    
    .btn-primary {
        min-height: 50px;
        font-size: 1.1rem;
        font-weight: 700;
    }
}

/* Menu Mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition-smooth);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .nav-menu.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

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

/* Estados de Loading */
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Melhorias específicas para dispositivos touch */
@media (hover: none) and (pointer: coarse) {
    /* Dispositivos touch apenas */
    .form-input {
        /* Força área de toque maior */
        min-height: 52px;
        padding: 1rem 1.5rem;
        /* Remove efeitos que podem interferir */
        backdrop-filter: none !important;
        /* Melhora a visibilidade */
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        /* Garante que seja clicável */
        position: relative;
        z-index: 100;
        /* Remove transições que podem causar lag */
        transition: none;
    }
    
    .form-input:focus,
    .form-input:active,
    .form-input:target {
        background-color: rgba(255, 255, 255, 0.2) !important;
        border-color: rgba(102, 126, 234, 1) !important;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.5) !important;
        z-index: 200;
        outline: none;
    }
    
    .btn-primary {
        min-height: 52px;
        /* Remove hover effects em touch */
        transform: none !important;
    }
    
    .btn-primary:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease;
    }
    
    /* Remove backdrop-filter de todos os elementos em dispositivos touch */
    .auth-card {
        backdrop-filter: none !important;
        background-color: rgba(22, 33, 62, 0.98) !important;
    }
    
    /* Garante que notificações não interfiram */
    .notification-container {
        z-index: 1 !important;
        pointer-events: none;
    }
    
    .notification {
        pointer-events: auto;
    }
}

/* Correções específicas para iOS */
@supports (-webkit-touch-callout: none) {
    .form-input {
        /* Previne zoom automático no iOS */
        font-size: 16px !important;
        /* Remove aparência padrão do iOS */
        -webkit-appearance: none;
        -webkit-border-radius: var(--border-radius);
        /* Melhora a responsividade */
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.3);
    }
    
    .form-input:focus {
        /* Força o foco no iOS */
        -webkit-user-select: text;
        user-select: text;
    }
}

/* Correções para Android */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .form-input {
        /* Melhora a renderização no Android */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}