/* =====================================================================
   DT Learning Hub · hoja de estilos principal
   Paleta: tinta (azul noche), acento taller (naranja), NS (azul IB)
   ===================================================================== */

:root {
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --muted: #5b6475;
  --line: #e4e2dc;
  --surface: #f6f5f1;
  --card: #ffffff;
  --accent: #e2711d;
  --accent-ink: #b4530d;
  --accent-soft: #fdf0e4;
  --ns: #2563eb;
  --ns-soft: #e8efff;
  --red: #d64545;
  --yellow: #e0a800;
  --green: #2f9e5f;
  --blue: #2563eb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 16px rgba(20, 33, 61, .05);

  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--surface);
  --bs-primary: var(--ink);
  --bs-primary-rgb: 20, 33, 61;
  --bs-link-color: var(--ink-2);
  --bs-link-hover-color: var(--accent-ink);
  --bs-border-color: var(--line);
}

body { background: var(--surface); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--ink-2); }
a:hover { color: var(--accent-ink); }
code { color: var(--accent-ink); }

.btn { border-radius: 10px; font-weight: 500; }
.btn-lg { min-height: 48px; }
.btn-primary { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: var(--ink-2); --bs-btn-hover-border-color: var(--ink-2); --bs-btn-active-bg: var(--ink-2); }
.btn-accent { background: var(--accent); color: #fff; border: 0; letter-spacing: .02em; }
.btn-accent:hover, .btn-accent:focus { background: var(--accent-ink); color: #fff; }
.btn-icon { border: 0; font-size: 1.5rem; line-height: 1; padding: .25rem .5rem; }
.form-control, .form-select { border-radius: 10px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(226, 113, 29, .2); }
.form-narrow { max-width: 460px; }
:focus-visible { outline: 3px solid rgba(226, 113, 29, .55); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 2000; }
.skip-link:focus { left: 8px; }

/* ---------- Marca ---------- */
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: inline-grid; place-items: center; font-size: 1.35rem; flex: none; }
.brand-mark.sm { width: 36px; height: 36px; font-size: 1.1rem; border-radius: 10px; }
.brand-title { font-weight: 700; font-size: 1.1rem; }
.brand-sub { color: var(--muted); font-size: .85rem; }

/* ---------- Acceso ---------- */
.layout-auth { min-height: 100vh; background: radial-gradient(circle at 15% 10%, #fff 0, var(--surface) 55%); }
.auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 24px; }
.auth-brand { display: flex; align-items: center; gap: 12px; max-width: 440px; width: 100%; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 440px; }
.error-code { font-size: 3.5rem; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 8px; }

/* ---------- Estructura de la app ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar { background: var(--ink); color: #dfe4ee; width: 268px; flex: none; display: flex; flex-direction: column; }
@media (min-width: 992px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.app-sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--ink); --bs-offcanvas-width: 280px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 12px; }
.sidebar-brand { display: flex; gap: 10px; align-items: center; color: #fff; text-decoration: none; }
.sidebar-brand:hover { color: #fff; }
.brand-title-sm { font-weight: 700; font-size: .98rem; }
.brand-sub-sm { font-size: .75rem; color: #9fb0cc; }
.sidebar-nav { padding: 8px 10px; flex: 1; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: 12px; color: #c9d2e3; border-radius: 10px; padding: 10px 12px; font-size: .8rem; font-weight: 600; letter-spacing: .04em; min-height: 44px; }
.sidebar-nav .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(226, 113, 29, .18); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { padding: 14px 18px 20px; font-size: .78rem; color: #9fb0cc; display: flex; gap: 8px; align-items: center; border-top: 1px solid rgba(255, 255, 255, .08); }
.badge-level { background: var(--accent); color: #fff; border-radius: 6px; padding: 2px 7px; font-weight: 700; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(246, 245, 241, .92); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 1020; border-bottom: 1px solid var(--line); }
.context-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .82rem; font-weight: 600; }
.context-pill i { color: var(--accent); }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px 4px 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700; }
.app-content { padding: 24px; max-width: 1280px; width: 100%; }
@media (max-width: 575.98px) {
  .app-content { padding: 16px; }
  .app-topbar { padding: 10px 16px; }
  .topbar-context { display: none; }
}

/* ---------- Cabeceras y tarjetas ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 20px; }
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.eyebrow { font-size: .72rem; letter-spacing: .1em; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; }
.section-title { font-size: .95rem; letter-spacing: .08em; font-weight: 700; margin-bottom: 2px; }
.section-sub { color: var(--muted); font-size: .9rem; }
.card-soft { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-title-sm { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.empty-state { text-align: center; padding: 48px 24px; background: var(--card); border: 1px dashed #cfcbc0; border-radius: var(--radius); color: var(--muted); }
.empty-state > i { font-size: 2.5rem; color: var(--accent); display: block; margin-bottom: 8px; }
.credential-card { background: var(--accent-soft); border: 1px solid #f4cfa9; border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }

/* ---------- Portal del estudiante ---------- */
.course-banner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 18px; }
.course-banner-title { font-weight: 800; letter-spacing: .04em; }
.course-banner-meta { font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.here-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 24px; position: relative; overflow: hidden; }
.here-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--accent); }
.here-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.here-title { font-size: 1.9rem; font-weight: 800; margin: 4px 0 0; line-height: 1.15; }
.here-kicker { display: block; font-size: .95rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.here-name { color: var(--accent-ink); }
.milestone-chip { align-self: flex-start; display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: .85rem; }
.station-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.station { display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff; }
.station-code { font-weight: 800; font-size: 1.05rem; border: 2px solid var(--ink); border-radius: 8px; min-width: 48px; text-align: center; padding: 4px 6px; }
.station-body { flex: 1; display: flex; flex-direction: column; }
.station-label { font-weight: 700; font-size: .92rem; letter-spacing: .02em; }
.station-status { font-size: .82rem; color: var(--muted); }
.traffic { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.traffic-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 0, 0, .05); }
.light-red .traffic-dot { background: var(--red); }
.light-yellow .traffic-dot { background: var(--yellow); }
.light-green .traffic-dot { background: var(--green); }
.light-blue .traffic-dot { background: var(--blue); }
@media (max-width: 575.98px) {
  .traffic-text { display: none; }
  .here-title { font-size: 1.5rem; }
}
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 10px; }
.topic-card { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; min-height: 120px; }
.topic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d6d1c4; color: var(--ink); }
.topic-code { font-weight: 800; color: var(--accent-ink); font-size: .85rem; }
.topic-name { font-weight: 700; line-height: 1.25; }
.topic-helps { font-size: .8rem; color: var(--muted); margin-top: auto; }

