/* ============================================================
   Digital College — Design System
   Fonte: digital-college-design-system-prompt.md
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500&display=swap');

/* ── Variáveis ──────────────────────────────────────────────
   Todas as cores e tokens do DS são definidos aqui.
   O Python não deve hardcodar nenhum desses valores em style={}.
   ──────────────────────────────────────────────────────────── */
:root {
  --color-primary:        #F25D00;
  --color-primary-dark:   #D94E00;
  --color-primary-light:  #FF7A2B;
  --color-navy:           #1A1A2E;
  --color-navy-dark:      #2C2C4A;
  --color-bg:             #1E2840;
  --color-bg-alt:         #2C2C4A;
  --color-text:           #ffffff;
  --color-text-muted:     #8ba0b4;
  --color-border:         #3A4F66;
  --color-border-light:   rgba(255, 255, 255, 0.06);
  --color-divider:        rgba(255, 255, 255, 0.08);

  --radius-btn:   4px;
  --radius-card:  12px;
  --radius-pill:  100px;

  --font-sans:  'Outfit', 'Plus Jakarta Sans', 'Segoe UI', sans-serif;

  /* Bootstrap overrides */
  --bs-primary:     #F25D00;
  --bs-primary-rgb: 242, 93, 0;
}

/* ── Base ───────────────────────────────────────────────────
   body já cobre fontFamily e background — o style={} inline
   no html.Div raiz do app.py é desnecessário e foi removido.
   ──────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans) !important;
  background-color: var(--color-navy) !important;
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.7;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans) !important;
  font-weight: 500 !important;
  color: var(--color-text) !important;
}
.app-root {
  min-height: 100vh;
  background: var(--color-navy);
}

/* ── Navbar ─────────────────────────────────────────────────
   Cobre: fundo navy, brand branco 500, padding, logo.
   ──────────────────────────────────────────────────────────── */
.dc-navbar {
  background: var(--color-navy) !important;
  padding: 10px 0;
}
.dc-navbar .navbar-logo {
  border-radius: 6px;
  margin-right: 12px;
  height: 36px;
}
.dc-navbar .navbar-brand-text {
  color: #fff;
  font-weight: 500;
  font-size: 15px;
  font-family: var(--font-sans);
}

/* ── Subtítulo de seção (substitui barra de abas) ───────────
   Imita o visual do tab ativo: fundo navy, laranja embaixo.
   ──────────────────────────────────────────────────────────── */
.section-subtitle {
  background: var(--color-bg-alt);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 20px;
  border-bottom: 2px solid var(--color-primary);
  letter-spacing: 0.02em;
}

/* ── Tabs ───────────────────────────────────────────────────
   Cobre: nav fundo branco, link cores, active laranja.
   ──────────────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-bg-alt);
  padding: 0 16px;
}
.nav-tabs .nav-link {
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  transition: color 0.2s;
  background: transparent !important;
}
.nav-tabs .nav-link:hover {
  color: var(--color-primary);
  border-bottom-color: rgba(242, 93, 0, 0.3);
}
.nav-tabs .nav-link.active {
  color: var(--color-primary) !important;
  border-bottom: 3px solid var(--color-primary) !important;
  background: transparent !important;
}

/* ── Tab shell (área de conteúdo de cada aba) ───────────────
   ──────────────────────────────────────────────────────────── */
.tab-area {
  background: var(--color-navy);
  min-height: 80vh;
}

/* Painel superior: agrupa filtros + metric cards. */
.tab-top-panel {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: 20px;
}

/* Linha de metric cards dentro do painel superior */
.tab-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 20px;
}

.tab-content-body {
  padding: 20px;
}

/* ── Filter bar ─────────────────────────────────────────────
   Fundo transparente — herda o branco do .tab-top-panel.
   ──────────────────────────────────────────────────────────── */
.filter-bar {
  background: transparent;
  padding: 20px 20px 16px;
}

/* label acima dos pills */
.filter-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  display: block;
  margin-bottom: 6px;
}

/* ── Pill filters (Bootstrap btn-check) ─────────────────────
   Cobre: pills laranja, hover, active.
   ──────────────────────────────────────────────────────────── */
.btn-outline-primary {
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  border-radius: var(--radius-pill) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  padding: 4px 14px !important;
  transition: background 0.2s, color 0.2s !important;
}
.btn-check:checked + .btn-outline-primary,
.btn-outline-primary.active,
.btn-outline-primary:hover {
  background-color: var(--color-primary) !important;
  color: #fff !important;
  border-color: var(--color-primary) !important;
}

