/* =============================================================
   Curso de Python (UC00618) — IEFP · Centro de Emprego da Maia
   Paleta em tons de verde IEFP, design moderno e responsivo.
   ============================================================= */

:root {
    /* Paleta IEFP — verde escuro #007A38 e verde claro #66C430 (logótipo oficial) */
    --green-900: #063d1f;
    --green-800: #0a5a2e;
    --green-700: #007a38;
    --green-600: #1d8f46;
    --green-500: #66c430;
    --green-400: #85d155;
    --green-300: #a9df86;
    --green-100: #dff3d1;
    --green-050: #f3faee;

    --ink: #17263a;
    --muted: #5c6b7e;
    --line: #e2e8f0;
    --white: #ffffff;

    --green: #1a9e6a;
    --green-bg: #e6f6ee;
    --red: #d1435b;
    --red-bg: #fcebee;
    --amber: #e0902a;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 18px 45px -20px rgba(0, 122, 56, .30);
    --shadow-sm: 0 6px 18px -10px rgba(0, 122, 56, .28);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 100% -10%, var(--green-100), transparent 60%),
        radial-gradient(1000px 500px at -10% 110%, var(--green-100), transparent 55%),
        var(--green-050);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 860px;
    margin: 0 auto;
    padding: 24px 20px 60px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------------- Topbar ---------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.brand { display: flex; flex-direction: column; line-height: 1; text-decoration: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-mark {
    font-weight: 800;
    font-size: 26px;
    letter-spacing: 1px;
    color: var(--green-700);
}
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 5px; letter-spacing: .3px; }
.topbar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--green-600);
    background: var(--white);
    padding: 8px 14px;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

/* ---------------- Cartões / ecrãs ---------------- */
.screen { display: none; }
.screen.is-active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px;
    border: 1px solid rgba(255,255,255,.6);
}

/* ---------------- Hero / intro ---------------- */
.pill {
    display: inline-block;
    background: var(--green-100);
    color: var(--green-700);
    font-weight: 600;
    font-size: 12.5px;
    padding: 6px 12px;
    border-radius: 999px;
    letter-spacing: .3px;
}
.hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.15rem);
    line-height: 1.15;
    margin: 16px 0 12px;
    color: var(--green-900);
    letter-spacing: -.5px;
}
.lead { color: var(--muted); font-size: 15.5px; line-height: 1.6; margin: 0; }
.lead strong { color: var(--ink); }

.facts {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    margin: 22px 0 6px;
}
.facts li {
    background: var(--green-050);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--muted);
}
.facts strong { color: var(--green-700); font-size: 15px; }

/* ---------------- Formulário ---------------- */
.form { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--line); }
.form h2, .quiz-body h2 { font-size: 18px; margin: 0 0 18px; color: var(--green-900); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 7px; color: var(--ink); }
.field input {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
    background: var(--green-050);
}
.field input:focus {
    outline: none;
    border-color: var(--green-400);
    box-shadow: 0 0 0 4px rgba(102,196,48,.25);
    background: var(--white);
}
.form-error {
    color: var(--red);
    background: #fdecef;
    border: 1px solid #f6c9d2;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin: 4px 0 14px;
}
.fineprint { font-size: 12px; color: var(--muted); text-align: center; margin: 14px 0 0; }
.fineprint a, .consent a { color: var(--green-600); }

.consent {
    display: flex; gap: 11px; align-items: flex-start;
    background: var(--green-050); border: 1px solid var(--line);
    border-radius: var(--radius-sm); padding: 13px 15px;
    font-size: 13px; color: var(--muted); line-height: 1.5;
    cursor: pointer; margin-bottom: 4px;
}
.consent input { margin-top: 2px; width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--green-600); cursor: pointer; }

/* ---------------- Botões ---------------- */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    padding: 13px 22px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: transform .12s, box-shadow .2s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: linear-gradient(135deg, var(--green-600), var(--green-800));
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: 0 10px 24px -8px rgba(0,122,56,.55); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-ghost { background: transparent; color: var(--green-700); border-color: var(--line); }
.btn-ghost:hover { background: var(--green-050); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- Quiz ---------------- */
.quiz-head { margin-bottom: 26px; }
.progress-bar {
    height: 9px;
    background: var(--green-100);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--green-500), var(--green-700));
    border-radius: 999px;
    transition: width .35s ease;
}
.progress-text { font-size: 13px; color: var(--muted); margin-top: 10px; font-weight: 500; }
.progress-text span { color: var(--green-700); font-weight: 700; }

.q-topic {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--green-600);
    background: var(--green-050);
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
    letter-spacing: .2px;
}
.q-text { font-size: 19px; line-height: 1.4; color: var(--green-900); font-weight: 600; margin: 0 0 22px; }

.options { display: flex; flex-direction: column; gap: 11px; }
.option {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 17px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s, transform .1s;
    background: var(--white);
    font-size: 15px;
}
.option:hover { border-color: var(--green-300); background: var(--green-050); }
.option.selected { border-color: var(--green-500); background: var(--green-100); }
.option .marker {
    width: 24px; height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    border: 2px solid var(--green-300);
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
    color: var(--green-700);
    background: var(--white);
    transition: background .15s, border-color .15s;
}
.option.selected .marker { background: var(--green-600); border-color: var(--green-600); color: #fff; }

.quiz-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; }

