@import url('base_reset.css');

/* 
   GESTIN - STYLE.CSS (Legacy Scoped)
   Estes estilos agora estão isolados sob a classe .gestin-legacy-scope
   para evitar conflitos com novos componentes "limpos".
*/


/* --- Scoping Legacy Tags --- */
.gestin-legacy-scope {
    font-family: var(--font-main);
    background-color: var(--color-bg-dark);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.gestin-legacy-scope a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

.gestin-legacy-scope ul {
    list-style: none;
}

.gestin-legacy-scope img,
.gestin-legacy-scope picture,
.gestin-legacy-scope video,
.gestin-legacy-scope canvas,
.gestin-legacy-scope svg {
    max-width: 100%;
    display: block;
    height: auto;
}

/* --- 2. Utilitários & Botões --- */
.container {
    width: 100%;
    max-width: var(--max-width-container);
    margin-inline: auto;
    /* Centra automaticamente */
    padding-inline: var(--screen-padding);
    /* Nunca encosta na moldura do telemóvel */
    /* Proteção Suprema: Garante que os floats e absolute elements internos não quebram o layout web */
    /* UPDATE: removido overflow-x: hidden do container porque quebrava popups de dropdown ou modais q precisem de saltar fora.
       Vamos aplicar overflow-x nas SECCÕES específicas invés disso */
}

/* Utilitário para centrar Login/Registo */
.center-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.75rem;
    border-radius: 50px;
    /* Pill shape for modern look */
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
    /* Dark text on bright button */
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 230, 118, 0.4);
}

.btn-outline {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: transparent;
}

.btn-outline:hover {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.btn-white {
    background-color: var(--color-surface);
    color: var(--color-white);
    border: 1px solid var(--color-surface-border);
    backdrop-filter: blur(10px);
}

.btn-white:hover {
    background-color: var(--color-surface-hover);
    border-color: var(--color-accent);
}

/* Largura total (útil para formulários) */
.w-100 {
    width: 100%;
}

.hero-text h1 {
    letter-spacing: -0.02em;
}

.highlight {
    color: var(--color-accent);
    position: relative;
    display: inline-block;
    z-index: 1;
}

.highlight::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    height: 30%;
    background-color: rgba(0, 230, 118, 0.2);
    z-index: -1;
    transform: skewX(-15deg);
}

.text-danger {
    color: var(--color-danger);
}

.text-success {
    color: var(--color-accent);
}

/* --- 3. Header --- */
/* --- Header: Transparent → Glassmorphism on scroll --- */
.header {
    background: transparent;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
    border-bottom: 1px solid transparent;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header--scrolled {
    background: rgba(1, 8, 6, 0.75);
    /* Darker background with opacity */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--color-surface-border);
    padding: 1rem 0;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 35px;
    /* Slightly smaller to match mockup */
    filter: brightness(0) invert(1);
    /* Ensure logo is white on dark background */
}

.nav-list {
    display: none;
    gap: 2.5rem;
    /* Increased spacing to match mockup */
    align-items: center;
}

/* Micro-interação: Sublinhado expansivo nos Links */
.nav-list>li>a:not(.btn) {
    position: relative;
    padding-bottom: 4px;
}

.nav-list>li>a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 2px;
}

.nav-list>li>a:not(.btn):hover::after {
    transform: translateX(-50%) scaleX(1);
}

/* Dropdown de Idiomas Customizado */
.header .lang-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text);
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.25s ease;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    backdrop-filter: blur(5px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%239CA3AF'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
}

.header .lang-select:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.header .lang-select option {
    background-color: var(--color-bg-dark);
    color: var(--color-text);
}

/* Mobile Toggle */
.mobile-toggle {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-primary);
    cursor: pointer;
    margin-left: auto;
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(1, 8, 6, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--color-surface-border);
        transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 999;
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-list {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
}

/* --- 4. Hero Section --- */
.hero {
    padding-top: calc(var(--space-lg) + 80px);
    /* Previne sobreposição com a fixed navbar */
    padding-bottom: var(--space-lg);
    overflow: hidden;
}

.hero-grid {
    display: grid;
    /* MOBILE PRIMEIRO: Forçamos a ter 1 ÚNICA COLUNA em telemóveis */
    grid-template-columns: 1fr;
    gap: var(--space-md);
    align-items: center;
    text-align: center;
    /* Centrar texto no mobile */
}

