/* =========================================================
   VARIÁVEIS GLOBAIS
========================================================= */

:root {
    --blue: #0f6feb;
    --blue2: #0ea5e9;

    --bg: #f5f8fc;
    --card: #ffffff;
    --text: #172033;
    --muted: #7b8798;
    --border: #e6ebf2;

    --shadow: 0 10px 30px rgba(15, 111, 235, .08);
    --radius: 6px;

    --green: #17b26a;
    --yellow: #f4b740;
    --red: #ef4444;

    --sidebar: #ffffff;
    --top: #0f6feb;
}


/* =========================================================
   TEMA ESCURO
========================================================= */

html[data-theme="dark"] {
    --bg: #0d1320;
    --card: #111827;
    --text: #f8fafc;
    --muted: #aab4c4;
    --border: #1f2a3b;

    --shadow: 0 10px 30px rgba(0, 0, 0, .25);

    --sidebar: #0f172a;
    --top: #0b5bd3;
}


/* =========================================================
   RESET / BASE
========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}


/* =========================================================
   TOPO / TOPBAR
========================================================= */

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 20;

    height: 58px;
    padding: 0 22px;

    display: flex;
    align-items: center;
    gap: 12px;

    color: #ffffff;
    background: linear-gradient(135deg, var(--top), var(--blue2));
    box-shadow: var(--shadow);
}

.brand-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
}

.top-actions {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 10px;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    position: fixed;
    top: 58px;
    left: 0;
    bottom: 0;
    z-index: 15;

    width: 244px;

    background: var(--sidebar);
    border-right: 1px solid var(--border);

    overflow: auto;
    transition: .25s;
}

.profile-box {
    padding: 22px 18px;

    display: flex;
    align-items: center;
    gap: 12px;

    border-bottom: 1px solid var(--border);
}

.profile-box strong {
    display: block;
    font-size: 14px;
}

.profile-box span {
    font-size: 12px;
    color: var(--muted);
}

.sidebar nav {
    padding: 12px;
}

.sidebar nav a {
    margin-bottom: 4px;
    padding: 13px 12px;

    display: flex;
    align-items: center;
    gap: 12px;

    border-radius: var(--radius);

    color: var(--muted);
    font-size: 14px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--blue);
    background: rgba(15, 111, 235, .08);
}

.sidebar nav a.logout:hover {
    color: var(--red);
    background: rgba(239, 68, 68, .08);
}


/* =========================================================
   AVATAR
========================================================= */

.avatar {
    width: 34px;
    height: 34px;

    display: inline-grid;
    place-items: center;

    border-radius: 50%;

    background: #477cff;
    color: var(--blue);

    font-weight: 800;
    align-content: center;
}

.avatar.big {
    width: 48px;
    height: 42px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--blue), var(--blue2));
    align-content: center;
}


/* =========================================================
   CONTEÚDO PRINCIPAL
========================================================= */

.content {
    min-height: 100vh;
    margin-left: 244px;
    padding: 86px 26px 36px;
}

.page-title {
    margin-bottom: 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.page-title h1 {
    margin: 0;
    font-size: 24px;
}


/* =========================================================
   GRIDS
========================================================= */

.grid {
    display: grid;
    gap: 18px;
}

.grid.cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.course-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}


/* =========================================================
   CARDS
========================================================= */

.card {
    padding: 18px;

    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat .icon {
    width: 58px;
    height: 58px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    color: #ffffff;
    font-size: 22px;
    background: linear-gradient(135deg, var(--blue), var(--blue2));
}

.stat strong {
    font-size: 30px;
}

.stat span {
    display: block;

    margin-top: 2px;

    color: var(--muted);
    font-size: 13px;
}


/* =========================================================
   BOTÕES
========================================================= */

.btn {
    padding: 11px 14px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border: 0;
    border-radius: var(--radius);

    background: var(--blue);
    color: #ffffff;

    font-weight: 700;
    cursor: pointer;
}

.btn:hover {
    filter: brightness(.96);
}

.btn.ghost {
    color: #0f99ea;
    background: rgba(15, 111, 235, .08);
}

.btn.small {
    padding: 8px 10px;
    font-size: 13px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 100px;
    color: inherit;
    background: rgba(255, 255, 255, .18);
    cursor: pointer;
    padding-top: 3px;
}

.inline {
    display: inline;
}


/* =========================================================
   ALERTAS
========================================================= */

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--card);
}

.alert.success {
    color: #166534;
    border-color: #86efac;
    background: #f0fdf4;
}

.alert.error {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}


/* =========================================================
   CURSOS
========================================================= */

.course-card {
    padding: 0;
    overflow: hidden;
}

.course-card img,
.course-thumb {
    width: 100%;
    height: 150px;

    display: block;

    object-fit: cover;
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
}

.course-card .body {
    padding: 14px;
}

.course-card h3 {
    margin: 0 0 8px;

    font-size: 15px;
    line-height: 1.35;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    color: var(--muted);
    font-size: 12px;
}

.badge {
    padding: 5px 9px;

    display: inline-flex;
    align-items: center;
    gap: 5px;

    border-radius: 999px;

    color: var(--blue);
    background: rgba(15, 111, 235, .08);

    font-size: 12px;
    font-weight: 700;
}


/* =========================================================
   LISTAS OCULTAS / MINI LISTAS
========================================================= */

.hidden-list {
    display: none;
    margin-top: 14px;
}

.hidden-list.open {
    display: block;
}

.mini-list {
    display: grid;
    gap: 8px;
}

