/* ========== 1. VARIÁVEIS E CONFIGURAÇÕES GLOBAIS ========== */
:root { 
    --header-h: 96px; 
    --primary-purple: #a855f7;
    --primary-yellow: #fbbf24;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* ========== 2. RESET E ESTILOS BASE ========== */
html { 
    scroll-behavior: smooth; 
    scroll-padding-top: var(--header-h); 
}

html.__preload body { 
    visibility: hidden; 
}

body { 
    font-family: 'Poppins', sans-serif; 
    scroll-behavior: smooth;
    box-sizing: border-box;
}

section[id] { 
    scroll-margin-top: var(--header-h); 
}

/* ========== 3. COMPONENTES REUTILIZÁVEIS ========== */

/* === Efeitos Visuais === */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
}

.glass-light {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(168, 85, 247, 0.08);
}

.gradient-text {
    background: linear-gradient(135deg, #a855f7, #c084fc, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mesh-gradient {
    background: radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(251, 191, 36, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(192, 132, 252, 0.1) 0%, transparent 50%);
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* === Botões e Interações === */
.magnetic-button {
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
}

.magnetic-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(168, 85, 247, 0.45);
}

/* === Cards e Elementos 3D === */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.card-3d:hover {
    transform: rotateY(5deg) rotateX(5deg) translateZ(20px);
}

/* === Elementos Flutuantes === */
.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    animation: float 8s ease-in-out infinite;
    transition: transform 0.1s ease-out;
    will-change: transform;
    opacity: 0.08;
}

.floating-orb:nth-child(1) { animation-delay: 0s; }
.floating-orb:nth-child(2) { animation-delay: 2s; }
.floating-orb:nth-child(3) { animation-delay: 4s; }

.parallax-orb-1,
.parallax-orb-2,
.parallax-orb-3 {
    transform-origin: center;
}

/* === Scrollbar Customizado === */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 3px;
}

/* ========== 4. ANIMAÇÕES E TRANSITIONS ========== */

/* === Keyframes Principais === */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

@keyframes glow {
    0% { box-shadow: 0 0 20px rgba(168, 85, 247, 0.3); }
    100% { box-shadow: 0 0 40px rgba(168, 85, 247, 0.6); }
}

@keyframes slideUp {
    0% { transform: translateY(100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes gentlePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* === Classes de Animação === */
.animate-glow { animation: glow 2s ease-in-out infinite alternate; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-slide-up { animation: slideUp 0.8s ease-out; }
.animate-fade-in { animation: fadeIn 1s ease-out; }

.loading-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.shake-animation {
    animation: shake 0.3s ease-in-out;
}

/* === Transitions de Entrada === */
.stagger-animation {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-animation.animate {
    opacity: 1;
    transform: translateY(0);
}

.fade-slide-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-slide-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.scale-fade-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.scale-fade-in.visible {
    opacity: 1;
    transform: scale(1);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.rotate-fade-in {
    opacity: 0;
    transform: rotate(-5deg) scale(0.95);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.rotate-fade-in.visible {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* === Transitions de Seção === */
.section-transition {
    position: relative;
    overflow: hidden;
}

.section-transition::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(168, 85, 247, 0.1), transparent);
    transition: left 1.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.section-transition.loading::before {
    left: 100%;
}

/* ========== 5. LAYOUT E SISTEMA DE GRID ========== */
.cv-auto { 
    content-visibility: auto; 
    contain-intrinsic-size: 800px; 
}

footer .footer-stack > * + * { 
    margin-top: 1.5rem; 
}

/* ========== 6. FORMULÁRIOS E INTERATIVIDADE ========== */

/* === Diagnóstico Modal === */
.question-step { display: none; }
.question-step.active { display: block; }

#diag-preview {
    transition: all 0.3s ease-in-out;
    border: 2px solid #e9d5ff;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

#diag-preview.updated {
    border-color: #8b5cf6;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
    animation: gentlePulse 0.6s ease-in-out;
}

#preview-perfil {
    font-weight: 700;
    color: #7c3aed;
    font-size: 1.15em;
    margin-bottom: 4px;
}

#preview-potencial {
    color: #059669;
    font-weight: 600;
    font-size: 0.95em;
}

#preview-acao {
    background: #ffffff;
    border: 1px solid #d8b4fe;
    border-radius: 10px;
    padding: 14px;
    margin-top: 10px;
    color: #7c3aed;
    font-style: normal;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.08);
}

/* === Radio Buttons Customizados === */
label input[type="radio"] + .radio-custom > div { 
    opacity: 0; 
    transform: scale(0.8); 
    transition: opacity .2s, transform .2s; 
}

label input[type="radio"]:checked + .radio-custom > div { 
    opacity: 1; 
    transform: scale(1); 
}

label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-purple);
    background-color: rgba(168, 85, 247, 0.05);
}

