/* ===================================
   Circuito Ferradura — Estilos Principais
   Palotina, 1993 · Terra Vermelha · Ábaco Romano
   =================================== */

/* Curso: fontes do sistema (evita CDN bloqueada na loja circuito.caracore.com.br) */

:root {
    --verde-pista:     #1a7a3c;
    --verde-claro:     #2da858;
    --verde-escuro:    #125c2c;
    --terra-vermelha:  #b03a2e;
    --terra-claro:     #d45a4a;
    --amarelo-palotina:#f4c430;
    --cinza-console:   #1e1e1e;
    --cinza-claro:     #f0faf2;
    --bg-grad:         linear-gradient(135deg, #1a7a3c 0%, #2da858 60%, #f4c430 100%);

    --font-main: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "Consolas", "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-main);
    font-size: 18px;
    line-height: 1.8;
    color: #2c3e50;
    background-color: #f8f9fa;
}

/* ── Navbar ──────────────────────────────────────── */
.navbar {
    background-color: var(--verde-pista) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,.2);
    font-weight: 700;
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff !important;
}

.navbar-brand .tag-versao {
    background: var(--amarelo-palotina);
    color: #1a1a1a;
    font-size: .7rem;
    font-weight: 700;
    border-radius: .3rem;
    padding: .1rem .4rem;
    margin-left: .4rem;
    vertical-align: middle;
}

.nav-link { color: rgba(255,255,255,.9) !important; font-weight: 600; }
.nav-link:hover, .nav-link.active { color: var(--amarelo-palotina) !important; }
.dropdown-menu { border: none; box-shadow: 0 4px 20px rgba(0,0,0,.15); border-radius: .75rem; }
.dropdown-item:hover { background-color: var(--cinza-claro); color: var(--verde-pista); }
.dropdown-item.active { background-color: var(--verde-pista); }

/* ── Hero / Banner ───────────────────────────────── */
.hero-section {
    background: var(--bg-grad);
    padding: 0;
    position: relative;
}

.hero-image-container {
    position: relative;
    max-height: 520px;
    overflow: hidden;
}

.hero-image {
    width: 100%;
    height: 520px;
    object-fit: cover;
    display: block;
    filter: brightness(.7);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, rgba(26,122,60,.5) 0%, transparent 100%);
}

.hero-title  { font-size: 3rem; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.hero-subtitle { font-size: 1.3rem; opacity: .95; text-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ── Headings ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-main);
    font-weight: 700;
    margin-bottom: 1rem;
    color: #2c3e50;
}

h1 { font-size: 2.5rem; margin-bottom: 1.5rem; }

h2 {
    font-size: 2rem;
    color: var(--verde-pista);
    border-bottom: 3px solid var(--amarelo-palotina);
    padding-bottom: .5rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.6rem;
    color: var(--terra-vermelha);
    margin-top: 1.5rem;
}

p { margin-bottom: 1.2rem; text-align: justify; }
.lead { font-size: 1.3rem; font-weight: 400; color: #555; }

/* ── Cards ───────────────────────────────────────── */
.card {
    border-radius: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,.1);
    border: none;
    margin-bottom: 2rem;
    transition: transform .3s, box-shadow .3s;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,.15); }

.card-header {
    background: var(--bg-grad);
    color: white;
    font-weight: 700;
    font-size: 1.3rem;
    border-radius: 1rem 1rem 0 0 !important;
    padding: 1.2rem;
}

.card-body { padding: 1.5rem; font-size: 1.1rem; }

/* ── Badges ──────────────────────────────────────── */
.badge-fase {
    background-color: var(--verde-pista);
    color: white;
    font-size: .85rem;
    font-weight: 700;
    border-radius: 2rem;
    padding: .3rem .9rem;
    margin-right: .3rem;
}
.badge-duracao {
    background-color: var(--amarelo-palotina);
    color: #1a1a1a;
    font-size: .85rem;
    font-weight: 700;
    border-radius: 2rem;
    padding: .3rem .9rem;
    margin-right: .3rem;
}
.badge-nivel {
    background-color: var(--terra-vermelha);
    color: white;
    font-size: .85rem;
    font-weight: 700;
    border-radius: 2rem;
    padding: .3rem .9rem;
}

/* ── Circuito ferradura (mapa) ───────────────────── */
.circuit-container {
    position: relative;
    width: 100%;
    min-height: 700px;
    margin: 2rem auto;
}

.circuit-background-image {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    opacity: .12;
    pointer-events: none;
}