/* ---------- Centro del profesor ---------- */
.priority-card { background: var(--ink); color: #fff; border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow); }
.priority-card .eyebrow { color: #ffb47a; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: rgba(255, 255, 255, .07); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.kpi-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.kpi-label { font-size: .78rem; color: #c9d2e3; margin-top: 6px; }
.kpi-warn .kpi-value { color: #ffb47a; }
.progress { height: 8px; border-radius: 99px; background: #efede7; }
.progress-bar { background: var(--accent); border-radius: 99px; }
.milestone-list li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.milestone-list li:last-child { border-bottom: 0; }

/* ---------- Nivel Superior ---------- */
.ns-badge { display: inline-block; background: var(--ns); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .06em; border-radius: 6px; padding: 2px 8px; margin-right: 6px; }
.ns-toggle { background: var(--ns-soft); border: 1px solid #c9d8ff; border-radius: 12px; padding: 12px 14px; }
.ns-notice { background: var(--ns-soft); border-left: 4px solid var(--ns); border-radius: 8px; padding: 10px 14px; }

.table > :not(caption) > * > * { padding: .7rem .8rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }

/* Pantalla interactiva: objetivos táctiles amplios */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .sidebar-nav .nav-link { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Bootstrap vuelve transparente .offcanvas-lg en escritorio: se restaura el fondo. */
@media (min-width: 992px) {
  .app-sidebar.offcanvas-lg { background-color: var(--ink) !important; }
}
@media (max-width: 575.98px) {
  .topic-card { min-height: 0; }
}