/* Center CTA buttons on mobile */
.hero-text .cta-group {
    justify-content: center;
}

@media (min-width: 992px) {
    .hero-grid {
        /* Quebra Elegante: 5 Frações para Texto, 7 Frações para o Mockup */
        grid-template-columns: 5fr 7fr;
        text-align: left;
        /* Restaura alinhamento à esquerda no Desktop */
    }

    .hero-text .cta-group {
        justify-content: flex-start;
    }
}

.hero-text h1 {
    font-size: clamp(2rem, 4vw + 1rem, 3.5rem);
    line-height: 1.1;
    color: var(--color-white);
    margin-bottom: 1.5rem;
    font-weight: 800;
}

.hero-text p {
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem);
    color: var(--color-text-light);
    max-width: 70ch;
    margin-bottom: var(--space-sm);
}

.cta-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

/* Hero Visual (CSS Mockup) */
.hero-visual {
    position: relative;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mockup-card {
    background: var(--color-white);
    width: 100%;
    max-width: 280px;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow);
    z-index: 2;
    border: 1px solid #eee;
}

.mockup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: #ccc;
}

.avatar {
    width: 30px;
    height: 30px;
    background: #D1FAE5;
    border-radius: 50%;
}

.mockup-balance span {
    font-size: 0.8rem;
    color: var(--color-text-light);
    text-transform: uppercase;
}

.balance-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text);
}

.mockup-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 80px;
    margin-top: 1.5rem;
}

.bar {
    flex: 1;
    background: #E5E7EB;
    border-radius: 4px;
}

.bar.active {
    background: var(--color-accent);
}

.h-40 {
    height: 40%;
}

.h-80 {
    height: 80%;
}

.h-50 {
    height: 50%;
}

.h-60 {
    height: 60%;
}

/* Floaters */
.floater {
    position: absolute;
    background: var(--color-white);
    padding: 0.8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 3;
    animation: float 5s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
    will-change: transform;
}

.floater.f-left {
    top: 10%;
    left: 0;
}

.floater.f-right {
    bottom: 10%;
    right: 0;
    animation-duration: 6s;
    animation-delay: -2s;
}

.icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-box.danger {
    background: #FEF2F2;
    color: var(--color-danger);
}

.icon-box.success {
    background: #ECFDF5;
    color: var(--color-accent);
}

/* Mockup card subtle float */
.mockup-card {
    animation: float-subtle 6s cubic-bezier(0.37, 0, 0.63, 1) infinite alternate;
    will-change: transform;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-12px);
    }
}

@keyframes float-subtle {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-6px);
    }
}

/* --- 5. Secção Dores & Educação --- */
.section-problems,
.section-education {
    padding: 4rem 0;
    overflow-x: hidden;
    /* CORTA translações/escalas de entrada que tentem esticar o ecrã */
    width: 100%;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    color: var(--color-primary);
    font-size: 2rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    /* Utilizar o novo espaçamento fluido em vez do gap: 2rem estático */
    width: 100%;
}

/* Feature Cards & Ícones — Premium Hover */
.feature-card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2.5rem 1.5rem;
    /* Reduzido o padding lateral interno para caber melhor no mobile */
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--color-surface-border);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.3s ease,
        background 0.3s ease;
    position: relative;
    overflow: hidden;
    will-change: transform;
    /* FIX CRÍTICO CSS GRID: Impede que o conteúdo empurre a grid para fora do ecrã */
    min-width: 0;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 230, 118, 0.05),
        0 8px 16px rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 230, 118, 0.3);
    background: var(--color-surface-hover);
}

.icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background-color: rgba(0, 230, 118, 0.1);
    color: var(--color-accent);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.3s ease,
        color 0.3s ease;
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.feature-card:hover .icon-wrapper {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
    transform: scale(1.1) rotate(5deg);
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: var(--color-text);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* Education (Dark Theme) */
.section-education {
    background-color: #031510;
    /* Slightly different tone to separate sections */
    color: var(--color-white);
    border-top: 1px solid var(--color-surface-border);
    border-bottom: 1px solid var(--color-surface-border);
}

.edu-grid {
    display: grid;
    gap: 3rem;
}

.check-list li {
    margin-bottom: 0.5rem;
}

.check-list i {
    color: var(--color-accent);
    margin-right: 10px;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.edu-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    max-width: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.big-icon {
    font-size: 5rem;
    opacity: 0.5;
}

/* --- CTA Final --- */
.cta-final {
    background: radial-gradient(circle at center, #064E3B 0%, #010806 80%);
    padding: 6rem 0 6rem 0;
    text-align: center;
    color: var(--color-white);
    margin-top: -1px;
}

.cta-final h2 {
    color: var(--color-white);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-final p {
    color: #e0e0e0;
    margin-bottom: 2rem;
}

.cta-final .btn-primary {
    background-color: var(--color-white);
    color: var(--color-primary);
}

/* --- 6. Footer --- */
.footer {
    background: var(--color-bg-dark);
    color: var(--color-text-light);
    padding: 4rem 0 1rem;
    border-top: 1px solid var(--color-surface-border);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-logo {
    filter: brightness(0) invert(1);
    height: 30px;
    margin-bottom: 1rem;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
    color: var(--color-white);
}

.footer-col a {
    display: block;
    color: #9CA3AF;
    margin-bottom: 0.5rem;
}

.footer-col a:hover {
    color: var(--color-white);
}

.footer-copy {
    border-top: 1px solid #333;
    padding-top: 1rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

/* --- 7. Simulated UI (Code Theatre Demo) --- */
/* Telemóvel em CSS puro */
.sim-demo {
    transform: perspective(1000px) rotateY(-15deg) rotateX(5deg);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transform-style: preserve-3d;
    max-width: 100%;
    /* GARANTIA ANTI-TRANSBORDO MÓVEL */
    margin: 0 auto;
}

.sim-demo:hover {
    transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
}

/* ==========================================================
   MOBILE MOCKUP SHOWCASE (BEM Scoped Component)
   Resolve overflows, centraliza e gere proporção sem afetar blocos globais
========================================================== */

.mobile-showcase-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0 auto;
}

/* O comportamento padrão para Desktop/Geral */
.mobile-showcase-img {
    width: 100%;
    max-width: 400px;
    /* Limite base para ecrãs maiores */
    height: auto;
    position: relative;
    /* Contexto seguro para absolute children */
}

/* Tratamento Exclusivo Mobile (Fluididade, Espaçamento e Limites) */
@media (max-width: 768px) {
    .mobile-showcase-wrapper {
        padding: 0 20px;
        overflow-x: hidden;
        /* Evita scrolls laterais causados por 3D/Box-shadows do mockup */
    }

    .mobile-showcase-img {
        width: 100%;
        max-width: 260px;
        /* Restringe o mockup a ~70/80% do ecrã do telemóvel */
        height: auto;
    }
}

.phone-frame {
    width: 100%;
    /* No telemóvel as extremidades podem cortar devido ao rotate 3D, baixamos um pouco o max width */
    max-width: min(320px, 90vw);
    height: 650px;
    background: #111;
    border-radius: 40px;
    padding: 12px;
    box-shadow: -20px 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 2px #333,
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    position: relative;
    border: 1px solid #222;
    margin: 0 auto;
    /* Centrar o frame dentro do transform */
}

.phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 25px;
    background: #000;
    border-radius: 0 0 15px 15px;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.phone-notch::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1a1a1a;
    box-shadow: inset 0 0 2px rgba(255, 255, 255, 0.2);
}

.phone-notch::after {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #333;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: var(--color-bg-dark);
    border-radius: 30px;
    overflow: hidden;
    position: relative;
}

.sim-app {
    padding: 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: #111;
    /* Dark background inside the phone */
}

/* Topbar do telemóvel simulado */
.sim-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0.5rem 0;
    /* Top para o notch + Horizontal para espaçar dos bordos */
    color: var(--color-text-light);
    font-size: 0.8rem;
    font-weight: 600;
}

.sim-topbar-dots {
    display: flex;
    gap: 4px;
}

.sim-topbar-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-surface-border);
}

/* Avatar circular no canto direito do header do mock-up */
.sim-avatar {
    width: 28px;
    height: 28px;
    background: #e0f2fe;
    border-radius: 50%;
    flex-shrink: 0;
    /* Impede que o avatar encolha em ecrãs estreitos */
}

/* Balance Card (Green inside phone) */
.sim-balance-card {
    background: var(--color-accent);
    padding: 1.5rem 1.2rem;
    border-radius: var(--radius-lg);
    color: var(--color-bg-dark);
    box-shadow: 0 10px 25px rgba(0, 230, 118, 0.15);
}

.sim-balance__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    font-weight: 700;
    opacity: 0.8;
}

