/* ═══════════════════════════════════════════════════════════
   LESSON HUB CARDS — Полный редизайн
   Подключить в index.html:
   <link rel="stylesheet" href="./static/css/lesson-cards.css">
   ═══════════════════════════════════════════════════════════ */

/* ── СЕТКА ── */
.story-lessons-grid,
#allLessonsGrid,
#myLessonsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 24px;
}

/* ═══ КАРТОЧКА УРОКА ═══ */
.lesson-hub-card {
  background: #1a2634;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s cubic-bezier(.16,1,.3,1),
              box-shadow .2s ease,
              border-color .2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.lesson-hub-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, #1cb0f6, #06d6a0);
  opacity: 0;
  transition: opacity .2s;
}

.lesson-hub-card:hover {
  transform: translateY(-4px);
  border-color: rgba(28,176,246,.3);
  box-shadow:
    0 16px 40px rgba(0,0,0,.4),
    0 0 0 1px rgba(28,176,246,.15);
}

.lesson-hub-card:hover::before {
  opacity: 1;
}

/* ── ВЕРХНЯЯ ЧАСТЬ ── */
.lesson-hub-card-top {
  padding: 20px 20px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Эмодзи + тема в один ряд */
.lesson-hub-emoji {
  font-size: 32px;
  display: block;
  line-height: 1;
  margin-bottom: 2px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.3));
}

/* ── ТЕГИ ── */
.lesson-hub-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.lesson-hub-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.08);
}

/* Статус */
.lesson-hub-tag.status-approved {
  background: rgba(87,204,2,.12);
  color: #57cc02;
  border-color: rgba(87,204,2,.2);
}
.lesson-hub-tag.status-pending {
  background: rgba(255,150,0,.12);
  color: #ff9600;
  border-color: rgba(255,150,0,.2);
}
.lesson-hub-tag.status-rejected {
  background: rgba(255,75,75,.12);
  color: #ff4b4b;
  border-color: rgba(255,75,75,.2);
}

/* Уровень */
.lesson-hub-tag.green {
  background: rgba(6,214,160,.12);
  color: #06d6a0;
  border-color: rgba(6,214,160,.2);
}
.lesson-hub-tag.orange {
  background: rgba(255,150,0,.12);
  color: #ff9600;
  border-color: rgba(255,150,0,.2);
}
.lesson-hub-tag.purple {
  background: rgba(155,93,229,.14);
  color: #a78bfa;
  border-color: rgba(155,93,229,.25);
}

/* Предмет */
.lesson-hub-tag.blue {
  background: rgba(28,176,246,.12);
  color: #1cb0f6;
  border-color: rgba(28,176,246,.2);
}

/* ── ЗАГОЛОВОК ── */
.lesson-hub-title {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
  letter-spacing: -.1px;
}

/* ── ОПИСАНИЕ ── */
.lesson-hub-desc {
  font-size: 12px;
  color: rgba(255,255,255,.45);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── МЕТА-СТРОКА (блоки · время · дата) ── */
.lesson-hub-meta {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin-top: 4px;
}

.lesson-hub-meta-item {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  gap: 4px;
  padding-right: 10px;
  margin-right: 10px;
  border-right: 1px solid rgba(255,255,255,.08);
}

.lesson-hub-meta-item:last-child {
  border-right: none;
  padding-right: 0;
  margin-right: 0;
}

/* ═══ ФУТЕР КАРТОЧКИ ═══
   Теперь: автор слева + две кнопки справа
   Кнопка «Запустить» — главная, яркая
   Кнопка «Изменить» — иконка-карандаш
   Кнопка «✕» — иконка удаления, очень маленькая
*/
.lesson-hub-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(0,0,0,.15);
}

.lesson-hub-author {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: rgba(255,255,255,.3);
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}

/* ── КНОПКИ — главный фикс ── */
.lesson-hub-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Кнопка «▶ Запустить» — главная CTA */
.lesson-hub-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1cb0f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s cubic-bezier(.16,1,.3,1);
  white-space: nowrap;
  letter-spacing: .01em;
  box-shadow: 0 3px 10px rgba(28,176,246,.3);
}

.lesson-hub-run-btn:hover {
  background: #0e9de0;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(28,176,246,.4);
}

.lesson-hub-run-btn:active {
  transform: translateY(0);
}

/* Кнопка «✏️ Изменить» — иконка-кнопка */
.lesson-hub-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  color: rgba(255,255,255,.6);
  /* Скрываем текст «Изменить», показываем только эмодзи */
  font-size: 0; /* скрыть текст */
  overflow: hidden;
  position: relative;
}

