@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ─── TOKENS ─── */
:root {
    --white: #ffffff;
    --page-bg: #f3f4f8;
    --sidebar-bg: #0c0e1a;
    --sidebar-hover: #1a1d2e;
    --sidebar-border: #1e2236;
    --sidebar-text: #8892b0;
    --sidebar-muted: #4a5178;
    --indigo: #4353ff;
    --indigo-dark: #2d3bcc;
    --indigo-light: #eef0ff;
    --indigo-mid: #c7ccff;
    --ink: #0c0e1a;
    --ink-2: #2d3150;
    --ink-3: #5a6082;
    --ink-4: #8892b0;
    --green: #10b981;
    --green-light: #ecfdf5;
    --green-border: #6ee7b7;
    --border: #dde1ee;
    --border-strong: #c4c9df;
    --shadow-xs: 0 1px 2px rgba(12,14,26,.04);
    --shadow-sm: 0 2px 8px rgba(12,14,26,.06),0 1px 3px rgba(12,14,26,.04);
    --shadow-md: 0 8px 24px rgba(12,14,26,.08),0 2px 8px rgba(12,14,26,.04);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --font: 'Sora', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --nav-h: 58px;
    --bnav-h: 64px;
    --sidebar-w: 280px;
    --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ─── RESET ─── */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; -webkit-text-size-adjust:100%; }
body.platform-page {
    background: var(--page-bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ─── NAVBAR ─── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--nav-h);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    padding-top: env(safe-area-inset-top, 0);
}
.nav-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 0.75rem;
}
.logo-container .logo-link {
    display: flex; align-items: center; gap: 0.6rem;
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    transition: var(--transition);
}
.logo-container .logo-link:hover {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.1);
}
.logo-img { height: 26px; width: auto; display: block; }
.logo-text { font-size: 1rem; font-weight: 800; color: #fff; letter-spacing: -.5px; }

/* Progress – compact pill in navbar */
.progress-section { flex: 1; display: flex; justify-content: flex-end; }
.progress-widget {
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.85rem;
    display: flex; flex-direction: column; gap: 4px;
    min-width: 110px; max-width: 180px; width: 100%;
}
.progress-meta {
    display: flex; justify-content: space-between; align-items: center;
}
#progress-sub { font-size: 0.6rem; font-weight: 600; color: rgba(255,255,255,.5); }
#progress-pct {
    font-family: var(--font-mono);
    font-size: 0.85rem; font-weight: 900; color: #fff;
    letter-spacing: -.5px; line-height: 1;
}
.progress-bar {
    width: 100%; height: 5px;
    background: rgba(255,255,255,.08);
    border-radius: 99px; overflow: hidden;
}
#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4353ff, #818cf8);
    border-radius: 99px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ─── SIDEBAR OVERLAY ─── */
.sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(12,14,26,.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 900;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; }

/* ─── LAYOUT ─── */
.layout {
    padding-top: var(--nav-h);
    min-height: 100dvh;
    display: flex;
}

/* ─── SIDEBAR ─── */
.sidebar {
    position: fixed;
    top: var(--nav-h); bottom: 0; left: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto; overflow-x: hidden;
    z-index: 950;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    padding: 0;
    /* Safe area for notches */
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.sidebar.open { transform: translateX(0); }
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 10px; }

.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1rem 0.5rem;
    position: sticky; top: 0;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 0.5rem;
    z-index: 1;
}
.sidebar-title {
    font-family: var(--font-mono);
    font-size: 0.58rem; font-weight: 700;
    color: var(--sidebar-muted);
    text-transform: uppercase; letter-spacing: .1em;
}
.sidebar-close-btn {
    background: transparent; border: none; cursor: pointer;
    color: var(--sidebar-muted); padding: 0.25rem;
    border-radius: 6px; display: flex; align-items: center;
    transition: var(--transition);
}
.sidebar-close-btn:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-close-btn i { width: 16px; height: 16px; }