.sim-balance__value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
}

/* Base style for elements inside phone */
.sim-popup,
.sim-savings,
.sim-expense-item,
.sim-goal-card {
    background: var(--color-white);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: #111;
    /* Dark text on white cards */
}

/* Rest of the phone components */
.sim-popup {
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(120%);
    /* starts hidden */
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.sim-popup__icon {
    width: 40px;
    height: 40px;
    background: #FEF3C7;
    /* Yellowish */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.sim-popup__info {
    flex: 1;
}

.sim-popup__name {
    font-weight: 700;
    font-size: 0.9rem;
}

.sim-popup__time {
    font-size: 0.75rem;
    color: #666;
}

.sim-popup__amount {
    font-weight: 700;
    color: var(--color-danger);
    font-size: 0.95rem;
}

.sim-savings__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.sim-savings__header i {
    color: var(--color-primary);
    margin-right: 4px;
}

.sim-savings__pct {
    color: var(--color-accent-hover);
    font-weight: 700;
}

.sim-savings__track {
    width: 100%;
    height: 6px;
    background: #E5E7EB;
    border-radius: 10px;
    overflow: hidden;
}

.sim-savings__fill {
    height: 100%;
    width: 5%;
    /* Initial small value */
    background: var(--color-accent);
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.sim-expenses {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sim-expense-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.sim-expense__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sim-expense__icon--coffee {
    background: #FFF7ED;
    color: #EA580C;
}

.sim-expense__icon--transport {
    background: #EFF6FF;
    color: #2563EB;
}

.sim-expense__name {
    font-weight: 600;
    font-size: 0.85rem;
}

.sim-expense__time {
    font-size: 0.7rem;
    color: #666;
}

.sim-expense__amount {
    font-weight: 700;
    color: var(--color-danger);
    font-size: 0.85rem;
}

/* Animations State Controller */
.start-demo .sim-popup {
    transform: translateX(0);
    opacity: 1;
    transition-delay: 1.5s;
}

/* --- Goal Simulator (Edu) — Block 1 REMOVED ---
   All goal simulator styles consolidated in the VER.2 block below (line ~2240+).
   This avoids opacity/color conflicts between duplicate definitions. */

/* Legacy animation states intentionally removed — VER.2 uses @keyframes instead */
.start-demo .sim-progress-fill {
    /* Handled by VER.2 @keyframes goal-progress-fill */
    transition-delay: 0;
}

.start-demo .sim-balloon {
    opacity: 1;
    transform: translateX(10px) translateY(0);
    /* Moves right as it fills */
    transition-delay: 0.5s;
}

.start-demo .sim-achievement {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 2s;
}

/* Esta secção faltava no teu código original */

/* --- Auth Specific Body (Gradient) --- */
.auth-body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2.5rem 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    color: var(--color-primary);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

/* Estilos de Formulário */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

/* Wrapper para Inputs com Ícones */
/* Wrapper for Pills */
.input-icon-wrapper {
    position: relative;
    width: 100%;
}

.input-icon-wrapper input {
    width: 100%;
    height: 54px;
    padding: 0 1.5rem;
    padding-left: 55px !important;
    padding-right: 50px !important;
    /* Fix: Prevent right overlap with eye icon */
    /* Adjusted to 55px */
    /* Space for icon (absolute left) */
    border: 1px solid transparent;
    border-radius: 9999px;
    /* Pill Shape */
    font-size: 1rem;
    color: var(--color-text);
    background: #F3F4F6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.input-icon-wrapper input:focus {
    background: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(6, 78, 59, 0.15);
}

/* Icon Positioning (Centered Vertically) */
.input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 15px;
    /* Moved slightly left */
    color: #9CA3AF;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 10;
}

/* Toggle Password Eye */
.toggle-password {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 20px;
    color: #9CA3AF;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
    font-size: 1.1rem;
    padding: 10px;
}

.toggle-password.active {
    color: #10B981;
    /* Verde Gestin quando ativo */
}

.toggle-password:hover {
    color: #10B981;
    /* Verde ao passar */
}

/* Links do Auth */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.back-link:hover {
    color: var(--color-primary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

/* Alertas */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-success {
    background-color: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

/* --- 9. Responsividade (Desktop) --- */
@media (min-width: 768px) {
    .nav-list {
        display: flex;
    }

    .mobile-toggle {
        display: none;
    }

    .hero-grid {
        grid-template-columns: 1fr 1fr;
    }

    .edu-grid {
        grid-template-columns: 1.5fr 1fr;
        align-items: center;
        gap: 4rem;
    }
}

/* ==========================================================================
   10. GLOBAL VISUAL POLISH (Added for UI Fixes)
   ========================================================================== */

/* --- Z-INDEX HIERARCHY --- */
/* Floating Action Button (FAB) - Lower priority */
.bottom-nav__fab,
.floating-btn {
    z-index: 90 !important;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* FAB Hidden State (controlled by JS) */
.fab-hidden {
    transform: scale(0) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Modals & Overlays - Higher priority */
.modal,
.novo-mov-overlay {
    z-index: 2000 !important;
}

.modal-backdrop,
.modal-overlay {
    z-index: 1990 !important;
}

/* Toast Notifications - Highest priority */
.toast-container {
    z-index: 10000 !important;
}

/* --- SOFT SHADOWS & RADIUS --- */
.card,
.modal-content,
.premium-card,
.profile-form,
.settings-card {
    border-radius: 14px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
}

/* --- INPUT POLISH --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea,
.form-control,
.premium-input {
    border-radius: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-default, #E5E7EB);
    background-color: var(--bg-input, #FFFFFF);
    color: var(--text-primary, #1F2937);
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus,
.premium-input:focus {
    border-color: var(--color-accent, #10B981);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
    outline: none;
}

/* --- 11. MOBILE MENU FIX --- */
@media (max-width: 768px) {
    .nav-list.active {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-white);
        padding: 2rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        z-index: 10001;
        /* Above everything */
        animation: slideMenu 0.2s ease-out forwards;
        gap: 1.5rem;
        border-bottom: 1px solid var(--color-border);
    }

    /* Fixed: Move Menu Icon Closer to Corner */
    .header .nav-wrapper {
        width: 100%;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
}

/* Ensure links are visible */
.nav-list.active a {
    display: block;
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    width: 100%;
}

/* Primary button specific styling in menu */
.nav-list.active .btn {
    width: 100%;
    justify-content: center;
}

@keyframes slideMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   12. SCROLL REVEAL ANIMATIONS (Stripe/Apple Style)
   ==========================================================================
   Performance: Only animates `transform` + `opacity` (GPU-composited).
   Stagger: Use CSS variable --reveal-delay on each element.
   ========================================================================== */

.reveal-hidden {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: var(--reveal-delay, 0s);
    will-change: opacity, transform;
}

.reveal-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Variant: Slide from left */
.reveal-hidden.from-left {
    transform: translateX(max(-30px, -5vw));
    /* Proteção extra mobile */
}

.reveal-visible.from-left {
    transform: translateX(0);
}

/* Variant: Slide from right */
.reveal-hidden.from-right {
    transform: translateX(min(30px, 5vw));
    /* Previne que o ecrã estique para a direita */
}

.reveal-visible.from-right {
    transform: translateX(0);
}

/* Variant: Scale up */
.reveal-hidden.scale-up {
    transform: scale(0.95);
}

.reveal-visible.scale-up {
    transform: scale(1);
}

/* Hero entrance — staggered cascade on load */
/* Children start hidden, animate in sequence */
.hero-text>* {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-text>h1 {
    animation-delay: 0s;
}

.hero-text>p {
    animation-delay: 0.3s;
}

.hero-text>.cta-group {
    animation-delay: 0.6s;
}

/* Phone Simulated UI — appears AFTER text finishes */
.sim-demo {
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.9s forwards;
    /* Inicia APÓS os textos */
    position: relative;
}

/* Accessibility: Disable all motion for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .reveal-hidden {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-text>*,
    .sim-demo {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .floater,
    .mockup-card {
        animation: none;
    }
}

/* --- 4. PHONE MOCKUP FRAME --- */
.phone-frame {
    position: relative;
    background: #1a1a1a;
    border-radius: 40px;
    padding: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.08), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
    max-width: 340px;
    margin: 0 auto;
}

.phone-notch {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 24px;
    background: #1a1a1a;
    border-radius: 0 0 16px 16px;
    z-index: 5;
}

.phone-notch::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
}

.phone-screen {
    border-radius: 30px;
    overflow: hidden;
    background: var(--color-white);
}

.sim-app {
    background: var(--color-white);
    overflow: hidden;
    padding-bottom: 1rem;
}

/* --- Avatar do Utilizador --- */
.sim-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #D1FAE5;
    flex-shrink: 0;
}

/* --- Bloco de Saldo Animado (GPU) --- */
.sim-balance-card {
    background: var(--color-accent);
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    margin: 0.8rem 1.2rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

.sim-balance-card .sim-balance__label {
    font-size: 0.7rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.sim-balance-card .sim-balance__value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #fff;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* Flash quando o saldo actualiza */
.sim-flash {
    transform: scale(1.06) !important;
    color: #A7F3D0 !important;
}

/* --- Pop-up de Despesa (Slide-in GPU) --- */
.sim-popup {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #fff;
    margin: 0 1.2rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    /* Estado inicial: escondido abaixo */
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.sim-popup--visible {
    opacity: 1;
    transform: translateY(0);
}

.sim-popup__icon {
    width: 36px;
    height: 36px;
    background: #FEF3C7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sim-popup__info {
    flex: 1;
    min-width: 0;
}

.sim-popup__name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-text);
}

.sim-popup__time {
    font-size: 0.65rem;
    color: var(--color-text-light);
}

.sim-popup__amount {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-danger);
    white-space: nowrap;
}

/* --- Barra de Poupança / Metas Dinâmicas (scaleX GPU) --- */
.sim-savings {
    background: #fff;
    margin: 0.8rem 1.2rem;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.sim-savings__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.6rem;
}

.sim-savings__header i {
    color: var(--color-accent);
    margin-right: 0.3rem;
}

.sim-savings__pct {
    color: var(--color-accent);
    font-weight: 700;
    transition: color 0.3s ease;
}

.sim-savings__track {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.sim-savings__fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--color-accent), #34D399);
    border-radius: 4px;
    transform-origin: left;
    transform: scaleX(0.05);
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* --- 5. SIMULATED UI (DESPESAS) --- */
.sim-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}

.sim-topbar-dots {
    display: flex;
    gap: 5px;
}

.sim-topbar-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.sim-balance {
    padding: 1.2rem 1.4rem;
    text-align: center;
}

.sim-balance__label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-light);
    margin-bottom: 0.3rem;
}

.sim-balance__value {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--color-text);
}

.sim-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.2rem 0.8rem;
}

.sim-input {
    flex: 1;
    background: #F3F4F6;
    border: 1.5px solid transparent;
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
    font-family: var(--font-main);
    color: var(--color-text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: none;
}

.sim-input--focused {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    background: #fff;
}

.sim-input__typed {
    opacity: 0;
    font-weight: 500;
}

.sim-input__cursor {
    display: inline-block;
    width: 1.5px;
    height: 14px;
    background: var(--color-accent);
    margin-left: 1px;
    vertical-align: middle;
    animation: blink-cursor 0.7s step-end infinite;
    opacity: 0;
}

.sim-add-btn {
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: default;
    opacity: 0.5;
    transition: opacity 0.3s ease, transform 0.15s ease;
    white-space: nowrap;
    pointer-events: none;
}

.sim-add-btn--active {
    opacity: 1;
}

.sim-add-btn--clicked {
    transform: scale(0.92);
}

.sim-expenses {
    padding: 0 1.2rem 1rem;
}

.sim-expense-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #F3F4F6;
    opacity: 1;
}

.sim-expense-item:last-child {
    border-bottom: none;
}

.sim-expense-item--new {
    opacity: 0;
    transform: translateY(-12px);
}

.sim-expense-item--visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sim-expense__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sim-expense__icon--food {
    background: #FEF2F2;
    color: var(--color-danger);
}

.sim-expense__icon--transport {
    background: #EFF6FF;
    color: #3B82F6;
}

.sim-expense__icon--coffee {
    background: #FFF7ED;
    color: #F59E0B;
}

.sim-expense__info {
    flex: 1;
    min-width: 0;
}

.sim-expense__name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text);
}