.lesson-hub-edit-btn::after {
  content: '✏️';
  font-size: 13px;
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lesson-hub-edit-btn:hover {
  background: rgba(28,176,246,.15);
  border-color: rgba(28,176,246,.35);
  transform: translateY(-1px);
}

/* Кнопка «✕» — маленькое удаление */
.lesson-hub-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px;
  font-size: 10px;
  color: rgba(255,255,255,.25);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}

.lesson-hub-del-btn:hover {
  background: rgba(255,75,75,.12);
  border-color: rgba(255,75,75,.3);
  color: #ff4b4b;
}

/* ═══ ПУСТЫЕ СОСТОЯНИЯ ═══ */
.story-empty,
.story-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 24px;
  grid-column: 1 / -1;
  text-align: center;
}

.story-empty-icon { font-size: 44px; opacity: .5; }
.story-empty-title { font-size: 15px; font-weight: 800; color: rgba(255,255,255,.6); }
.story-empty-sub {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: rgba(255,255,255,.3);
  line-height: 1.6;
  max-width: 260px;
}

.story-loading {
  flex-direction: row;
  gap: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: rgba(255,255,255,.3);
}

.story-loading-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #1cb0f6;
  animation: hubBounce .6s ease infinite;
}
.story-loading-dot:nth-child(2) { animation-delay: .1s; }
.story-loading-dot:nth-child(3) { animation-delay: .2s; }

@keyframes hubBounce {
  0%,80%,100% { transform: scale(0); opacity: .3; }
  40%          { transform: scale(1); opacity: 1; }
}

/* ── Анимация появления карточек ── */
.lesson-hub-card {
  opacity: 0;
  animation: cardReveal .45s cubic-bezier(.16,1,.3,1) forwards;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lesson-hub-card:nth-child(1)  { animation-delay: .03s; }
.lesson-hub-card:nth-child(2)  { animation-delay: .06s; }
.lesson-hub-card:nth-child(3)  { animation-delay: .09s; }
.lesson-hub-card:nth-child(4)  { animation-delay: .12s; }
.lesson-hub-card:nth-child(5)  { animation-delay: .15s; }
.lesson-hub-card:nth-child(6)  { animation-delay: .18s; }
.lesson-hub-card:nth-child(7)  { animation-delay: .21s; }
.lesson-hub-card:nth-child(8)  { animation-delay: .24s; }
.lesson-hub-card:nth-child(n+9){ animation-delay: .27s; }

/* ── Адаптив ── */
@media (max-width: 768px) {
  #allLessonsGrid,
  #myLessonsGrid {
    grid-template-columns: 1fr;
    padding: 12px;
  }
}

/* ═══ STORY HEADER — обновлённый ═══ */
.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 28px 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.story-header-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -.3px;
  margin-bottom: 4px;
}

.story-header-sub {
  font-size: 13px;
  color: rgba(255,255,255,.4);
  font-family: 'DM Mono', monospace;
}

.story-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ═══ STATS STRIP ═══ */
.story-stats-strip {
  display: flex;
  gap: 0;
  border-top: 1px solid rgba(255,255,255,.06);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.story-stat {
  flex: 1;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid rgba(255,255,255,.06);
  transition: background .15s;
}
.story-stat:last-child { border-right: none; }
.story-stat:hover { background: rgba(255,255,255,.02); }

.story-stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #1cb0f6;
  line-height: 1;
}
.story-stat-lbl {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .12em;
}

/* ═══ ТАББАР ═══ */
.story-tabs-bar {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.06);
  overflow-x: auto;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  background: rgba(19,31,36,.96);
  backdrop-filter: blur(20px);
  z-index: 10;
}
.story-tabs-bar::-webkit-scrollbar { display: none; }

.story-tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(255,255,255,.35);
  font-family: 'Nunito', sans-serif;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: -1px;
  white-space: nowrap;
}
.story-tab svg { width: 13px; height: 13px; opacity: .5; }
.story-tab:hover { color: rgba(255,255,255,.7); }
.story-tab.active {
  color: #1cb0f6;
  border-bottom-color: #1cb0f6;
}
.story-tab.active svg { opacity: 1; }

/* ═══ ФИЛЬТРЫ ═══ */
.story-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.1);
}