/* ---------------- Resultado ---------------- */
.result-head { text-align: center; margin-bottom: 8px; }
.result-head .badge {
    display: inline-block;
    font-size: 12.5px; font-weight: 700;
    padding: 6px 14px; border-radius: 999px;
    letter-spacing: .3px; margin-bottom: 18px;
}
.badge.lvl-good, .badge.lvl-great { background: var(--green-bg); color: var(--green); }
.badge.lvl-ok { background: #fdf1e2; color: var(--amber); }
.badge.lvl-low { background: #fdecef; color: var(--red); }

.gauge-wrap { display: flex; justify-content: center; margin: 4px 0 18px; }
.gauge { position: relative; width: 180px; height: 180px; }
.gauge svg { transform: rotate(-90deg); }
.gauge-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.gauge-center .pct { font-size: 42px; font-weight: 800; color: var(--green-800); line-height: 1; }
.gauge-center .frac { font-size: 13px; color: var(--muted); margin-top: 4px; }

.result-head h1 { font-size: 24px; color: var(--green-900); margin: 4px 0 10px; }
.result-summary {
    color: var(--muted); font-size: 15px; line-height: 1.6;
    max-width: 620px; margin: 0 auto 6px; text-align: center;
}

.section-title {
    font-size: 15px; font-weight: 700; color: var(--green-800);
    margin: 30px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* Barras por tema */
.topic-row { margin-bottom: 14px; }
.topic-row .topic-label {
    display: flex; justify-content: space-between;
    font-size: 13.5px; margin-bottom: 6px; color: var(--ink); font-weight: 500;
}
.topic-row .topic-label span:last-child { color: var(--muted); font-weight: 600; }
.topic-track { height: 9px; background: var(--green-100); border-radius: 999px; overflow: hidden; }
.topic-track i {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, var(--green-400), var(--green-700));
}
.topic-track i.warn { background: linear-gradient(90deg, #f0b45a, #e0902a); }
.topic-track i.bad  { background: linear-gradient(90deg, #ec7a8d, #d1435b); }

/* Conselhos */
.advice-item {
    display: flex; gap: 13px;
    padding: 15px 17px; margin-bottom: 11px;
    background: var(--green-050); border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}
.advice-item .dot {
    flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%;
    background: var(--green-500); margin-top: 7px;
}
.advice-item h4 { margin: 0 0 4px; font-size: 14px; color: var(--green-800); }
.advice-item p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.advice-empty {
    background: var(--green-bg); border: 1px solid #bfe6d3; color: #147a52;
    padding: 16px; border-radius: var(--radius-sm); font-size: 14px; text-align: center;
}

/* Revisão de respostas */
.review-item { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.review-q {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 15px 17px; cursor: pointer; background: var(--white);
}
.review-q .ico {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
}
.review-q .ico.ok { background: var(--green); }
.review-q .ico.no { background: var(--red); }
.review-q .rq-text { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.review-detail { padding: 0 17px 15px 51px; display: none; }
.review-item.open .review-detail { display: block; }
.review-detail .ans { font-size: 13.5px; margin: 3px 0; }
.review-detail .ans .lbl { color: var(--muted); }
.review-detail .ans.correct { color: var(--green); font-weight: 600; }
.review-detail .ans.wrong { color: var(--red); }
.review-detail .expl {
    font-size: 13px; color: var(--muted); line-height: 1.55;
    background: var(--green-050); border-radius: 10px; padding: 11px 13px; margin-top: 10px;
}

.result-actions { text-align: center; margin-top: 28px; }
.result-actions .btn { display: inline-block; }
.print-hint { font-size: 12px; color: var(--muted); margin-top: 12px; }

/* ---------------- Loading ---------------- */
.loading { text-align: center; padding: 50px 0; color: var(--muted); }
.spinner {
    width: 44px; height: 44px; margin: 0 auto 16px;
    border: 4px solid var(--green-100);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Footer ---------------- */
.footer { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: auto; padding-top: 26px; }

/* ================= LANDING PAGE ================= */
.landing { max-width: 940px; }
.nav-links { display: flex; gap: 8px; align-items: center; }
.nav-links a {
    font-size: 13px; font-weight: 600; color: var(--green-700);
    text-decoration: none; padding: 8px 13px; border-radius: 999px;
    background: var(--white); box-shadow: var(--shadow-sm);
}
.nav-links a.solid { background: linear-gradient(135deg, var(--green-500), var(--green-700)); color: #fff; }

.hero-land {
    text-align: center;
    background:
        radial-gradient(600px 260px at 50% -30%, var(--green-100), transparent 70%),
        var(--white);
}
.hero-land .pill { margin-bottom: 6px; }
.hero-land h1 { font-size: clamp(1.8rem, 5vw, 2.7rem); color: var(--green-900); margin: 14px 0 12px; letter-spacing: -.5px; line-height: 1.1; }
.hero-land .lead { max-width: 640px; margin: 0 auto; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 26px; }
.hero-cta .btn { min-width: 210px; }
.hero-stats { display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.hero-stats .s { text-align: center; }
.hero-stats .s .n { font-size: 24px; font-weight: 800; color: var(--green-600); }
.hero-stats .s .l { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.section { margin-top: 26px; }
.section > h2 {
    font-size: 21px; color: var(--green-900); margin: 0 0 4px;
    display: flex; align-items: center; gap: 10px;
}
.section > .section-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-card { background: var(--green-050); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.mini-card h3 { margin: 0 0 8px; font-size: 15px; color: var(--green-800); }
.mini-card p, .mini-card li { font-size: 14px; color: var(--muted); line-height: 1.6; }
.mini-card ul { margin: 0; padding-left: 18px; }

.prog-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.prog-item { display: flex; gap: 12px; align-items: flex-start; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.prog-item .nº { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--green-400), var(--green-700)); }
.prog-item span.t { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.35; }

.group-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.group-card { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.group-card .gc-head { background: linear-gradient(135deg, var(--green-600), var(--green-800)); color: #fff; padding: 14px 18px; }
.group-card .gc-head .g { font-size: 17px; font-weight: 700; }
.group-card .gc-head .c { font-size: 12px; opacity: .85; margin-top: 2px; }
.group-card table { width: 100%; border-collapse: collapse; }
.group-card td { padding: 9px 18px; font-size: 13.5px; border-bottom: 1px solid var(--line); color: var(--ink); }
.group-card tr:last-child td { border-bottom: none; }
.group-card td:last-child { text-align: right; color: var(--muted); }

.cta-band {
    background: linear-gradient(135deg, var(--green-600), var(--green-900));
    color: #fff; border-radius: var(--radius); padding: 30px 34px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    box-shadow: var(--shadow);
}
.cta-band h2 { color: #fff; margin: 0 0 6px; font-size: 22px; }
.cta-band p { margin: 0; color: #dff3d1; font-size: 14.5px; max-width: 460px; }
.cta-band .btn { background: #fff; color: var(--green-700); border: none; white-space: nowrap; }
.cta-band .btn:hover { background: #f3faee; }

/* Cartões de download (partilhados com materiais.php) */
.mat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.mat {
    display: flex; gap: 14px; align-items: flex-start;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 16px 18px; box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
    transition: transform .12s, box-shadow .2s, border-color .15s;
}
.mat:hover { transform: translateY(-2px); border-color: var(--green-300); box-shadow: 0 12px 26px -14px rgba(0,122,56,.45); }
.mat .badge-ext { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.mat .badge-ext.pdf { background: linear-gradient(135deg, #e2574c, #c0392b); }
.mat .badge-ext.excel { background: linear-gradient(135deg, #1f9d63, #157a4b); }
.mat .badge-ext.word { background: linear-gradient(135deg, #2b7bd6, #1a5aa8); }
.mat .badge-ext.zip { background: linear-gradient(135deg, #6b7a90, #3f4b5c); }
.mat .badge-ext.python { background: linear-gradient(135deg, #3776ab, #ffd43b 140%); }
.mat .t { font-size: 15px; font-weight: 600; color: var(--green-900); margin: 0 0 3px; line-height: 1.25; }
.mat .d { font-size: 12.5px; color: var(--muted); margin: 0; line-height: 1.45; }
.mat .meta { font-size: 11.5px; color: var(--green-600); font-weight: 600; margin-top: 7px; }

.contact-band { text-align: center; font-size: 13px; color: var(--muted); margin-top: 24px; line-height: 1.7; }
.contact-band strong { color: var(--green-800); }

/* Barra de cofinanciamento (Pessoas 2030 · Portugal 2030 · UE) */
.cofin { text-align: center; margin-top: 22px; }
.cofin img { max-width: 100%; width: 520px; height: auto; display: inline-block; background: #fff; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); }
.cofin p { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }

/* Pílula "à distância" */
.pill.online { background: #fff6e0; color: #9a6400; margin-left: 6px; }
code.inline { font-family: Consolas, 'Courier New', monospace; font-size: .92em; background: var(--green-050); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--green-800); }

@media (max-width: 720px) {
    .two-col, .prog-grid, .group-cards, .mat-grid { grid-template-columns: 1fr; }
    .cta-band { flex-direction: column; text-align: center; }
    .cta-band p { max-width: none; }
}

/* ---------------- Responsivo ---------------- */
@media (max-width: 620px) {
    .app { padding: 16px 14px 40px; }
    .card { padding: 22px; border-radius: 16px; }
    .q-text { font-size: 17px; }
    .quiz-nav { flex-direction: row; }
    .btn { padding: 12px 16px; font-size: 14px; }
    .topbar-title { display: none; }
    .gauge { width: 150px; height: 150px; }
    .gauge-center .pct { font-size: 34px; }
}

/* ---------------- Impressão ---------------- */
@media print {
    body { background: #fff; }
    .topbar-title, .result-actions, .footer, .quiz-nav { display: none !important; }
    .card { box-shadow: none; border: none; padding: 0; }
    .review-detail { display: block !important; }
}