label input[type="radio"]:focus-visible + .radio-custom { 
    outline: 2px solid var(--primary-purple); 
    outline-offset: 3px; 
    border-radius: 9999px; 
}

/* === Modal Scroll === */
#diagnostic-modal .max-h-\[90vh\] {
    scroll-behavior: smooth;
    scroll-padding-top: 20px;
}

.question-step.active h3 {
    position: relative;
}

.question-step.active h3::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #a855f7, #c084fc);
    border-radius: 2px;
}

/* Feedback visual para campos do formulário */
input:valid {
  border-color: #10b981;
}

input:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}

/* Loading states mais claros */
button[aria-busy="true"] {
  position: relative;
  color: transparent;
}

button[aria-busy="true"]::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* ========== 7. ACESSIBILIDADE ========== */

/* === Focus Management === */
:focus-visible { 
    outline: 2px solid var(--primary-purple); 
    outline-offset: 3px; 
    border-radius: 8px; 
}

a[aria-current="page"], 
nav a:focus-visible { 
    text-decoration: underline; 
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { 
        animation-duration: .001ms !important; 
        animation-iteration-count: 1 !important; 
        transition-duration: .001ms !important; 
    }
}

/* === High Contrast Mode === */
@media (prefers-contrast: more) {
    .gradient-text { 
        -webkit-text-fill-color: currentColor; 
        color: #581c87; 
    }
    
    .text-yellow-400 { 
        color: #b45309; 
    }
    
    .text-slate-100 {
        color: #ffffff !important;
    }
    
    .text-slate-300 {
        color: #e2e8f0 !important;
    }
}

@media (prefers-contrast: high) {
    .text-slate-300 {
        color: #f8fafc !important;
    }
    
    .text-slate-400 {
        color: #e2e8f0 !important;
    }
    
    .bg-slate-950 {
        background-color: #000000 !important;
    }
}

/* === Elementos Decorativos (screen readers) === */
.floating-orb svg, 
.floating-orb { 
    pointer-events: none; 
}

svg[aria-hidden="true"] { 
    outline: 0; 
}

/* ========== 8. RESPONSIVO ========== */

/* === Mobile First Adjustments === */
.text-slate-100 {
    color: #f8fafc;
}

.text-slate-600 {
    color: #475569 !important;
}

.text-slate-700 {
    color: #334155 !important;
}

/* === Tablet e Mobile === */
@media (max-width: 768px) {
    .flex-col.gap-4 {
        gap: 1.5rem;
    }
    
    .magnetic-button { 
        padding: 1rem 1.5rem !important;
        min-height: 54px;
        font-size: 1.1rem;
    }
    
    /* Aumentar área de toque para links importantes */
    nav a {
        padding: 12px 8px;
        margin: -12px -8px;
    }

@media (max-width: 640px) {
    .text-4xl { font-size: 2rem; }
    .text-5xl { font-size: 2.5rem; }
    .text-6xl { font-size: 3rem; }
    
    /* Melhorar área de toque */
    .magnetic-button {
        min-height: 54px;
        padding: 1rem 1.5rem !important;
    }
    
    /* Ajustar modais para mobile */
    #diagnostic-modal .max-w-2xl {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}