.mini-list a {
    padding: 10px;

    display: flex;
    justify-content: space-between;
    gap: 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--bg);
}


/* =========================================================
   PROGRESSO CIRCULAR
========================================================= */

.circle-progress {
    --p: 0;

    position: relative;

    width: 94px;
    height: 94px;
    margin: auto;

    display: grid;
    place-items: center;

    border-radius: 50%;
    background: conic-gradient(
        var(--blue) calc(var(--p) * 1%),
        rgba(148, 163, 184, .18) 0
    );
}

.circle-progress::before {
    content: "";

    position: absolute;
    inset: 9px;

    border-radius: 50%;
    background: var(--card);
}

.circle-progress span {
    position: relative;

    font-size: 20px;
    font-weight: 800;
}

.circle-progress.green {
    background: conic-gradient(
        var(--green) calc(var(--p) * 1%),
        rgba(148, 163, 184, .18) 0
    );
}

.circle-progress.yellow {
    background: conic-gradient(
        var(--yellow) calc(var(--p) * 1%),
        rgba(148, 163, 184, .18) 0
    );
}

.circle-progress.red {
    background: conic-gradient(
        var(--red) calc(var(--p) * 1%),
        rgba(148, 163, 184, .18) 0
    );
}

.progress-card {
    text-align: center;
}

.progress-card small {
    display: block;
    margin-top: 8px;

    color: var(--muted);
}


/* =========================================================
   ÁREA DE AULAS / APRENDIZAGEM
========================================================= */

.learning-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: start;
}

.learn-menu,
.lesson-nav {
    position: sticky;
    top: 78px;
}

.lesson-content {
    font-size: 16px;
    line-height: 1.75;
}

.lesson-content img {
    max-width: 100%;
    border-radius: var(--radius);
}

.lesson-actions {
    margin-top: 22px;

    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.locked {
    opacity: .45;
    pointer-events: none;
}

.lesson-link {
    display: block;

    margin-bottom: 8px;
    padding: 10px;

    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.lesson-link.done {
    color: #166534;
    border-color: #86efac;
    background: #f0fdf4;
}

.lesson-link.current {
    border-color: var(--blue);
    background: rgba(15, 111, 235, .08);
}


/* =========================================================
   TABELAS
========================================================= */

.table-wrap {
    overflow: auto;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    background: var(--card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 12px;

    border-bottom: 1px solid var(--border);

    text-align: left;
    font-size: 14px;
}

th {
    color: var(--muted);
    background: rgba(15, 111, 235, .06);

    font-weight: 800;
}


/* =========================================================
   FORMULÁRIOS
========================================================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-control {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-control label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.form-control input,
.form-control select,
.form-control textarea {
    width: 100%;
    padding: 11px 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius);

    color: var(--text);
    background: var(--card);
}


/* =========================================================
   UTILITÁRIOS
========================================================= */

.only-mobile {
    display: none;
}


/* =========================================================
   RESPONSIVO - TABLET
========================================================= */

@media (max-width: 1100px) {
    .course-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .learning-layout {
        grid-template-columns: 1fr;
    }

    .learn-menu,
    .lesson-nav {
        position: static;
    }
}


/* =========================================================
   RESPONSIVO - MOBILE
========================================================= */

@media (max-width: 760px) {
    .only-mobile {
        display: inline-grid;
    }

    .sidebar {
        transform: translateX(-105%);
    }

    body.sidebar-open .sidebar {
        transform: none;
    }

    .content {
        margin-left: 0;
        padding: 78px 14px 28px;
    }

    .grid.cards,
    .course-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar {
        padding: 0 12px;
    }

    .topbar strong {
        font-size: 14px;
    }

    .btn {
        width: 100%;
    }

    .top-actions .btn {
        width: auto;
    }

    .course-card img,
    .course-thumb {
        height: 180px;
    }
}
/* =========================================================
   BUSCA, FILTROS E CATEGORIAS DE CURSOS
========================================================= */

.course-search-card {
    padding: 16px;
}

.course-search-bar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 240px auto auto;
    gap: 12px;
    align-items: center;
}

.search-input-wrap {
    position: relative;
}

.search-input-wrap i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--muted);
    transform: translateY(-50%);
}

.search-input-wrap input {
    width: 100%;
    min-height: 45px;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    outline: none;
}

.search-input-wrap input:focus,
.course-category-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(15, 111, 235, .11);
}

.course-category-select {
    width: 100%;
    min-height: 45px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    outline: none;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.filter-pill:hover,
.filter-pill.active {
    border-color: rgba(15, 111, 235, .25);
    background: rgba(15, 111, 235, .08);
    color: var(--blue);
}

.course-section {
    margin-bottom: 26px;
}

.course-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.course-section-title span {
    display: block;
    font-size: 19px;
    font-weight: 800;
}

.course-section-title small {
    color: var(--muted);
    font-weight: 700;
}

.course-card-modern {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.course-card-link {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.course-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 999px;
    background: rgba(15, 111, 235, .08);
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-favorite-form {
    padding: 0 14px 14px;
}

.favorite-button {
    width: 100%;
}

.empty-card {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 220px;
    text-align: center;
    color: var(--muted);
}

.empty-card i {
    font-size: 34px;
    color: var(--blue);
}

.empty-card strong {
    color: var(--text);
    font-size: 18px;
}

@media (max-width: 980px) {
    .course-search-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .course-search-bar {
        grid-template-columns: 1fr;
    }
}
