/* =========================================================
   ANTS HEALTH — страница «Мои курсы»
   ========================================================= */

:root {
  --primary: #1f6b52;
  --primary-dark: #14543f;
  --primary-light: #2e8a6b;
  --primary-soft: #b8e0d0;
  --accent: #d4a657;
  --accent-soft: #f4e7c9;
  --bg-page: #f1f4f2;
  --bg-card: #ffffff;
  --bg-card-alt: #f7faf8;
  --bg-header: #e9ede9;
  --border: #d4dcd7;
  --border-strong: #b9c5be;
  --text: #1e2a25;
  --text-muted: #6a7870;
  --text-soft: #8c9a92;
  --danger: #c84e4e;
  --info: #3d6fa3;
  --warn: #c8923e;
  /* R5-2: фирменный оранжевый для акцентных действий (кнопка загрузки
     эмблемы учреждения). Контраст с белым текстом ≥ 4.5:1 (WCAG AA). */
  --orange: #DA7101;
  --orange-dark: #B85E01;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 84, 63, 0.06);
  --shadow: 0 4px 14px rgba(20, 84, 63, 0.08);
  --shadow-lg: 0 10px 30px rgba(20, 84, 63, 0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', 'Times New Roman', Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===================== LAYOUT ===================== */
.layout {
  display: grid;
  grid-template-columns: 208px 1fr;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
/* === FULL-HEIGHT SIDEBAR FIX === */
.sidebar {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: relative;
  align-self: stretch;
  min-height: 100vh;
  height: auto;
}
/* R4-4 (QA): font-size:0 — страховка от случайных текстовых узлов между
   эмблемой и подписью; у .brand-name/.brand-sub размеры заданы явно ниже. */
.sidebar-top { text-align: center; padding: 0 20px 24px; font-size: 0; }
/* R1 (ребрендинг): эмблема сайдбара — готовый белый PNG на прозрачном фоне.
   Подложка НЕ нужна: логотип лежит прямо на тёмно-зелёном фоне сайдбара. */
/* R4-4: подпись «Кабинет автора»/«Личный кабинет» подтягиваем к эмблеме —
   текстовый .brand-name удалён, поэтому нижний отступ логотипа минимальный. */
.logo { width: auto; height: auto; margin: 0 auto 2px; }
.logo svg { width: 90px; height: 100px; }
.logo-img { width: 110px; height: auto; display: block; margin: 0 auto; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 4px 0 2px;
  color: #fff;
}
.brand-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  /* R4-4: отрицательный верхний отступ компенсирует прозрачное поле PNG-эмблемы,
     чтобы подпись легла сразу под словами «HIGHTOWER EDUCATION». */
  margin: -2px 0 0;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 20px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 8px;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
  transition: all 0.15s;
}
.nav-item:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.nav-item.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-weight: 500;
}
.nav-icon {
  width: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  flex-shrink: 0;
}

.nav-item > span:nth-child(2) {
  flex: 1;
}

.nav-item.nav-back {
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  padding: 9px 14px;
  margin-bottom: 4px;
}
.nav-item.nav-back:hover {
  color: #fff;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.10);
}
.nav-section:first-of-type {
  margin-top: 6px;
}
.nav-section-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  padding: 4px 14px 8px;
  font-weight: 600;
}

.nav-badge {
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.92);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-item.active .nav-badge {
  background: var(--accent, #d4a657);
  color: #3a2a0f;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent, #d4a657);
  box-shadow: 0 0 0 3px rgba(212,166,87,0.18);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.sidebar-footer-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.sidebar-footer-link { color: #fff; font-size: 13px; }
.sidebar-footer-link:hover { color: var(--primary-soft); text-decoration: none; }

/* ===================== MAIN ===================== */
.main { display: flex; flex-direction: column; min-height: 100vh; }

.header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 18px; }
.page-pill {
  display: inline-flex;
  align-items: center;
  background: var(--primary);
  color: #fff;
  padding: 8px 20px;
  border-radius: 8px;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow-sm);
}
.breadcrumb { font-size: 13px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.crumb-sep { margin: 0 6px; color: var(--text-soft); }

.user-area { display: flex; align-items: center; gap: 12px; }
.user-info { text-align: right; line-height: 1.2; }
.user-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11.5px; color: var(--text-muted); }
.user-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-family: var(--font-serif);
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.btn-exit {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
}
.btn-exit:hover { background: var(--primary-dark); }

/* ===================== CONTENT ===================== */
.content {
  flex: 1;
  padding: 28px 40px 32px;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
}

/* ===================== WELCOME BLOCK ===================== */
.welcome-block {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.welcome-block::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(255,255,255,0.1), transparent 70%);
  border-radius: 50%;
}
.welcome-block::after {
  content: '';
  position: absolute;
  bottom: -50px; right: 40%;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(212,166,87,0.15), transparent 70%);
  border-radius: 50%;
}
.welcome-text { position: relative; }
.welcome-text h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
}
.welcome-text p {
  margin: 0;
  font-size: 14px;
  opacity: 0.92;
  max-width: 540px;
  line-height: 1.55;
}
.welcome-text strong { color: #fff; font-weight: 700; }

.welcome-stats {
  display: flex;
  gap: 10px;
  position: relative;
}
.stat-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
  min-width: 84px;
}
.stat-card.accent {
  background: rgba(212,166,87,0.28);
  border-color: rgba(212,166,87,0.5);
}
.stat-num {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-lbl {
  font-size: 11px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ===================== ACTIONS ROW ===================== */
.actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.actions-left { min-width: 0; }
.section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 2px;
}
.section-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}
.actions-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-soft);
  pointer-events: none;
}
.search-wrap input {
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  width: 240px;
  transition: all 0.15s;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,107,82,0.12);
}
.search-wrap:focus-within svg { color: var(--primary); }

