/* ──────────────────────────────────────────────────────────────────────────
   Research-grade components (PLATFORM_PLAN.md §1.2, §2.1)
   ────────────────────────────────────────────────────────────────────────── */

/* ─── Hero "Continue Learning" — 30% viewport ─── */
.cl-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-sm);
}
.cl-hero-cover {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
}
.cl-hero-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(0,0,0,0.25));
}
.cl-hero-cover-overlay {
  position: absolute; inset: 0;
  background: radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,0.18), transparent 60%);
}
.cl-hero-letter {
  font-size: 88px;
  font-weight: 800;
  letter-spacing: -0.04em;
  position: relative;
  z-index: 1;
  opacity: 0.95;
}
.cl-hero-body {
  padding: var(--s-6) var(--s-7);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.cl-hero-eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-primary-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.cl-pulse {
  width: 8px; height: 8px;
  background: var(--c-primary);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 0 rgba(30,58,138, 0.5);
  animation: cl-pulse 2s ease-out infinite;
}
@keyframes cl-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(30,58,138, 0.5); }
  100% { box-shadow: 0 0 0 14px rgba(30,58,138, 0); }
}
.cl-hero-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  margin: 4px 0 var(--s-2);
  color: var(--c-text);
}
.cl-hero-next {
  font-size: var(--fs-md);
  color: var(--c-text);
  line-height: var(--lh-normal);
  margin-bottom: var(--s-4);
}
.cl-hero-next-label {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-right: 4px;
}
.cl-hero-duration {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  margin-left: 8px;
}
.cl-hero-progress {
  height: 8px;
  background: var(--c-surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--s-2);
}
.cl-hero-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #2563eb);
  border-radius: 999px;
  transition: width var(--t-normal) var(--e-out);
}
.cl-hero-progress-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: var(--s-2);
  margin-bottom: var(--s-5);
}
.cl-hero-pct {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--c-primary-text);
  line-height: 1;
}
.cl-hero-progress-text {
  font-size: var(--fs-sm);
  color: var(--c-text-muted);
}
.cl-hero-cta {
  align-self: flex-start;
  padding: 12px 24px;
}
.cl-hero-empty .cl-hero-cover { min-height: 200px; }

@media (max-width: 800px) {
  .cl-hero { grid-template-columns: 1fr; }
  .cl-hero-cover { min-height: 160px; }
  .cl-hero-letter { font-size: 64px; }
  .cl-hero-body { padding: var(--s-5); }
}

/* ─── Section header ─── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}
.section-header h2 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
}
.link-subtle {
  color: var(--c-primary-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  text-decoration: none;
}
.link-subtle:hover { text-decoration: underline; }

/* ─── Deadline cards (compliance) ─── */
.deadline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-3);
}
.deadline-card {
  display: block;
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--c-text);
  border-left-width: 4px;
  transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.deadline-card:hover { box-shadow: var(--sh-md); transform: translateY(-1px); text-decoration: none; }
.deadline-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-2);
  font-size: var(--fs-xs);
}
.deadline-badge {
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.deadline-type {
  color: var(--c-text-muted);
}
.deadline-title {
  font-weight: var(--fw-medium);
  font-size: var(--fs-md);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deadline-date {
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
.deadline-ok { border-left-color: #10b981; }
.deadline-ok .deadline-badge { color: #047857; }
.deadline-warning { border-left-color: #f59e0b; background: #fffbeb; }
.deadline-warning .deadline-badge { color: #92400e; }
.deadline-critical { border-left-color: #ef4444; background: #fef2f2; }
.deadline-critical .deadline-badge { color: #b91c1c; }
.deadline-overdue { border-left-color: #7f1d1d; background: #fee2e2; }
.deadline-overdue .deadline-badge { color: #7f1d1d; }

/* ─── My courses grid (2×2 on desktop, research §2.1) ─── */
.my-course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-4);
}
.my-course-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--t-base), transform var(--t-base);
}
.my-course-card:hover { box-shadow: var(--sh-md); transform: translateY(-2px); }
.my-course-card--required { border-color: rgba(239, 68, 68, 0.4); }
.my-course-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  overflow: hidden;
}
.my-course-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.2));
}
.my-course-letter {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  opacity: 0.95;
  position: relative;
  z-index: 1;
}
.my-course-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.my-course-tag--required {
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
}
.my-course-tag--recommended {
  background: rgba(245, 158, 11, 0.92);
  color: #fff;
}
.my-course-tag--optional {
  background: rgba(255, 255, 255, 0.88);
  color: #374151;
}
.my-course-body {
  padding: var(--s-4) var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
}
.my-course-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--c-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(var(--fs-md) * var(--lh-tight) * 2);
}
.my-course-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.my-course-progress {
  flex: 1;
  height: 6px;
  background: var(--c-surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.my-course-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), #2563eb);
  border-radius: 999px;
  transition: width var(--t-normal) var(--e-out);
}
.my-course-progress-bar.is-done {
  background: linear-gradient(90deg, #10b981, #047857);
}
.my-course-pct {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-text);
  min-width: 36px;
  text-align: right;
}
.my-course-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--c-text);
  flex-wrap: wrap;
}
.my-course-meta .muted { color: var(--c-text-muted); }
.my-course-cta {
  margin-top: auto;
}

