/* ==========================================================================
   ЗАНЯТИЯ — панель управления, расписание по дням, полное расписание
   ========================================================================== */

.topics-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }

/* ---------- Панель ---------- */
.topics-sidebar {
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.topics-label {
  font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-muted, #7c8798);
}
.topics-sidebar select { width: 100%; font-size: .84rem; }

.button-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

.tp-btn {
  width: 100%;
  border: 1px solid transparent; cursor: pointer;
  font: inherit; font-size: .85rem; font-weight: 600;
  border-radius: 10px; padding: 9px 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tp-btn--primary { background: var(--c-brand, #2563eb); color: #fff; box-shadow: 0 2px 8px -2px rgba(37, 99, 235, .5); }
.tp-btn--primary:hover { background: var(--c-brand-2, #1d4ed8); }
.tp-btn--violet { background: rgba(109, 40, 217, .1); color: #6d28d9; }
.tp-btn--violet:hover { background: rgba(109, 40, 217, .18); }
.tp-btn--ghost { background: var(--c-surface, #fff); color: var(--c-text-2, #475569); border-color: var(--c-border, #e6eaf2); }
.tp-btn--ghost:hover { background: var(--c-surface-2, #f8fafc); color: var(--c-text, #0f172a); }
.tp-btn--danger { background: rgba(220, 38, 38, .08); color: #b91c1c; }
.tp-btn--danger:hover { background: rgba(220, 38, 38, .16); }

/* ---------- Правая часть ---------- */
.topics-main { min-width: 0; }

.topics-header-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.topics-header-bar h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.topics-count {
  font-size: .74rem; font-weight: 700; color: var(--c-muted, #7c8798);
  background: var(--c-surface, #fff); border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 99px; padding: 3px 10px;
}

/* ---------- Дни ---------- */
.day-card {
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.day-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px;
  background: var(--c-surface-2, #f8fafc);
  border-bottom: 1px solid var(--c-border, #e6eaf2);
  font-weight: 700; font-size: .9rem;
}
.day-card-header i { color: var(--c-brand, #2563eb); font-size: .85rem; }
.day-card-header .day-date { font-weight: 500; color: var(--c-muted, #7c8798); font-size: .82rem; }

.topic-item { padding: 12px 16px; border-bottom: 1px solid var(--c-border, #e6eaf2); }
.topic-item:last-child { border-bottom: none; }
.topic-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.topic-header .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 99px;
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 6px;
}
.topic-title { font-weight: 600; font-size: .9rem; }
.topic-desc { font-size: .8rem; color: var(--c-muted, #7c8798); margin-top: 4px; line-height: 1.45; }
.topic-actions { display: flex; gap: 2px; flex-shrink: 0; }
.action-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  color: var(--c-text-2, #475569); font-size: .82rem;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.action-icon.edit:hover { background: var(--c-brand-soft, #eff4ff); color: var(--c-brand, #2563eb); }
.action-icon.delete:hover { background: rgba(220, 38, 38, .12); color: var(--c-danger, #dc2626); }

/* ---------- Пустое состояние ---------- */
.topics-empty, .empty-message {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 46px 24px; text-align: center; color: var(--c-muted, #7c8798); font-size: .88rem;
  background: var(--c-surface, #fff); border: 1px dashed var(--c-border-strong, #d5dceb); border-radius: 14px;
}
.topics-empty i { font-size: 1.7rem; opacity: .45; }
.topics-empty p { margin: 0; }

/* ---------- Полное расписание ---------- */
.full-schedule-wrapper {
  overflow: auto;
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e6eaf2);
  border-radius: 12px;
  max-height: 66vh;
}
.full-schedule-table { width: 100%; border-collapse: collapse; font-size: .8rem; min-width: 600px; }
.full-schedule-table th, .full-schedule-table td {
  border: 1px solid var(--c-border, #e6eaf2);
  padding: 8px; vertical-align: top; text-align: left;
}
.full-schedule-table th {
  background: var(--c-surface-2, #f8fafc);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-muted, #7c8798);
  position: sticky; top: 0; z-index: 1;
}
.full-schedule-subject { font-weight: 600; background: var(--c-surface-2, #f8fafc); width: 170px; }
.full-schedule-topic { max-width: 220px; word-break: break-word; }

/* ---------- Формы тем ---------- */
#addTopicForm .form-group textarea, #editTopicForm .form-group textarea {
  width: 100%; padding: 10px 12px;
  border-radius: 10px; border: 1px solid var(--c-border, #e6eaf2);
  font-family: inherit; font-size: .86rem;
  background-color: var(--c-surface, #fff); color: var(--c-text, #0f172a);
  resize: vertical;
}
#addTopicForm .form-group textarea:focus, #editTopicForm .form-group textarea:focus {
  outline: 0; border-color: var(--c-brand, #2563eb); box-shadow: var(--c-ring, 0 0 0 3px rgba(59,130,246,.2));
}

/* ---------- Адаптив ---------- */
@media (max-width: 1000px) {
  .topics-layout { grid-template-columns: 1fr; }
  .topics-sidebar { padding: 14px; }
  .button-group { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .button-group { grid-template-columns: 1fr; }
}
