/* ============================================================
   Lecture Creator — UI styles
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-light: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.08);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 28px 0 24px;
  box-shadow: var(--shadow);
}
.app-header h1 { margin: 0; font-size: 26px; font-weight: 700; }
.app-header .subtitle { margin: 4px 0 0; opacity: 0.9; font-size: 15px; }

/* Stepper */
.stepper {
  display: flex;
  justify-content: space-between;
  margin: 24px auto;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  gap: 4px;
  overflow-x: auto;
}
.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
  transition: all 0.2s;
}
.step.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.step.done { color: var(--success); }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-light);
  font-weight: 700;
  font-size: 12px;
}
.step.active .step-num { background: var(--primary); color: white; }
.step.done .step-num { background: var(--success); color: white; }

/* Panels */
main { padding-bottom: 80px; }
.panel {
  display: none;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  animation: fadeIn 0.3s;
}
.panel.active { display: block; }
.panel h2 { margin-top: 0; font-size: 22px; color: var(--text); }
.hint { color: var(--text-light); margin-bottom: 20px; }

/* Forms */
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  transition: border 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; min-height: 100px; }

label { display: block; font-size: 14px; color: var(--text-light); }
label span { display: block; margin-bottom: 6px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* Voice — отключено по запросу пользователя, стили не нужны */

/* Buttons */
.actions { display: flex; gap: 12px; justify-content: space-between; margin-top: 24px; }
.btn-primary, .btn-secondary {
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--border); color: var(--text-light); cursor: not-allowed; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-big { padding: 14px 32px; font-size: 16px; }

/* Sources */
.search-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-controls select { max-width: 220px; }
.btn-small { padding: 6px 12px !important; font-size: 13px !important; }
.search-status { font-size: 13px; color: var(--text-light); margin-left: auto; }
.sources-list { display: flex; flex-direction: column; gap: 10px; max-height: 600px; overflow-y: auto; padding-right: 4px; }
.placeholder { text-align: center; color: var(--text-light); padding: 40px 0; }

.source-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  cursor: pointer;
}
.source-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.source-card.selected { background: var(--primary-light); border-color: var(--primary); }
.source-checkbox { flex-shrink: 0; padding-top: 2px; }
.source-checkbox input { width: 18px; height: 18px; cursor: pointer; }
.source-body { flex: 1; min-width: 0; }
.source-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; line-height: 1.3; }
.source-meta { font-size: 12px; color: var(--text-light); display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.source-meta .badge { background: var(--border); padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.source-meta .badge.type-academic { background: #dbeafe; color: #1e40af; }
.source-meta .badge.type-video { background: #fee2e2; color: #991b1b; }
.source-meta .badge.type-audio { background: #fce7f3; color: #9d174d; }
.source-meta .badge.type-web { background: #d1fae5; color: #065f46; }
.source-meta .badge.type-course { background: #fef3c7; color: #92400e; }
.source-desc { font-size: 13px; color: var(--text-light); line-height: 1.4; }
.source-link { font-size: 12px; color: var(--primary); text-decoration: none; word-break: break-all; }
.source-link:hover { text-decoration: underline; }
.source-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.relevance { font-size: 11px; color: var(--text-light); }
.relevance-bar { width: 60px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.relevance-bar > div { height: 100%; background: var(--success); }

/* Lectures */
.lecture-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  background: var(--surface);
}
.lecture-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.lecture-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--primary); color: white;
  border-radius: 50%;
  font-weight: 700; font-size: 14px;
}
.lecture-title { flex: 1; font-size: 17px; font-weight: 600; }
.lecture-meta { font-size: 12px; color: var(--text-light); }
.lecture-section { margin-top: 12px; }
.lecture-section-title { font-size: 13px; font-weight: 600; color: var(--text-light); text-transform: uppercase; margin-bottom: 6px; }
.lecture-section ul { margin: 0; padding-left: 20px; }
.lecture-section li { font-size: 14px; line-height: 1.5; margin-bottom: 3px; }
.slides-control { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.slides-control label { font-size: 14px; color: var(--text); }
.slides-control input { max-width: 70px; }
.slides-control button { padding: 6px 14px; font-size: 13px; }

/* Slides editor */
.slides-editor { margin-top: 12px; }
.slide-edit {
  display: flex; gap: 12px; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px; background: #f8fafc;
}
.slide-edit-num {
  flex-shrink: 0; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 50%; font-weight: 700; font-size: 12px;
}
.slide-edit-body { flex: 1; }
.slide-edit-body input { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.slide-edit-body textarea { font-size: 13px; min-height: 60px; }

/* Export */
.export-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.checkbox { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s; font-size: 15px; }
.checkbox:hover { border-color: var(--primary); background: var(--primary-light); }
.checkbox input { width: 18px; height: 18px; cursor: pointer; }

.export-results { margin-top: 20px; padding: 16px; background: var(--primary-light); border-radius: var(--radius); display: none; }
.export-results.show { display: block; }
.export-link { display: inline-block; margin: 4px 8px 4px 0; padding: 8px 16px; background: white; border: 1px solid var(--primary); color: var(--primary-dark); text-decoration: none; border-radius: var(--radius-sm); font-weight: 600; }
.export-link:hover { background: var(--primary); color: white; }

/* Footer */
.app-footer { text-align: center; padding: 32px 16px 24px; color: var(--text-light); font-size: 13px; border-top: 1px solid var(--border); margin-top: 40px; background: var(--surface); }
.warning-box {
  display: flex; align-items: flex-start; gap: 16px;
  max-width: 900px; margin: 0 auto 24px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  text-align: left;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15);
}
/* На странице (шаг 1) — жёлтая рамка вместо фона */
.warning-box-page {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  margin: 20px 0;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}
.warning-icon { font-size: 32px; flex-shrink: 0; line-height: 1; }
.warning-content { flex: 1; }
.warning-content strong { display: block; color: #92400e; font-size: 15px; margin-bottom: 6px; }
.warning-content p { margin: 0; color: #78350f; font-size: 13px; line-height: 1.5; }
.copyright { margin: 0; font-size: 13px; color: var(--text-light); }

/* Подвал внутри страницы (только на шаге 1) — в левом углу */
.page-footer {
  text-align: left;
  padding: 16px 4px 0;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}
.page-footer .copyright { font-size: 12px; }

/* Loading */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Loading overlay */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  font-size: 16px; color: var(--text);
}
.loading-overlay .spinner { width: 40px; height: 40px; border-width: 4px; margin-right: 16px; }