/* ─── Documents accordion ─── */
.docs-accordion {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  overflow: hidden;
}
.docs-accordion-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: var(--fs-md);
}
.docs-accordion-head::-webkit-details-marker { display: none; }
.docs-accordion .chev {
  color: var(--c-text-muted);
  transition: transform var(--t-fast);
}
.docs-accordion[open] .chev { transform: rotate(180deg); }
.docs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--c-border);
}
.docs-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--c-border);
}
.docs-list li:last-child { border-bottom: none; }
.docs-list-title {
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  margin-bottom: 2px;
}

/* ─── AI Navigator FAB (research §3.1, role 4) ─── */
#ai-navigator-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  border: none;
  box-shadow: 0 10px 28px rgba(30,58,138,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
#ai-navigator-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(30,58,138,0.45);
}
#ai-navigator-drawer {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 380px;
  max-width: calc(100vw - 48px);
  max-height: 70vh;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--c-border);
}
.ai-drawer-head h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
#ai-nav-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: var(--c-text-muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r);
}
#ai-nav-close:hover { background: var(--c-surface-2); color: var(--c-text); }
.ai-drawer-body {
  padding: var(--s-4) var(--s-5);
  display: flex; flex-direction: column;
  gap: var(--s-3);
  flex: 1;
  overflow-y: auto;
}
#ai-nav-messages {
  display: flex; flex-direction: column;
  gap: var(--s-2);
  min-height: 40px;
}
.ai-msg {
  padding: 10px 14px;
  border-radius: var(--r);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  max-width: 90%;
  white-space: pre-wrap;
}
.ai-msg-user {
  background: var(--c-primary-soft);
  color: var(--c-primary-text);
  align-self: flex-end;
}
.ai-msg-bot {
  background: var(--c-surface-2);
  color: var(--c-text);
  align-self: flex-start;
}
#ai-nav-form textarea {
  width: 100%;
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--fs-sm);
  resize: vertical;
  margin-bottom: var(--s-2);
}
#ai-nav-form textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

@media (max-width: 640px) {
  #ai-navigator-fab { bottom: 80px; right: 16px; width: 48px; height: 48px; }
  #ai-navigator-drawer { right: 8px; left: 8px; bottom: 140px; max-width: none; width: auto; }
}

/* ─── Cmd+K command palette ─── */
#cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
#cmdk-overlay.cmdk-open { display: flex; }
#cmdk-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 560px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
#cmdk-input {
  border: none;
  border-bottom: 1px solid var(--c-border);
  padding: 16px 20px;
  font-size: var(--fs-md);
  font-family: inherit;
}
#cmdk-input:focus { outline: none; }
#cmdk-results {
  list-style: none;
  margin: 0; padding: 0;
  overflow-y: auto;
  flex: 1;
}
#cmdk-results li {
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--c-border);
  font-size: var(--fs-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}
#cmdk-results li:last-child { border-bottom: none; }
#cmdk-results li:hover,
#cmdk-results li.cmdk-active { background: var(--c-surface-2); }
#cmdk-results .cmdk-result-type {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-light);
  flex-shrink: 0;
}
#cmdk-empty {
  padding: 24px;
  text-align: center;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
}
#cmdk-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--c-border);
  font-size: 11px;
  color: var(--c-text-light);
  background: var(--c-surface-2);
  display: flex;
  gap: 12px;
}
#cmdk-footer kbd {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 10px;
}
/* ─── Login auth tabs (research MVP §2) ─── */

.auth-tabs {
  display: flex;
  gap: 2px;
  background: var(--c-surface-2);
  border-radius: var(--r);
  padding: 4px;
  margin-bottom: var(--s-5);
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--c-text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background var(--t-fast), color var(--t-fast);
}
.auth-tab:hover { color: var(--c-text); }
.auth-tab.is-active {
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

/* Defensive: hidden attribute должен реально скрывать drawer.
 * Иначе display:flex выше перебивает [hidden] и drawer виден по умолчанию. */
#ai-navigator-drawer[hidden] {
  display: none !important;
}