/* ── Metric cards ────────────────────────────────────────────
   Dark panel bg, orange left accent, matches frequencia style.
   ──────────────────────────────────────────────────────────── */
.metric-card {
  background: var(--color-bg) !important;
  border: 0.5px solid var(--color-border) !important;
  border-left: 3px solid var(--color-primary) !important;
  border-radius: 8px !important;
  min-width: 180px;
}
.metric-card .card-body {
  padding: 14px 18px !important;
}
.metric-label {
  font-size: 11px;
  color: var(--color-text-muted) !important;
  margin-bottom: 4px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 5px;
}
.metric-value {
  font-size: 26px;
  font-weight: 500;
  margin: 0;
  line-height: 1.2;
  /* cor aplicada via style={"color": ...} no Python pois é dinâmica */
}

/* ── Content card (seções dark) ─────────────────────────────
   Dark card bg, orange top accent, matches frequencia style.
   ──────────────────────────────────────────────────────────── */
.content-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--radius-card);
}
.content-card--overflow {
  overflow: hidden;
}
/* header textual de um content-card */
.card-header-ds {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  padding: 14px 20px;
  border-bottom: 0.5px solid var(--color-divider);
}

/* ── Graph card (wrapper de gráfico Plotly) ─────────────────
   Dark card bg, orange top border accent.
   ──────────────────────────────────────────────────────────── */
.graph-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 2px solid var(--color-primary);
  border-radius: var(--radius-card);
  padding: 8px;
}

/* ── Turma cards (Aba 1) ─────────────────────────────────────
   borderLeft é dinâmico (cor da situação) → permanece inline.
   ──────────────────────────────────────────────────────────── */
.turma-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 16px;
  height: 100%;
  transition: box-shadow 0.2s, transform 0.15s;
}
.turma-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}
.turma-card__badge-wrapper {
  margin-bottom: 10px;
}
.turma-card__nome {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--color-text) !important;
  margin-bottom: 10px;
  min-height: 1.45em;
}
.turma-card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.turma-card__meta-text {
  font-size: 12px;
  color: var(--color-text-muted);
}
/* Linha de módulo iniciado — texto esmaecido */
.turma-card__modulo-row--started .turma-card__modulo-label,
.turma-card__modulo-row--started .turma-card__modulo-dates {
  opacity: 0.45;
}

/* Badge de status do módulo */
.turma-card__modulo-badge {
  font-size: 10px;
  font-weight: 500;
  border-radius: 100px;
  padding: 1px 7px;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
}
.turma-card__modulo-badge--started {
  color: var(--color-text-muted);
}
.turma-card__modulo-badge--open {
  color: #3B9A4F;
  background: rgba(59, 154, 79, 0.15);
}
.turma-card__progress {
  height: 6px !important;
  border-radius: 3px !important;
  background: #e9ecef !important;
  margin-bottom: 6px;
}
.turma-card__vagas {
  font-size: 11px;
  font-weight: 500;
  /* cor definida via style inline (dinâmica por ocupação) */
}

/* ── Badge de situação (Vigente, Aberta, Pré-Matrícula) ─────
   DS: 10-11px, uppercase, letter-spacing, radius 100px.
   background é dinâmico → permanece inline.
   ──────────────────────────────────────────────────────────── */
.badge-situacao {
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  line-height: 1.4;
  color: #fff;
  /* background definido via style inline no Python */
}

/* ── Sede header (Aba 1 — cabeçalho de grupo por sede) ──────
   ──────────────────────────────────────────────────────────── */
.sede-header {
  display: flex;
  align-items: center;
  padding: 0 0 12px 0;
  margin-bottom: 16px;
  border-bottom: 1.5px solid var(--color-divider);
}
.sede-header__dot {
  font-size: 10px;          /* ponto menor, mais sutil */
  margin-right: 8px;
  /* color definido inline (dinâmico por sede) */
}
.sede-header__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
  margin-right: 10px;
}
.sede-header__meta {
  font-size: 12px;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-radius: 100px;
  padding: 2px 10px;
}

/* ── Queda entre módulos (Aba 2) ────────────────────────────
   Substitui inline styles nos queda_items.
   ──────────────────────────────────────────────────────────── */
