/* PRIORIDADE 2 - COMPREENSÃO E HIERARQUIA
   Carregue depois de tema-claro-prioridade-1.css */

:root {
  --p2-space-1: .5rem;
  --p2-space-2: .75rem;
  --p2-space-3: 1rem;
  --p2-space-4: 1.5rem;
  --p2-space-5: 2rem;
  --p2-radius: 14px;
}

/* 1. Dashboard: prioridade para Hoje, Progresso e Atenção */
#dashboard,
.dashboard,
[data-view="dashboard"],
[data-screen="home"] {
  display: grid;
  gap: var(--p2-space-4);
}

.p2-dashboard-summary {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, .65fr);
  gap: var(--p2-space-4);
  align-items: start;
}

.p2-today,
.p2-progress,
.p2-attention {
  background: #fff;
  border: 1px solid var(--border, #d9e3ee);
  border-radius: var(--p2-radius);
  box-shadow: var(--shadow, 0 4px 16px rgba(16,42,67,.08));
  padding: clamp(18px, 3vw, 26px);
}

.p2-today { border-top: 5px solid var(--brand-blue, #1769c2); }
.p2-progress { border-top: 5px solid var(--brand-green, #0d8069); }
.p2-attention { border-top: 5px solid #d99a00; }

.p2-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.p2-section-head h2,
.p2-section-head h3 { margin: 0; }

.p2-section-head p {
  margin: .25rem 0 0;
  max-width: 64ch;
}

.p2-task-list,
.p2-attention-list {
  display: grid;
  gap: .75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.p2-task,
.p2-attention-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .75rem;
  align-items: center;
  min-height: 58px;
  padding: .75rem 1rem;
  background: #f8fafc;
  border: 1px solid #d9e3ee;
  border-radius: 12px;
}

.p2-task__icon,
.p2-attention-item__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eaf3ff;
  color: #0b579f;
  font-weight: 900;
}

.p2-task__title,
.p2-attention-item__title {
  display: block;
  color: #172437;
  font-weight: 800;
}

.p2-task__meta,
.p2-attention-item__meta {
  display: block;
  color: #526477;
  font-size: .875rem;
}

.p2-task__action {
  min-width: 90px;
  white-space: nowrap;
}

.p2-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .75rem;
}

.p2-metric {
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #d9e3ee;
  border-radius: 12px;
}

.p2-metric strong {
  display: block;
  color: #0b2c55;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.1;
}

.p2-metric span {
  color: #526477;
  font-size: .875rem;
}

/* 2. Navegação simplificada e compreensível */
.p2-nav-label-short { display: none; }

.bottom-nav,
.mobile-nav,
[role="tablist"].main-tabs {
  background: #fff !important;
  border-top: 1px solid #d9e3ee !important;
  box-shadow: 0 -6px 20px rgba(16,42,67,.08);
}

.bottom-nav .tab,
.mobile-nav .tab,
.main-tabs [role="tab"] {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  min-width: 64px;
  min-height: 58px;
  padding: 7px 8px;
  color: #526477 !important;
  border: 0 !important;
  border-radius: 10px;
}

.bottom-nav .tab.active,
.mobile-nav .tab.active,
.main-tabs [role="tab"][aria-selected="true"] {
  color: #0b2c55 !important;
  background: #eaf3ff !important;
  font-weight: 800;
}

.bottom-nav .tab.active::after,
.mobile-nav .tab.active::after,
.main-tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 3px;
  height: 3px;
  border-radius: 3px;
  background: #1769c2;
}

/* 3. Status: texto + ícone + cor */
.p2-status,
.status-badge,
.topic-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 32px;
  padding: .35rem .65rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: .82rem;
  line-height: 1;
  font-weight: 800;
}

.p2-status::before,
.status-badge::before,
.topic-status::before {
  width: 1.1em;
  text-align: center;
  font-weight: 900;
}

[data-status="nao-iniciado"]::before,
.status-nao-iniciado::before,
.status-not-started::before { content: "○"; }

[data-status="estudando"]::before,
.status-estudando::before,
.status-studying::before { content: "✎"; }

[data-status="revisao"]::before,
.status-revisao::before,
.status-review::before { content: "◷"; }

[data-status="concluido"]::before,
.status-concluido::before,
.status-complete::before { content: "✓"; }

/* 4. Espaçamento e hierarquia */
.page-section,
.content-section,
.dashboard-section,
.study-section {
  margin-block: var(--p2-space-5);
}

.card-grid,
.subject-grid,
.topic-grid,
.dashboard-grid {
  gap: var(--p2-space-3) !important;
}

.card,
.panel,
.topic-card,
.subject-card,
.question-card,
.flashcard {
  padding: clamp(16px, 2.5vw, 24px) !important;
}

.card + .card,
.panel + .panel { margin-top: var(--p2-space-3); }

/* 5. Ação principal e ações secundárias */
.p2-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-top: 1rem;
}

.p2-action-bar .primary,
.p2-action-bar .btn-primary,
.p2-action-bar .button-primary { order: -1; }

.p2-action-bar .secondary,
.p2-action-bar .btn-secondary,
.p2-action-bar .button-secondary {
  background: #fff !important;
  color: #0b2c55 !important;
  border-color: #aebfd1 !important;
}

/* Indicação textual de conclusão, sem depender só de cor */
.p2-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: .4rem;
  color: #172437;
  font-weight: 700;
}

/* Foco preservado */
.p2-task:focus-within,
.p2-attention-item:focus-within,
.p2-metric:focus-within {
  outline: 3px solid #ffbf00;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .p2-dashboard-summary { grid-template-columns: 1fr; }
  .p2-metrics { grid-template-columns: 1fr 1fr; }
  .p2-task,
  .p2-attention-item { grid-template-columns: auto 1fr; }
  .p2-task__action { grid-column: 1 / -1; width: 100%; }
  .p2-nav-label-long { display: none; }
  .p2-nav-label-short { display: inline; }
}

@media (max-width: 430px) {
  .p2-metrics { grid-template-columns: 1fr; }
  .bottom-nav .tab,
  .mobile-nav .tab,
  .main-tabs [role="tab"] { min-width: 56px; font-size: .76rem; }
}
