/* ============================================================
 * AvisaAí — style.css
 *
 * Folha de estilo premium, responsiva e mobile-first.
 * Foco em design moderno: Dark Theme, Glassmorphism, Neon glow e
 * animações nativas para melhorar o engajamento visual.
 * ============================================================ */

:root {
    /* Cores do Design System */
    --bg-primary: #0f172a;          /* Slate escuro / Charcoal */
    --bg-secondary: #1e293b;        /* Slate intermediário */
    --text-primary: #f8fafc;        /* Quase branco */
    --text-secondary: #94a3b8;      /* Cinza médio */
    
    /* Acentuações e Efeitos */
    --accent-purple: #8b5cf6;       /* Violeta vibrante */
    --accent-purple-glow: rgba(139, 92, 246, 0.35);
    --accent-emerald: #10b981;      /* Esmeralda / Sucesso */
    --accent-emerald-glow: rgba(16, 185, 129, 0.35);
    --accent-crimson: #ef4444;      /* Erro / Alerta */
    
    /* Cores de Brilho dos Níveis de Gamificação */
    --glow-bronze: rgba(205, 127, 50, 0.4);
    --glow-silver: rgba(192, 192, 192, 0.4);
    --glow-gold: rgba(255, 215, 0, 0.45);

    /* Elementos translúcidos (Glassmorphism) */
    --border-glass: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(30, 41, 59, 0.65);
    --bg-glass-hover: rgba(30, 41, 59, 0.85);
}

/* Reset Geral */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Container Responsivo Mobile-First */
.app-container {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    position: relative;
    padding: 20px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

/* Cabeçalho */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 20px 4px;
    border-bottom: 1px solid var(--border-glass);
}

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

.logo-icon {
    font-size: 1.4rem;
}

.logo-text {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--accent-purple);
}

.header-badge {
    background-color: rgba(139, 92, 246, 0.12);
    border: 1px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-badge.success {
    background-color: rgba(16, 185, 129, 0.12);
    border-color: var(--accent-emerald);
}

/* Main */
.app-main {
    flex: 1;
    padding: 24px 2px;
}

/* Cartão de Localização */
.location-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.location-icon {
    font-size: 1.8rem;
    background: rgba(255, 255, 255, 0.04);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.location-details {
    flex: 1;
}

.location-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.location-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.location-institution {
    font-size: 0.72rem;
    color: var(--accent-purple);
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Banner de Erros */
.alert-error {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: rgba(239, 68, 68, 0.12);
    border: 1px solid var(--accent-crimson);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    animation: shake 0.35s ease-in-out;
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-message {
    font-size: 0.88rem;
    color: #fca5a5;
    font-weight: 500;
}

/* Estilo do Formulário */
.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-section-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.categories-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.category-group {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 16px;
}

.category-header {
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.95;
}

.category-icon {
    font-size: 1.1rem;
}

.problems-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.problem-option-card {
    display: block;
    cursor: pointer;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.problem-option-card:hover {
    background: var(--bg-glass-hover);
    border-color: rgba(255, 255, 255, 0.14);
}

.problem-option-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.problem-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.radio-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid var(--text-secondary);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.problem-option-card input[type="radio"]:checked + .problem-option-content .radio-indicator {
    border-color: var(--accent-purple);
    background-color: rgba(139, 92, 246, 0.1);
}

.problem-option-card input[type="radio"]:checked + .problem-option-content .radio-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--accent-purple);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.problem-option-card.selected {
    background: rgba(139, 92, 246, 0.08);
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--accent-purple-glow);
}

.problem-description-text {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Campos de Input */
.form-field-group {
    margin-bottom: 24px;
}

.field-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.label-optional {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.field-textarea, .field-input {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.25s ease;
}

.field-textarea:focus, .field-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--accent-purple-glow);
    background: var(--bg-glass-hover);
}

/* Switch & Notificação de E-mail */
.notification-optin-box {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 28px;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    width: 42px;
    height: 22px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 22px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.switch-input:checked + .switch-slider {
    background-color: var(--accent-purple);
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(20px);
    background-color: var(--text-primary);
}

.switch-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Collapsible Animado */
.email-input-wrapper {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.email-input-wrapper.visible {
    max-height: 130px;
    opacity: 1;
    margin-top: 16px;
}

.field-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Botões */
.form-submit-container {
    margin-top: 24px;
}

.btn-submit, .btn-primary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    padding: 16px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px var(--accent-purple-glow);
}

.btn-submit:hover, .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
    transform: translateY(-2px);
}

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

.btn-submit:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 16px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

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

.btn-secondary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    padding: 16px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

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

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.85s infinite linear;
}

/* Tela de Agradecimento (Obrigado) */
.thankyou-container {
    text-align: center;
    padding: 20px 8px 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.success-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.success-icon-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    filter: blur(15px);
    opacity: 0.35;
    animation: pulse 2s infinite ease-in-out;
}

.success-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid var(--accent-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thankyou-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.thankyou-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-bottom: 28px;
    max-width: 320px;
}

/* Gamificação */
.gamification-card {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px 20px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gamification-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    opacity: 0.8;
}

.gamification-badge-area {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.badge-icon {
    font-size: 3rem;
    z-index: 2;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    margin-bottom: 12px;
    animation: float 4s ease-in-out infinite;
}

.badge-glowing-back {
    position: absolute;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.25;
    z-index: 1;
    top: 5px;
}

.glow-bronze { background-color: #cd7f32; }
.glow-silver { background-color: #c0c0c0; }
.glow-gold { background-color: #ffd700; }

.badge-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.badge-rank-label {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.badge-count-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.badge-count-label strong {
    color: var(--text-primary);
}

/* Progresso do Nível */
.badge-progress-container {
    width: 100%;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    margin-bottom: 16px;
    overflow: hidden;
}

.badge-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), #a855f7);
    border-radius: 3px;
    transition: width 1.2s cubic-bezier(0.1, 1, 0.1, 1);
}

.gamification-feedback {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.thankyou-actions {
    width: 100%;
}

.or-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 12px;
    opacity: 0.75;
}

/* Rodapé */
.app-footer {
    text-align: center;
    padding: 20px 0 8px 0;
    border-top: 1px solid var(--border-glass);
    margin-top: auto;
    opacity: 0.7;
}

.app-footer p {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Animações Auxiliares */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.35; }
    50% { transform: scale(1.08); opacity: 0.45; }
}

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

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

/* Animação do SVG Checkmark */
.checkmark {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
    stroke-width: 2.5;
    stroke: var(--accent-emerald);
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px var(--accent-emerald);
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s alternate both;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2.5;
    stroke-miterlimit: 10;
    stroke: var(--accent-emerald);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.55s forwards;
}

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

@keyframes fill {
    100% { box-shadow: inset 0px 0px 0px 30px rgba(16, 185, 129, 0.02); }
}

/* Estado Vazio */
.empty-state {
    text-align: center;
    padding: 30px 15px;
    border: 1px dashed var(--border-glass);
    border-radius: 16px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}