.levels-nav { display: flex; flex-direction: column; gap: 3px; padding: 0 0.75rem 1rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    font-weight: 600; font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item:active { transform: scale(0.98); }
.nav-item.active { background: rgba(67,83,255,.15); color: #a5b4fc; font-weight: 700; }
.nav-item .level-num { font-size: 0.6rem; opacity: .6; font-family: var(--font-mono); }

/* ─── MAIN CONTENT ─── */
.content {
    flex: 1;
    padding: 1rem;
    padding-bottom: calc(var(--bnav-h) + 1rem + env(safe-area-inset-bottom, 0px));
    background: var(--page-bg);
    min-height: 100%;
    width: 100%;
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bnav-h);
    background: var(--sidebar-bg);
    border-top: 1px solid var(--sidebar-border);
    display: flex; align-items: center; justify-content: space-around;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bnav-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 0.4rem 1.5rem;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-size: 0.58rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    cursor: pointer; border: none; background: transparent;
    font-family: var(--font);
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.bnav-btn i { width: 22px; height: 22px; }
.bnav-btn.active { color: #a5b4fc; }
.bnav-btn.active i { color: var(--indigo); }
.bnav-btn:active { transform: scale(0.92); }

/* ─── HERO BANNERS ─── */
.hero-banner {
    background: linear-gradient(135deg, #0c0e1a 0%, #1a1d3a 60%, #0f1627 100%);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    position: relative; overflow: hidden;
    border: 1px solid rgba(67,83,255,.2);
}
.hero-banner.extras {
    background: linear-gradient(135deg, #0c0e1a 0%, #0f1a2e 60%, #0c0e1a 100%);
    border-color: rgba(16,185,129,.2);
}
.hero-badge {
    display: inline-flex; align-items: center; gap: .4rem;
    background: rgba(67,83,255,.15);
    border: 1px solid rgba(67,83,255,.3);
    border-radius: 99px; padding: .25rem .75rem;
    margin-bottom: .75rem;
}
.hero-badge.extras { background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.25); }
.hero-badge span {
    font-family: var(--font-mono); font-size: .6rem; font-weight: 700;
    color: #a5b4fc; letter-spacing: .08em; text-transform: uppercase;
}
.hero-badge.extras span { color: #6ee7b7; }
.hero-banner-title {
    font-size: 1.65rem; font-weight: 900; color: #fff;
    letter-spacing: -1px; line-height: 1.15; margin-bottom: .75rem;
}
.hero-banner-title.module { font-size: 1.45rem; margin-bottom: .5rem; }
.hero-banner-title.extras { font-size: 1.5rem; margin-bottom: .5rem; }
.hero-banner-desc { font-size: .85rem; color: #8892b0; line-height: 1.65; margin-bottom: 1.25rem; }
.hero-banner-desc.module, .hero-banner-desc.extras { margin: 0; font-size: .82rem; }
.hero-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; text-align: center; }
.stat-divider { display: none; }

/* ─── SECTION TITLE ─── */
.section-title {
    font-size: .62rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: .1em; color: var(--ink-4);
    margin: 2rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: .5rem;
    display: flex; align-items: center; gap: .5rem;
}
.section-title i { width: .85rem; height: .85rem; color: var(--indigo); }
.section-title:first-of-type { margin-top: 0; }

/* ─── SECTION BLOCKS ─── */
.section { margin-bottom: 2rem; }
.section:last-child { margin-bottom: 0; }

/* ─── RESOURCE GRID ─── */
.resource-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.resource-card {
    background: white; padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 0.9rem;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.resource-card:active { transform: scale(0.99); }
.resource-card.completed {
    background: linear-gradient(135deg,#fff 0%,#f4fdf8 100%);
    border-color: #6ee7b7; position: relative; overflow: hidden;
}
.resource-card.completed::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
    background: #10b981;
    border-radius: 0 4px 4px 0;
}
.resource-card.completed h4 { color: var(--ink-2); }
.resource-card.completed p { color: var(--ink-4); }
.resource-card.completed .channel-tag { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }

/* Challenge card */
.resource-card.challenge-card {
    border: 1.5px solid #fca5a5;
    padding-left: 1.75rem;
    position: relative; overflow: hidden;
}
.resource-card.challenge-card::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 5px;
    background: linear-gradient(180deg,#ef4444 0%,#dc2626 100%);
}
.challenge-tag { background: #ef4444 !important; color: white !important; border-color: #dc2626 !important; box-shadow: 0 2px 8px rgba(239,68,68,.3); }
.resource-card.challenge-card.completed { background: var(--green-light); border-color: var(--green-border); }
.resource-card.challenge-card.completed::before { background: linear-gradient(180deg,#10b981 0%,#059669 100%); }
.resource-card.challenge-card.completed .challenge-tag { background: var(--green) !important; border-color: #059669 !important; }

.channel-tag {
    font-family: var(--font-mono); font-size: .58rem; font-weight: 700;
    color: var(--indigo); background: var(--indigo-light);
    padding: .2rem .55rem; border-radius: 99px;
    border: 1px solid var(--indigo-mid);
}
.card-top { display: flex; justify-content: space-between; align-items: center; }
.resource-card h4 { font-size: .95rem; font-weight: 800; color: var(--ink); line-height: 1.3; }
.resource-card p { font-size: .82rem; color: var(--ink-3); line-height: 1.6; flex: 1; }
.card-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: .75rem; border-top: 1px solid var(--border);
    margin-top: auto; gap: .75rem; flex-wrap: wrap;
}

/* ─── USEFUL LINKS ─── */
.links-inline-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.useful-link-card {
    background: white;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    text-decoration: none;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.useful-link-card:active { transform: scale(0.99); }
.link-content {
    flex: 1;
    padding-right: 0.5rem;
}
.link-content strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 6px;
    line-height: 1.35;
    transition: color 0.2s ease;
}
.link-content span {
    display: block;
    font-size: 0.8rem;
    color: var(--ink-3);
    line-height: 1.5;
}
.useful-link-card i {
    color: var(--ink-4);
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
    margin-top: 2px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

/* ─── BUTTONS ─── */
.btn-primary {
    background: var(--indigo); color: white;
    padding: .55rem 1.1rem; border-radius: 8px;
    font-weight: 700; font-size: .78rem;
    text-decoration: none; transition: .2s;
    display: inline-flex; align-items: center; gap: .4rem;
    cursor: pointer; border: none; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn-primary:active { background: var(--indigo-dark); transform: scale(0.97); }
.checkbox-wrap {
    display: flex; align-items: center; gap: .6rem;
    cursor: pointer; font-size: .75rem; font-weight: 600;
    color: var(--ink-4);
    -webkit-tap-highlight-color: transparent;
    padding: 0.5rem; margin: -0.5rem; /* Aumenta a área de toque */
    min-height: 44px;
}
.checkbox-wrap input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--indigo); }

/* ─── MODAL (bottom sheet on mobile) ─── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(12,14,26,.75);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; justify-content: center; align-items: flex-end;
    opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal-container {
    background: #fff; width: 100%; max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 40px rgba(12,14,26,.25);
    transform: translateY(40px);
    transition: transform .3s cubic-bezier(0.25,.8,.25,1);
    display: flex; flex-direction: column;
    max-height: 92dvh;
    border: 1px solid rgba(0,0,0,.05);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
.modal-overlay.active .modal-container { transform: translateY(0); }
.modal-drag-handle {
    width: 36px; height: 4px;
    background: #dde1ee; border-radius: 99px;
    margin: .75rem auto 0; flex-shrink: 0;
}
.modal-header {
    padding: 1.1rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: flex-start;
    background: linear-gradient(180deg,#fafbfc 0%,#fff 100%);
    flex-shrink: 0;
}
.modal-title-group { display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.badge-challenge {
    font-family: var(--font-mono); font-size: .6rem; font-weight: 700;
    color: #f59e0b; background: #fffbeb;
    padding: .2rem .6rem; border-radius: 99px;
    border: 1px solid #fcd34d; align-self: flex-start;
}
.modal-header h2 { font-size: 1.15rem; font-weight: 800; color: var(--ink); line-height: 1.25; }
.btn-close-modal {
    background: transparent; border: none; cursor: pointer;
    color: var(--ink-4); transition: var(--transition);
    padding: .4rem; border-radius: 50%; flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.btn-close-modal:hover { color: var(--ink); background: var(--page-bg); }
.btn-close-modal i { width: 20px; height: 20px; }
.modal-body {
    padding: 1.1rem 1.25rem;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    font-size: .93rem; color: var(--ink-2); line-height: 1.8;
    flex: 1;
}
.modal-body h3 { font-size: 1.05rem; font-weight: 800; color: var(--ink); margin: 1.5rem 0 .65rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border); }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 1rem; }
.modal-body ul,.modal-body ol { margin-left: 1.25rem; margin-bottom: 1.1rem; padding-left: .5rem; }
.modal-body li { margin-bottom: .45rem; }
.modal-body code { background: #f1f3f9; color: #db2777; padding: .15rem .35rem; border-radius: 4px; font-family: var(--font-mono); font-size: .82em; font-weight: 600; }
.modal-body pre { background: var(--ink); color: #e2e8f0; padding: 1rem; border-radius: var(--radius-md); overflow-x: auto; margin-bottom: 1.1rem; font-size: .82rem; }
.modal-body pre code { background: transparent; color: inherit; padding: 0; font-weight: normal; }
.modal-body blockquote { border-left: 4px solid var(--indigo); background: var(--indigo-light); padding: .75rem 1.1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 1rem; color: var(--ink-2); font-style: italic; }
.modal-footer {
    padding: .9rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: .6rem;
    background: #f9fafb; flex-shrink: 0;
}
.modal-footer button { width: 100%; justify-content: center; padding: .8rem; }
.btn-secondary {
    background: white; color: var(--ink-2);
    border: 1px solid var(--border-strong);
    padding: .6rem 1.25rem; border-radius: 8px;
    font-weight: 700; font-size: .8rem;
    cursor: pointer; transition: var(--transition);
    font-family: var(--font);
    -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active { background: var(--page-bg); }

/* ─── TABLET & DESKTOP ─── */
@media (min-width: 768px) {
    :root { --nav-h: 68px; }

    .nav-inner { padding: 0 2rem; }
    .logo-img { height: 30px; }
    .logo-text { font-size: 1.1rem; }
    .progress-widget { max-width: 280px; padding: .6rem 1.1rem; }
    #progress-pct { font-size: 1.35rem; }
    #progress-sub { font-size: .65rem; }

    /* Sidebar: permanent, scroll with page */
    .sidebar {
        position: sticky;
        top: var(--nav-h);
        height: calc(100dvh - var(--nav-h));
        transform: none !important;
        flex-shrink: 0;
        width: var(--sidebar-w);
        min-width: var(--sidebar-w);
    }
    .sidebar-close-btn { display: none; }
    .sidebar-overlay { display: none !important; }
    .bottom-nav { display: none; }

    .layout { align-items: flex-start; }
    .content {
        padding: 2rem;
        padding-bottom: 2rem;
    }

    .hero-banner { padding: 2.5rem; border-radius: var(--radius-xl); }
    .hero-banner-title { font-size: 2.2rem; }
    .hero-banner-title.module { font-size: 1.9rem; }
    .hero-banner-desc { font-size: .95rem; }
    .hero-stats-row { gap: 2.5rem; }

    .resource-grid { grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 1.25rem; }
    .links-inline-grid { grid-template-columns: repeat(auto-fill,minmax(320px,1fr)); }
    .resource-card { padding: 1.5rem; }
    .resource-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--indigo-mid); }
    .resource-card.challenge-card:hover { border-color: #ef4444; box-shadow: 0 12px 32px rgba(239,68,68,.14); }
    .useful-link-card:hover {
        border-color: var(--indigo);
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
        background: linear-gradient(135deg, #ffffff 0%, #f9faff 100%);
    }
    .useful-link-card:hover strong {
        color: var(--indigo);
    }
    .useful-link-card:hover i {
        transform: translate(3px, -3px);
        color: var(--indigo);
    }

    .hero-stats-row { display: flex; gap: 2.5rem; text-align: left; }
    .stat-divider { display: block; width: 1px; background: rgba(255,255,255,.08); }

    .section { margin-bottom: 2.5rem; }
    .section-title { margin: 2.5rem 0 1.5rem; }

    /* Modal: centered dialog */
    .modal-overlay { align-items: center; }
    .modal-container {
        width: 90%; max-width: 760px;
        border-radius: var(--radius-xl);
        max-height: 85vh;
        transform: translateY(20px);
        padding-bottom: 0;
    }
    .modal-drag-handle { display: none; }
    .modal-header { padding: 1.75rem 2.25rem 1.25rem; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
    .modal-header h2 { font-size: 1.5rem; }
    .modal-body { padding: 1.75rem 2.25rem; }
    .modal-footer { padding: 1.25rem 2.25rem; flex-direction: row; justify-content: flex-end; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
    .modal-footer button { width: auto; }
}

@media (min-width: 1280px) {
    .hero-banner { padding: 3rem; }
    .hero-banner-title { font-size: 2.6rem; }
    .hero-banner-desc { font-size: 1rem; max-width: 560px; }
    .content { padding: 3rem; }
}

/* ─── VIEW TRANSITIONS API ─────────────────────────────────────────────────── */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
}

::view-transition-old(root) {
    animation-name: fade-out, slide-to-left;
}

::view-transition-new(root) {
    animation-name: fade-in, slide-from-right;
}

@keyframes fade-in {
    from { opacity: 0; }
}

@keyframes fade-out {
    to { opacity: 0; }
}

@keyframes slide-from-right {
    from { transform: translateX(50px); }
}

@keyframes slide-to-left {
    to { transform: translateX(-50px); }
}