/* Buttons */
.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.2;
  border: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn-ghost {
  background: #fff;
  color: var(--text-muted);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary-sm, .btn-ghost-sm {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.2;
  border: none;
}
.btn-primary-sm { background: var(--primary); color: #fff; }
.btn-primary-sm:hover { background: var(--primary-dark); }
.btn-ghost-sm {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border-strong);
}
.btn-ghost-sm:hover { border-color: var(--primary); color: var(--primary); }

/* ===================== TABS ===================== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 18px 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary-dark); font-weight: 600; border-color: var(--primary); }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--bg-header);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.tab.active .tab-count { background: var(--primary); color: #fff; }

/* ===================== COURSE GRID ===================== */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.course-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-soft);
  text-decoration: none;
}

/* Обложка */
.course-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.cover-bg {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  position: relative;
}
.cover-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.15), transparent 60%);
}
.bg-pharma {
  background: linear-gradient(135deg, #2e8a6b 0%, #1f6b52 60%, #14543f 100%);
}
.bg-derma {
  background: linear-gradient(135deg, #d4a657 0%, #b88a3f 60%, #8f6a2e 100%);
}
.cover-bg svg { position: relative; z-index: 1; }

.status-chip {
  position: absolute;
  z-index: 2;
  top: 12px; left: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.9);
}
.chip-active { color: var(--primary-dark); }
.chip-active::before { content: '● '; color: var(--primary); }
.chip-draft { color: #8a6b2a; background: rgba(244,231,201,0.95); }
.chip-draft::before { content: '● '; color: var(--accent); }

.cover-actions {
  position: absolute;
  z-index: 2;
  top: 10px; right: 10px;
  display: flex;
  gap: 4px;
}
.cover-actions button {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: all 0.15s;
}
.cover-actions button:hover { background: #fff; color: var(--primary); }

/* Тело карточки */
.course-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.course-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag-cat { background: rgba(31,107,82,0.08); color: var(--primary-dark); }
.tag-free { background: var(--accent-soft); color: #8a6b2a; }

.course-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.course-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-meta {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}
.meta-item svg { color: var(--primary); flex-shrink: 0; }

.progress-row { margin-top: 2px; }
.progress-lbl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}
.progress-lbl strong { color: var(--primary-dark); font-size: 12.5px; }
.progress-bar {
  height: 6px;
  background: var(--bg-header);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 3px;
  transition: width 0.4s;
}

.course-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 8px;
  flex-wrap: wrap;
}
.course-date {
  font-size: 11.5px;
  color: var(--text-soft);
}
.course-actions { display: flex; gap: 6px; }

/* Карточка «Создать курс» */
.course-add {
  background: linear-gradient(160deg, rgba(31,107,82,0.04), rgba(212,166,87,0.04));
  border: 2px dashed var(--primary-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  color: inherit;
  min-height: 380px;
  transition: all 0.2s;
}
.course-add:hover {
  background: linear-gradient(160deg, rgba(31,107,82,0.08), rgba(212,166,87,0.08));
  transform: translateY(-3px);
  text-decoration: none;
  border-style: solid;
}
.add-icon {
  width: 62px; height: 62px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px rgba(31,107,82,0.25);
}
.add-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}
.add-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.add-variants { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.add-variant {
  padding: 6px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
}
.add-variant-ai {
  background: linear-gradient(135deg, rgba(31,107,82,0.1), rgba(212,166,87,0.1));
  border-color: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

/* ===================== FOOTER ===================== */
.footer {
  padding: 18px 40px;
  border-top: 1px solid var(--border);
  background: var(--bg-header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
.footer-links a { color: var(--text-muted); margin: 0 2px; }
.footer-links a:hover { color: var(--primary); }
.footer-links span { margin: 0 4px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1100px) {
  .welcome-block { grid-template-columns: 1fr; }
  .welcome-stats { justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding-bottom: 16px; }
  .content, .header, .footer { padding: 20px; }
  .header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .course-grid { grid-template-columns: 1fr; }
  .user-info { display: none; }
}
