/* ==========================================================================
   Design System & Variáveis de Cores Premium (Modo Escuro Sofisticado)
   ========================================================================== */
:root {
    --bg-primary: #06070a;
    --bg-card: rgba(12, 14, 22, 0.75);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Cores de Acento & Gradientes */
    --color-primary: #6366f1; /* Indigo */
    --color-primary-glow: rgba(99, 102, 241, 0.2);
    --color-secondary: #a855f7; /* Violeta */
    --color-success: #10b981; /* Esmeralda */
    --color-success-glow: rgba(16, 185, 129, 0.2);
    --color-danger: #f43f5e; /* Rose */
    --color-danger-glow: rgba(244, 63, 94, 0.2);
    
    /* Cores de Texto */
    --text-main: #f3f4f6; /* Cinza Muito Claro */
    --text-muted: #9ca3af; /* Cinza Médio */
    --text-label: #cbd5e1; /* Cinza Claro para labels */
    
    /* Fontes */
    --font-heading: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Efeitos */
    --glass-blur: 20px;
    --shadow-premium: 0 30px 60px rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Fundo Animado (Mesh Gradient)
   ========================================================================== */
.bg-gradient-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, #0d0f1a, #040507);
}

.mesh-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.3;
    mix-blend-mode: screen;
    animation: drift 28s infinite ease-in-out alternate;
}

.orb-1 {
    top: -15%;
    left: -10%;
    width: 55vw;
    height: 55vw;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
}

.orb-2 {
    bottom: -20%;
    right: -10%;
    width: 65vw;
    height: 65vw;
    background: radial-gradient(circle, var(--color-secondary) 0%, transparent 70%);
    animation-delay: -6s;
}

.orb-3 {
    top: 35%;
    left: 55%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
    animation-delay: -12s;
    opacity: 0.15;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    50% {
        transform: translate(6%, 8%) scale(1.1) rotate(180deg);
    }
    100% {
        transform: translate(-4%, -6%) scale(0.95) rotate(360deg);
    }
}

/* ==========================================================================
   Layout Principal da Aplicação
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 660px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Cartão Glassmorphism */
.glass-card {
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 56px;
    box-shadow: var(--shadow-premium);
    position: relative;
    overflow: hidden;
    transition: min-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Brilho Superior Sutil no Cartão */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
}

/* ==========================================================================
   Cabeçalho do Cartão
   ========================================================================== */
.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 6px 16px;
    border-radius: 99px;
    color: #818cf8;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.badge-icon {
    width: 15px;
    height: 15px;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 60%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.welcome-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 480px;
    margin: 0 auto;
}

/* ==========================================================================
   Progresso Conversacional (Barra minimalista superior)
   ========================================================================== */
.conversational-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 36px;
    user-select: none;
}