.sim-expense__time {
    font-size: 0.65rem;
    color: var(--color-text-light);
}

.sim-expense__amount {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--color-danger);
    white-space: nowrap;
}

.sim-chart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.6rem 1.2rem 1.2rem;
}

.sim-donut {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.sim-donut__bg {
    fill: none;
    stroke: #F3F4F6;
    stroke-width: 6;
}

.sim-donut__fill {
    fill: none;
    stroke: var(--color-accent);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 0 999;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dasharray 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.sim-donut__fill-secondary {
    fill: none;
    stroke: var(--color-danger);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 0 999;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dasharray 1s cubic-bezier(0.16, 1, 0.3, 1) 0.15s;
}

.sim-chart__legend {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sim-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    color: var(--color-text-light);
}

.sim-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sim-cursor {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    will-change: transform, opacity;
}

/* --- 6. TIMELINE START TRIGGER --- */
.start-demo .sim-cursor {
    animation: cursor-appear 0.4s ease 0.3s both, cursor-to-input 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s both, cursor-to-button 0.6s cubic-bezier(0.4, 0, 0.2, 1) 3.8s both, cursor-fade-out 0.5s ease 7s both;
}

.start-demo .sim-input {
    animation: input-focus 0.3s ease 2s both;
}

.start-demo .sim-input__typed {
    animation: type-text 1.2s steps(10, end) 2.3s both;
}

.start-demo .sim-input__cursor {
    animation: cursor-show 0.1s ease 2s both;
}

.start-demo .sim-add-btn {
    animation: btn-activate 0.1s ease 3.6s both, btn-click 0.2s ease 4.6s both;
}

.start-demo .sim-expense-item--new {
    animation: expense-slide-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) 5s both;
}

.start-demo .sim-donut__fill {
    animation: donut-fill-main 1.2s cubic-bezier(0.16, 1, 0.3, 1) 5.3s both;
}

.start-demo .sim-donut__fill-secondary {
    animation: donut-fill-expenses 1.2s cubic-bezier(0.16, 1, 0.3, 1) 5.5s both;
}

.start-demo .sim-balance__value {
    animation: balance-flash 0.6s ease 5.2s both;
}

/* --- 7. ANIMATIONS --- */
@keyframes blink-cursor {
    50% {
        opacity: 0;
    }
}

@keyframes cursor-appear {
    from {
        opacity: 0;
        transform: translate(30px, 10px) scale(0.8);
    }

    to {
        opacity: 0.9;
        transform: translate(30px, 10px) scale(1);
    }
}

@keyframes cursor-to-input {
    from {
        transform: translate(30px, 10px);
    }

    to {
        transform: translate(80px, 135px);
    }
}

@keyframes cursor-to-button {
    from {
        transform: translate(80px, 135px);
    }

    to {
        transform: translate(320px, 140px);
    }
}

@keyframes cursor-fade-out {
    to {
        opacity: 0;
        transform: translate(320px, 140px) scale(0.8);
    }
}

@keyframes input-focus {
    to {
        border-color: var(--color-accent);
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
        background: #fff;
    }
}

@keyframes type-text {
    from {
        opacity: 1;
        max-width: 0;
        overflow: hidden;
    }

    to {
        opacity: 1;
        max-width: 200px;
        overflow: hidden;
    }
}

@keyframes cursor-show {
    to {
        opacity: 1;
    }
}

@keyframes btn-activate {
    to {
        opacity: 1;
    }
}

@keyframes btn-click {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes expense-slide-in {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes donut-fill-main {
    to {
        stroke-dasharray: 175 999;
    }
}

@keyframes donut-fill-expenses {
    to {
        stroke-dasharray: 75 999;
    }
}

@keyframes balance-flash {
    0% {
        opacity: 1;
    }

    30% {
        opacity: 0.4;
        transform: scale(0.97);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .sim-demo {
        max-width: 340px;
    }

    .sim-cursor {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sim-cursor {
        display: none;
    }

    .start-demo * {
        animation: none !important;
    }

    .start-demo .sim-expense-item--new {
        opacity: 1;
        transform: none;
    }

    .start-demo .sim-donut__fill {
        stroke-dasharray: 175 999;
    }

    .start-demo .sim-donut__fill-secondary {
        stroke-dasharray: 75 999;
    }

    /* Goals reduced motion */
    .start-demo .sim-progress-fill {
        width: 100% !important;
    }

    .start-demo .sim-balloon {
        display: none !important;
    }

    .start-demo .sim-achievement {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ==========================================================================
   SIMULATED UI VER.2 — METAS (GOALS) 
   ========================================================================== */
.sim-goal-demo {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* Override: o telemóvel da secção Educação precisa de fundo claro (não escuro como o Hero) */
.sim-goal-demo .phone-screen {
    background: #F9FAFB;
}

.sim-goal-demo .sim-app {
    background: #F9FAFB;
    /* Fundo claro para que o card branco e texto escuro sejam visíveis */
}

.sim-goal-demo .sim-topbar {
    color: #333;
    /* Texto da topbar escuro no fundo claro */
}

.start-demo.sim-goal-demo {
    opacity: 1;
    transform: translateY(0);
}

.sim-goal-content {
    padding: 1.5rem;
    background: #F9FAFB;
    height: 100%;
    min-height: 250px;
}

.sim-goal-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.sim-goal-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.sim-goal-icon {
    width: 40px;
    height: 40px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sim-goal-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1a1a1a;
    /* Forçar texto escuro — var(--color-text) resolve para cinzento claro no dark theme */
}

.sim-goal-amounts {
    display: flex;
    align-items: baseline;
    margin-bottom: 0.8rem;
}

.sim-goal-current {
    font-size: 1.5rem;
    font-weight: 800;
    color: #111;
    /* Forçar cor escura para legibilidade no card branco */
}

.sim-goal-target {
    font-size: 0.8rem;
    color: #666;
    /* Forçar cinzento médio em vez de var(--color-text-light) */
    margin-left: 0.4rem;
    font-weight: 500;
}

/* Progress Bar & Baloon */
.sim-progress-track {
    width: 100%;
    height: 12px;
    background: #E5E7EB;
    border-radius: 20px;
    position: relative;
    margin-bottom: 1.5rem;
    overflow: visible;
}

.sim-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #34D399, var(--color-accent));
    border-radius: 20px;
    width: 70%;
    /* Begins at 70% */
    will-change: width;
}

.sim-balloon {
    position: absolute;
    top: -35px;
    left: 70%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    opacity: 0;
}

.sim-balloon::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0;
    border-style: solid;
    border-color: var(--color-accent) transparent transparent;
}

/* Achievement Badge */
.sim-achievement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    background: #ECFDF5;
    color: var(--color-accent);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
    transform: translateY(10px);
}

/* --- GOALS TIMELINE START TRIGGER --- */
/* Phase 1 (1s): Balloon appears at 70% */
.start-demo .sim-balloon {
    animation: goal-balloon-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) 1s both,
        goal-balloon-move 1.5s ease-in-out 1.5s both,
        goal-balloon-out 0.3s ease-in 3.2s both;
}

/* Phase 2 (1.5s): Progress bar expands to 100% */
.start-demo .sim-progress-fill {
    animation: goal-progress-fill 1.5s ease-in-out 1.5s both;
}

/* Phase 3 (3s): Amount rapidly updates */
.start-demo .sim-goal-current {
    animation: goal-amount-bump 0.4s ease 3s both;
}

/* Phase 4 (3.5s): Trophy Achievement pops up */
.start-demo .sim-achievement {
    animation: goal-trophy-pop 0.6s cubic-bezier(0.16, 1, 0.3, 1) 3.5s both;
}

/* --- GOALS KEYFRAMES --- */
@keyframes goal-balloon-in {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes goal-balloon-move {
    from {
        left: 70%;
    }

    to {
        left: 100%;
    }
}

@keyframes goal-balloon-out {
    to {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
}

@keyframes goal-progress-fill {
    from {
        width: 70%;
    }

    to {
        width: 100%;
    }
}

@keyframes goal-amount-bump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
        color: var(--color-accent);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes goal-trophy-pop {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}