.circuit-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.circuit-path {
    stroke: var(--verde-pista);
    stroke-width: 3;
    opacity: .5;
}

.circuit-connector {
    stroke: var(--amarelo-palotina);
    stroke-width: 2;
}

/* Nodos das fases */
.circuit-node {
    position: absolute;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    text-decoration: none;
    color: #2c3e50;
    transition: transform .2s;
    width: 260px;
}
.circuit-node:hover { transform: scale(1.04); color: var(--verde-pista); }

.circuit-node[data-fase="1"] { top:   3%; left:  2%; }
.circuit-node[data-fase="2"] { top:  26%; left:  0%; }
.circuit-node[data-fase="3"] { top:  52%; left:  2%; }
.circuit-node[data-fase="4"] { top:  52%; right: 2%; left: auto; }
.circuit-node[data-fase="5"] { top:  26%; right: 2%; left: auto; }
.circuit-node[data-fase="6"] { top:   3%; right: 2%; left: auto; }

.node-circle {
    width: 3.5rem; height: 3.5rem;
    background: var(--verde-pista);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(26,122,60,.4);
    transition: background .2s;
}
.circuit-node:hover .node-circle { background: var(--terra-vermelha); }

.node-number { font-size: 1.1rem; font-weight: 900; }

.node-content h5 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 .2rem;
    color: var(--verde-pista);
}
.circuit-node:hover .node-content h5 { color: var(--terra-vermelha); }

.node-description {
    font-size: .85rem;
    color: #666;
    margin: .3rem 0 0;
    line-height: 1.4;
}

/* ── Imagem de fase ──────────────────────────────── */
.img-fase {
    width: 100%;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    margin: 1.5rem 0 2rem;
    max-height: 400px;
    object-fit: cover;
}