.progress-bar-minimal {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill-minimal {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-counter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.step-counter-label strong {
    color: var(--color-primary);
}

/* ==========================================================================
   Etapas Conversacionais (Uma Pergunta por Vez)
   ========================================================================== */
.form-step-conversational {
    display: none;
    flex-direction: column;
    gap: 24px;
}

/* Exibe a etapa ativa com transição vertical premium */
.form-step-conversational.active {
    display: flex;
    animation: slideUpIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpIn {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Estrutura de Títulos e Textos da Pergunta */
.question-header {
    margin-bottom: 4px;
}

.question-header h2 {
    font-family: var(--font-heading);
    font-size: 1.55rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.015em;
    line-height: 1.35;
    margin-bottom: 8px;
}

.question-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ==========================================================================
   Controles de Input Grandes (Estilo Typeform)
   ========================================================================== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    width: 100%;
}

.input-wrapper-large {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-wrapper-large input,
.input-wrapper-large select {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 20px;
    padding-left: 54px; /* Espaço maior para o ícone */
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 1.12rem;
    font-weight: 500;
    transition: var(--transition-smooth);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Remoção de padding esquerdo para campo de Select que não possui ícone direto */
#step-9 .input-wrapper-large select {
    padding-left: 20px;
}

.input-wrapper-large select {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 18px;
}

/* Estilo do Ícone */
.input-wrapper-large .input-icon {
    position: absolute;
    left: 18px;
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

/* Efeito de carregamento / Spinner do CEP */
.spinner {
    display: none;
    position: absolute;
    right: 20px;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 0.8s linear infinite;
}

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

/* Estado de Foco nos Inputs */
.input-wrapper-large input:focus,
.input-wrapper-large select:focus {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px var(--color-primary-glow), inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.input-wrapper-large input:focus + .input-icon {
    color: var(--color-primary);
}

/* ==========================================================================
   Validações e Animação de Shake para Erros
   ========================================================================== */
.form-group.invalid .input-wrapper-large input,
.form-group.invalid .input-wrapper-large select {
    border-color: var(--color-danger);
    background: rgba(244, 63, 94, 0.04);
    box-shadow: 0 0 0 4px var(--color-danger-glow);
}

.form-group.invalid .input-icon {
    color: var(--color-danger);
}

.error-msg {
    font-size: 0.82rem;
    font-weight: 500;
    color: #f43f5e;
    opacity: 0;
    transform: translateY(-6px);
    transition: var(--transition-fast);
    pointer-events: none;
    margin-top: 4px;
}

.form-group.invalid .error-msg {
    opacity: 1;
    transform: translateY(0);
}

/* Animação Vibratória (Shake) */
.shake-element {
    animation: shake 0.55s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-8px); }
    30%, 60%, 90% { transform: translateX(8px); }
}

/* ==========================================================================
   Botões e Controles Conversacionais
   ========================================================================== */
.form-actions-conversational {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 28px;
    border-radius: 14px;
    font-family: var(--font-heading);
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
    position: relative;
    user-select: none;
}

.btn-icon-right {
    width: 18px;
    height: 18px;
    transition: var(--transition-fast);
}

/* Botão Avançar / Primário */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.35);
    filter: brightness(1.1);
}

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

.btn-primary:hover .btn-icon-right {
    transform: translateX(4px);
}

/* Botão Voltar / Secundário */
.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Botão Sucesso (Finalizar) */
.btn-success {
    background: linear-gradient(135deg, var(--color-success), #059669);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.35);
    filter: brightness(1.1);
}

/* Atalho de Teclado Visual */
.keyboard-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: 4px;
    animation: pulseHint 2.5s infinite ease-in-out;
}

.keyboard-hint strong {
    color: var(--text-label);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 3px 6px;
    border-radius: 6px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.75rem;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

@keyframes pulseHint {
    0%, 100% { opacity: 0.65; }
    50% { opacity: 0.95; }
}

/* ==========================================================================
   Etapa 10: Tela de Revisão dos Dados
   ========================================================================== */
.review-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: left;
}

.review-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.review-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.review-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.review-item.span-full {
    grid-column: span 2;
}

.review-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.review-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
    word-break: break-all;
}

.review-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    width: 100%;
}

.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
}

/* ==========================================================================
   Tela de Sucesso Final
   ========================================================================== */
.success-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 16px 0;
}

.success-container h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
}

.success-message {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 480px;
}

.success-message strong {
    color: #ffffff;
}

/* Cartão informativo no sucesso */
.info-card-success {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
    max-width: 520px;
    margin-top: 10px;
}

.info-icon {
    width: 22px;
    height: 22px;
    color: var(--color-success);
    flex-shrink: 0;
    margin-top: 2px;
}

.info-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.info-desc {
    font-size: 0.85rem;
    color: var(--text-label);
    line-height: 1.55;
}

.success-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Animação do Checkmark */
.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #ffffff;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--color-success);
    animation: fillSuccess .4s ease-in-out .4s forwards, scaleSuccess .3s ease-in-out .9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke: var(--color-success);
    fill: none;
    animation: strokeSuccess .6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: strokeSuccess .3s cubic-bezier(0.65, 0, 0.45, 1) .8s forwards;
}

@keyframes strokeSuccess {
    100% { stroke-dashoffset: 0; }
}

@keyframes fillSuccess {
    100% { box-shadow: inset 0px 0px 0px 40px var(--color-success); }
}

@keyframes scaleSuccess {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

/* ==========================================================================
   Rodapé Corporativo
   ========================================================================== */
.app-footer {
    margin-top: 36px;
    text-align: center;
    color: rgba(255, 255, 255, 0.22);
    font-size: 0.75rem;
    max-width: 480px;
    line-height: 1.5;
}

/* ==========================================================================
   Responsividade Avançada
   ========================================================================== */
@media (max-width: 640px) {
    .glass-card {
        padding: 36px 20px;
        border-radius: 24px;
    }
    
    .welcome-title {
        font-size: 1.75rem;
    }
    
    .question-header h2 {
        font-size: 1.35rem;
    }
    
    .input-wrapper-large input,
    .input-wrapper-large select {
        padding: 14px 16px;
        padding-left: 48px;
        font-size: 1rem;
    }
    
    #step-9 .input-wrapper-large select {
        padding-left: 16px;
    }
    
    .input-wrapper-large .input-icon {
        left: 16px;
        width: 18px;
        height: 18px;
    }
    
    .form-actions-conversational {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .form-actions-conversational .btn-advance,
    .form-actions-conversational .btn-back {
        width: 100%;
    }
    
    .keyboard-hint {
        display: none; /* Oculta a dica de enter em celulares */
    }
    
    .review-card {
        padding: 20px;
    }
    
    .review-grid {
        grid-template-columns: 1fr;
    }
    
    .review-item.span-full {
        grid-column: span 1;
    }
    
    .info-card-success {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