.queda-section-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 16px 8px;
}
.queda-items {
  padding: 0 16px 16px;
}
.queda-label {
  font-size: 12px;
  color: var(--color-text-muted);
}
.queda-value {
  font-size: 12px;
  font-weight: 500;
  /* color dinâmica via style inline */
}

/* ── Tabela de retenção (Aba 2) ─────────────────────────────
   Substitui inline styles em Th, Td, Tr.
   ──────────────────────────────────────────────────────────── */
.ret-table-wrap {
  max-height: 360px;
  overflow-y: auto;
}
.ret-table {
  width: 100%;
  border-collapse: collapse;
}
.ret-th {
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
}
.ret-td {
  font-size: 12px;
  padding: 7px 10px;
  color: var(--color-text);
}
.ret-td--muted {
  color: var(--color-text-muted);
}
.ret-row {
  border-bottom: 0.5px solid var(--color-border-light);
}
/* badge de % retenção */
.badge-retencao {
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  color: #fff;
  /* background dinâmico via style inline */
}
/* mini barra ao lado do badge */
.ret-minibar {
  width: 56px;
  height: 4px;
  background: #eee;
  border-radius: 2px;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}
.ret-minibar__fill {
  height: 100%;
  border-radius: 2px;
  /* width e background dinâmicos via style inline */
}

/* ── KPI blocks (Aba 4 — métricas por sede) ─────────────────
   Substitui inline styles na função _kpi().
   ──────────────────────────────────────────────────────────── */
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 12px 0;
  /* color dinâmica via style inline (cor da sede) */
}

/* ── Sede cards (Aba 4 — coluna por sede) ───────────────────
   borderTop é dinâmico (cor da sede) → permanece inline.
   ──────────────────────────────────────────────────────────── */
.sede-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px;
  height: 100%;
}
.sede-card__header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.sede-card__dot {
  font-size: 18px;
  margin-right: 8px;
  /* color dinâmica via style inline */
}
.sede-card__name {
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text) !important;
}

/* ── DataTable ───────────────────────────────────────────────
   style_cell e style_header são API do Dash DataTable e não
   podem ser substituídos por CSS externo — mantidos inline.
   ──────────────────────────────────────────────────────────── */

/* ── Estado vazio ────────────────────────────────────────────
   Substitui inline styles em _empty_state().
   ──────────────────────────────────────────────────────────── */
.empty-state {
  padding: 56px 24px;
  text-align: center;
}
.empty-state__icon {
  font-size: 36px;
}
.empty-state__msg {
  color: var(--color-text-muted) !important;
  font-size: 14px;
  margin-top: 8px;
}

/* ── Botão limpar filtros ────────────────────────────────────── */
.filter-bar__clear {
  padding-top: 22px;   /* alinha o botão com os pills (abaixo do label) */
  flex-shrink: 0;
}
.btn-clear-filters {
  background: transparent !important;
  color: var(--color-text-muted) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-pill) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 4px 14px !important;
  transition: color 0.2s, border-color 0.2s !important;
  white-space: nowrap;
}
.btn-clear-filters:hover {
  color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  background: transparent !important;
}

/* Sede no turma-card */
.turma-card__meta-sede {
  font-size: 12px;
  font-weight: 500;
  /* color dinâmica via style inline (cor da sede) */
}

/* Lista de módulos com datas */
.turma-card__dates {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.turma-card__modulo-row {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}
.turma-card__modulo-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 60px;
  flex-shrink: 0;
}
.turma-card__modulo-dates {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text);
}
.fw-500 {
  font-weight: 500 !important;
}

/* ── DARKLY bootstrap overrides ─────────────────────────────── */
/* Tab content pane background */
.tab-content { background: var(--color-navy) !important; }
/* Progress bar track */
.turma-card__progress { background: rgba(255,255,255,0.1) !important; }
/* dbc.Alert danger */
.alert-danger { background: rgba(192,57,43,0.2) !important; border-color: #C0392B !important; color: #ff8a8a !important; }
/* hr inside content cards */
hr { border-color: var(--color-divider) !important; }


/* ── Cabeçalhos de seção por disponibilidade de venda ──────────── */
.avail-section-header {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 7px 20px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.avail-section-header--open {
  background: #2E7D4F;
  color: #fff;
  box-shadow: 0 2px 12px rgba(46, 125, 79, 0.4);
}
.avail-section-header--started {
  background: #7D2E2E;
  color: #fff;
  box-shadow: 0 2px 12px rgba(125, 46, 46, 0.4);
}

/* ── Scrollbar sutil ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