.story-search-box {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 9px 14px;
  transition: border-color .15s;
}
.story-search-box:focus-within {
  border-color: rgba(28,176,246,.4);
  background: rgba(28,176,246,.06);
}
.story-search-box svg { width: 14px; height: 14px; opacity: .3; flex-shrink: 0; }
.story-search-box input {
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
  width: 100%;
}
.story-search-box input::placeholder { color: rgba(255,255,255,.25); }

.story-select {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.6);
  padding: 9px 14px;
  border-radius: 10px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
}
.story-select:focus { border-color: rgba(28,176,246,.4); }

.story-btn-secondary {
  background: transparent;
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.12);
  padding: 9px 18px;
  border-radius: 99px;
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.story-btn-secondary:hover {
  border-color: rgba(255,255,255,.3);
  color: #fff;
}

.story-btn-primary {
  background: #1cb0f6;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 99px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 4px 14px rgba(28,176,246,.3);
  white-space: nowrap;
}
.story-btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(28,176,246,.4);
}

.story-btn-sm {
  padding: 7px 14px;
  font-size: 11px;
}

/* ═══ ПАНЕЛИ ═══ */
.story-panel { display: none; }
.story-panel.active {
  display: block;
  animation: fadeUpSmooth .35s cubic-bezier(.16,1,.3,1) both;
}

/* ═══ RUNNING HUB ═══ */
.running-empty {
  text-align: center;
  padding: 64px 24px;
  border: 2px dashed rgba(255,255,255,.08);
  border-radius: 16px;
}
.running-empty-title { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.running-empty-sub { font-size: 13px; color: rgba(255,255,255,.35); max-width: 320px; margin: 0 auto; line-height: 1.6; }

/* ═══ КНОПКА ОТКРЫТОГО УРОКА (добавляется патчем) ═══ */
.lesson-hub-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(87,204,2,.1);
  border: 1.5px solid rgba(87,204,2,.25);
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.lesson-hub-open-btn:hover {
  background: var(--duo-green, #57cc02);
  border-color: var(--duo-green, #57cc02);
  transform: translateY(-1px);
}

/* ═══ ВЕСТИ УРОК — раздел ═══ */
.story-docs-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.story-drop-zone {
  border: 2px dashed rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 20px;
  transition: all .2s;
  cursor: pointer;
  background: rgba(255,255,255,.02);
}
.story-drop-zone:hover, .story-drop-zone.drag-over {
  border-color: rgba(28,176,246,.4);
  background: rgba(28,176,246,.05);
}
.story-drop-icon { font-size: 36px; margin-bottom: 10px; }
.story-drop-title { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.story-drop-sub { font-size: 11px; color: rgba(255,255,255,.3); font-family: 'DM Mono', monospace; margin-bottom: 14px; }

.story-docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px,1fr));
  gap: 14px;
}

/* Doc card */
.doc-card {
  background: #1a2634;
  border: 1.5px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.doc-card:hover { border-color: rgba(28,176,246,.3); transform: translateY(-2px); }
.doc-card-icon { font-size: 28px; }
.doc-card-title { font-size: 13px; font-weight: 800; }
.doc-card-tag { font-family:'DM Mono',monospace; font-size:9px; color:#57cc02; text-transform:uppercase; letter-spacing:.1em; }
.doc-card-meta { font-family:'DM Mono',monospace; font-size:10px; color:rgba(255,255,255,.3); display:flex; flex-wrap:wrap; gap:8px; }
.doc-card-footer { display:flex; gap:8px; margin-top:auto; }
.doc-action-btn { flex:1; padding:7px; border-radius:8px; border:1.5px solid rgba(255,255,255,.1); background:transparent; color:rgba(255,255,255,.5); font-family:'Nunito',sans-serif; font-size:11px; font-weight:700; cursor:pointer; transition:all .15s; }
.doc-action-btn.primary { background:rgba(28,176,246,.1); border-color:rgba(28,176,246,.3); color:#1cb0f6; }
.doc-action-btn:hover { border-color:rgba(255,255,255,.3); color:#fff; }
.doc-action-btn.primary:hover { background:#1cb0f6; color:#fff; }

/* Import chips */
.import-chip { background:rgba(255,255,255,.06); border:1.5px solid rgba(255,255,255,.1); color:rgba(255,255,255,.5); padding:7px 16px; border-radius:99px; font-family:'Nunito',sans-serif; font-size:12px; font-weight:700; cursor:pointer; transition:all .15s; }
.import-chip.selected, .import-chip:hover { background:rgba(28,176,246,.12); border-color:rgba(28,176,246,.4); color:#1cb0f6; }

/* Import tab panels */
.import-panel { display:none; }
.import-panel.active { display:block; }