/* ── content-section ─────────────────────────────── */
.content-section {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* ── Código Python / Console ─────────────────────── */
code {
    color: var(--terra-vermelha);
    background: #fff6df;
    border: 1px solid rgba(244, 196, 48, .45);
    border-radius: .35rem;
    padding: .1rem .35rem;
    font-family: var(--font-mono);
    font-size: .92em;
}

.console-block {
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0) 3rem),
        #111827;
    color: #d7f7c2;
    font-family: var(--font-mono);
    font-size: .95rem;
    line-height: 1.75;
    white-space: pre !important;
    tab-size: 4;
    border: 1px solid rgba(45, 168, 88, .45);
    border-left: 5px solid var(--verde-claro);
    border-radius: .9rem;
    padding: 3.25rem 1.5rem 1.5rem;
    box-shadow: 0 14px 34px rgba(17,24,39,.28);
    overflow-x: auto;
    margin: 1.75rem 0;
}
.console-block::before {
    content: "Código";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: .65rem 1rem;
    color: #f4c430;
    background: rgba(15, 23, 42, .92);
    border-bottom: 1px solid rgba(244, 196, 48, .22);
    border-radius: .9rem .9rem 0 0;
    font-family: var(--font-main);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.console-block.code-python {
    border-left-color: #7dd3fc;
}
.console-block.code-console {
    border-left-color: var(--verde-claro);
}
.console-block.code-git {
    border-left-color: #c084fc;
}
.console-block.code-markdown {
    border-left-color: #f4c430;
}
.console-block.code-python::before {
    content: "Python";
    color: #7dd3fc;
}
.console-block.code-console::before {
    content: "Console";
}
.console-block.code-git::before {
    content: "Git";
    color: #d8b4fe;
}
.console-block.code-markdown::before {
    content: "README.md";
}
.console-block .prompt { color: #7dd3fc; font-weight: 700; }
.console-block .borda  { color: #facc15; }
.console-block .enter  { color: #93c5fd; font-style: italic; }
.console-block .result { color: #fdba74; }
.console-block .comment{ color: #94a3b8; font-style: italic; }
.console-block .string { color: #fde68a; }
.console-block code {
    display: block;
    min-width: max-content;
    white-space: pre !important;
    color: inherit;
    background: transparent;
    border: 0;
    padding: 0;
    font: inherit;
    font-size: inherit;
}

/* ── Alertas customizados ────────────────────────── */
.alert-ferradura {
    background: linear-gradient(135deg, #e8f5e9, #f9fbe7);
    border-left: 5px solid var(--verde-pista);
    border-radius: .75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.alert-ferradura h4 { color: var(--verde-pista); margin-bottom: .75rem; }

.alert-palotina {
    background: linear-gradient(135deg, #fff8e1, #fffde7);
    border-left: 5px solid var(--amarelo-palotina);
    border-radius: .75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.alert-palotina h4 { color: #8a6d00; margin-bottom: .75rem; }

.alert-terra {
    background: linear-gradient(135deg, #fce4ec, #fff3e0);
    border-left: 5px solid var(--terra-vermelha);
    border-radius: .75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.alert-terra h4 { color: var(--terra-vermelha); margin-bottom: .75rem; }

/* ── Checklist items ─────────────────────────────── */
.checklist-item {
    background: white;
    border-radius: .6rem;
    padding: .8rem 1rem;
    margin-bottom: .6rem;
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    transition: background .2s;
}
.checklist-item:hover { background: var(--cinza-claro); }
.checklist-item input[type="checkbox"] {
    width: 1.1rem; height: 1.1rem;
    accent-color: var(--verde-pista);
    margin-top: .25rem;
    flex-shrink: 0;
}
.checklist-item label { cursor: pointer; margin: 0; }
.checklist-item input:checked + label { text-decoration: line-through; color: #888; }

/* ── Progresso ───────────────────────────────────── */
#progress-indicator {
    background: var(--cinza-claro);
    border: 1px solid var(--verde-claro);
    border-radius: .75rem;
    color: var(--verde-pista);
    font-weight: 700;
    padding: .75rem 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ── Botões ──────────────────────────────────────── */
.btn-ferradura {
    background-color: var(--verde-pista);
    border-color: var(--verde-pista);
    color: white;
    font-weight: 700;
    border-radius: .6rem;
}
.btn-ferradura:hover {
    background-color: var(--verde-escuro);
    border-color: var(--verde-escuro);
    color: white;
}
.btn-palotina {
    background-color: var(--amarelo-palotina);
    border-color: var(--amarelo-palotina);
    color: #1a1a1a;
    font-weight: 700;
    border-radius: .6rem;
}
.btn-palotina:hover { filter: brightness(.9); color: #1a1a1a; }

/* ── Certificado ─────────────────────────────────── */
.certificado-container {
    background: white;
    border: 6px double var(--verde-pista);
    border-radius: 1.5rem;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 8px 40px rgba(26,122,60,.15);
    position: relative;
    overflow: hidden;
}
.certificado-container::before {
    content: '🏁';
    position: absolute;
    top: 1.5rem; left: 1.5rem;
    font-size: 2rem; opacity: .3;
}
.certificado-container::after {
    content: '🏁';
    position: absolute;
    bottom: 1.5rem; right: 1.5rem;
    font-size: 2rem; opacity: .3;
}
.certificado-titulo {
    color: var(--verde-pista);
    font-size: 2.5rem;
    font-weight: 900;
    border-bottom: 3px solid var(--amarelo-palotina);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
.certificado-aluno {
    font-size: 2rem;
    font-weight: 800;
    color: var(--terra-vermelha);
    margin: 1rem 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: .5rem;
}
.certificado-codigo {
    font-family: var(--font-mono);
    background: var(--cinza-claro);
    border: 1px solid var(--verde-claro);
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: .95rem;
    color: var(--verde-pista);
    display: inline-block;
    margin-top: .5rem;
}

/* ── Flashcards ──────────────────────────────────── */
.flashcard-container { perspective: 1000px; }
.flashcard {
    background: transparent;
    cursor: pointer;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform .5s;
    border: none;
    margin-bottom: 0;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
    backface-visibility: hidden;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: absolute;
    width: 100%; height: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
}
.flashcard-front {
    background: var(--bg-grad);
    color: white;
}
.flashcard-back {
    background: white;
    color: var(--verde-pista);
    border: 2px solid var(--verde-claro);
    transform: rotateY(180deg);
}

/* ── LGPD Banner ─────────────────────────────────── */
.lgpd-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--cinza-console);
    color: #ccc;
    padding: 1rem 0;
    z-index: 9999;
    border-top: 3px solid var(--verde-pista);
}

/* ── List groups ─────────────────────────────────── */
.list-group-item {
    border-radius: .6rem !important;
    margin-bottom: .4rem;
    border: 1px solid #e0e0e0;
    font-size: 1.05rem;
}
.list-group-item:before {
    content: '🏎 ';
    margin-right: .3rem;
}

/* ── Footer ──────────────────────────────────────── */
footer {
    background-color: var(--cinza-console);
    color: #aaa;
    padding: 2rem 0;
    margin-top: 3rem;
    font-size: .95rem;
}
footer a { color: var(--verde-claro); }
footer a:hover { color: var(--amarelo-palotina); }

/* ── Navegação entre fases ───────────────────────── */
.nav-fases {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background: white;
    border-radius: .75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.nav-fases a { font-weight: 700; }

/* ── Responsivo ──────────────────────────────────── */
img { max-width: 100%; height: auto; }

@media (max-width: 1199.98px) {
    h1.hero-title { font-size: 2.5rem; }
    .hero-subtitle { font-size: 1.15rem; }
    .circuit-node { width: 220px; }
    .node-description { font-size: .8rem; }
}

@media (max-width: 991.98px) {
    body { font-size: 16px; line-height: 1.65; }

    .navbar-brand {
        font-size: 1.2rem;
        display: inline-flex;
        align-items: center;
        flex-wrap: wrap;
        gap: .25rem;
    }

    .hero-image { height: 360px; }
    .hero-overlay .container { padding-inline: 1rem; }
    h1.hero-title { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-overlay .btn {
        width: 100%;
        margin: .35rem 0 !important;
    }

    /* .btn-outline-light fora do hero — alinhado aos outros CTAs (tablet/mobile) */
    .alert-terra .btn-outline-light,
    .alert-ferradura .btn-outline-light,
    .alert-palotina .btn-outline-light,
    .nav-fases .btn-outline-light,
    .content-section .btn-outline-light,
    .lgpd-banner .btn-outline-light {
        width: 100%;
        margin: .35rem 0 !important;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }

    .content-section {
        padding: 1.5rem;
        border-radius: .85rem;
    }

    .circuit-container {
        position: static;
        min-height: 0;
        margin: 1.25rem auto;
        display: grid;
        gap: .9rem;
    }
    .circuit-background-image,
    .circuit-svg {
        display: none;
    }
    .circuit-node {
        position: relative;
        top: auto;
        right: auto;
        left: auto;
        width: 100%;
        align-items: center;
        gap: .85rem;
        padding: .9rem 1rem;
        border-radius: .9rem;
        border: 1px solid #e4e7ec;
        background: #fff;
        box-shadow: 0 3px 10px rgba(0,0,0,.06);
    }
    .node-circle {
        width: 2.9rem;
        height: 2.9rem;
    }
    .node-content h5 {
        margin-bottom: .35rem;
        font-size: .95rem;
    }
    .node-description {
        margin-top: .2rem;
        font-size: .82rem;
    }

    .console-block {
        font-size: .86rem;
        line-height: 1.6;
        border-radius: .75rem;
        padding: 2.9rem 1rem 1rem;
    }
    .console-block::before {
        font-size: .72rem;
        padding: .6rem .85rem;
    }

    .nav-fases {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
        text-align: center;
    }
    .nav-fases .btn {
        width: 100%;
    }

    .certificado-container {
        padding: 1.75rem 1.25rem;
        border-width: 4px;
    }
    .certificado-titulo { font-size: 1.85rem; }
    .certificado-aluno { font-size: 1.45rem; }

    .lgpd-banner {
        padding: .85rem 0;
    }
    .lgpd-banner .row {
        gap: .75rem;
    }
    .lgpd-banner .btn {
        width: 100%;
        margin: 0 !important;
    }

    footer {
        text-align: center;
    }
    footer .text-end {
        text-align: center !important;
    }
}

@media (max-width: 575.98px) {
    .hero-image { height: 300px; }
    h1.hero-title { font-size: 1.6rem; }
    .hero-subtitle { font-size: .95rem; }

    h2.display-5 {
        font-size: 1.75rem;
    }

    .certificado-container .row .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .certificado-container .row.text-center .col-6:not(:first-child) {
        margin-top: .75rem;
    }

    .alert-terra .btn,
    .alert-ferradura .btn,
    .alert-palotina .btn {
        width: 100%;
        margin: .35rem 0 !important;
    }

    .text-center.mt-4 > .btn {
        display: block;
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .quiz-question .form-check-label {
        overflow-wrap: anywhere;
    }

    .container,
    .container-fluid {
        padding-left: .9rem;
        padding-right: .9rem;
    }

    .badge-fase,
    .badge-duracao,
    .badge-nivel {
        display: inline-flex;
        margin: .2rem .1rem;
    }

    .btn-ferradura,
    .btn-palotina,
    .btn-outline-light {
        width: 100%;
        margin: .35rem 0 !important;
    }

    .content-section {
        padding: 1.15rem;
    }

    .certificado-container::before,
    .certificado-container::after {
        display: none;
    }
    .certificado-codigo {
        width: 100%;
        overflow-wrap: anywhere;
    }
}
