:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --ink: #241f1a;
  --ink-soft: #6b6055;
  --accent: #7a2e2e;
  --accent-soft: #f3e4de;
  --line: #e8ddd0;
  --good: #2f6d3f;
  --warn: #b5772a;
  --bad: #a3372f;
  --radius: 14px;
  font-family: "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 20px;
}

.footer-social {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-social-label {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.footer-social-links {
  display: flex;
  gap: 10px;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.social-icon svg {
  width: 20px;
  height: 20px;
}

.social-icon:hover,
.social-icon:focus-visible {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

header.site {
  padding: 40px 24px 28px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

header.site h1 {
  font-family: Georgia, serif;
  font-size: 2.1rem;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}

header.site p {
  margin: 0;
  color: var(--ink-soft);
}

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
nav.tabs a {
  padding: 8px 18px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
nav.tabs a.active {
  background: var(--accent-soft);
  color: var(--accent);
}
nav.tabs a:not(.active):hover {
  border-color: var(--line);
}

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  overflow: hidden;
}

.card-poster {
  margin: -20px -20px 0;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--accent-soft);
}
.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lecturer-name { color: var(--ink-soft); }

.lecturer-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.lecturer-link:hover { text-decoration: underline; }

.card:hover {
  box-shadow: 0 10px 24px rgba(36, 31, 26, 0.08);
  transform: translateY(-2px);
}

.tag {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
}

.card h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.3;
}

.meta {
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.price {
  font-weight: 700;
}

.seats-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.seats-badge.good { background: #e7f2e9; color: var(--good); }
.seats-badge.warn { background: #fbf0e0; color: var(--warn); }
.seats-badge.bad { background: #f6e3e1; color: var(--bad); }

.section-title {
  font-family: Georgia, serif;
  font-size: 1.3rem;
  margin: 8px 0 18px;
}

.lecturer-photo {
  aspect-ratio: 1 / 1;
  margin: -20px -20px 0;
  background: var(--accent-soft);
  overflow: hidden;
  flex-shrink: 0;
}
.lecturer-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  opacity: 0.5;
}
.photo-placeholder svg { width: 40%; height: 40%; }

.lecturer-photo.large {
  width: 120px;
  height: 120px;
  aspect-ratio: unset;
  border-radius: 16px;
  margin: 0;
}

.lecturer-card .description {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lecturer-profile {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}
.lecturer-profile h2 { font-family: Georgia, serif; margin: 0 0 4px; }
.lecturer-profile .lecturer-role { color: var(--accent); font-weight: 600; margin-bottom: 10px; }
.lecturer-profile .description { margin: 0; color: var(--ink); }

@media (max-width: 480px) {
  .lecturer-profile { flex-direction: column; align-items: center; text-align: center; }
}

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
}

/* Модалка */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 31, 26, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 50;
}
.overlay[hidden] { display: none; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 620px;
  width: 100%;
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--ink);
  line-height: 1;
}

.modal-poster {
  margin: -28px -28px 16px;
  max-height: 320px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal h2 {
  font-family: Georgia, serif;
  margin: 0 0 4px;
  padding-right: 30px;
}

.modal .speaker {
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 14px;
}

.modal .description {
  color: var(--ink);
  margin-bottom: 18px;
}

.info-row {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.info-row .label { color: var(--ink-soft); min-width: 110px; flex-shrink: 0; }

.map-frame {
  width: 100%;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0;
  overflow: hidden;
  background: #eee;
}
.map-frame iframe { width: 100%; height: 100%; border: 0; }

form.booking-form {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

form.booking-form h3 { margin: 0 0 4px; font-family: Georgia, serif; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 0.85rem; color: var(--ink-soft); }
.field input,
.field textarea,
.field select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}
.field input:focus,
.field textarea:focus,
.field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.total-line {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.05rem;
  padding-top: 6px;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { background: #632424; }
button.primary:disabled { background: #c9b9b3; cursor: not-allowed; }

.form-msg { font-size: 0.88rem; }
.form-msg.error { color: var(--bad); }
.form-msg.ok { color: var(--good); }

.sold-out-note {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.92rem;
  text-align: center;
}

/* Отдельные страницы: оплата и успех */
.center-page {
  max-width: 480px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}
.center-page h1 { font-family: Georgia, serif; font-size: 1.5rem; }
.center-page .amount { font-size: 2rem; font-weight: 700; margin: 14px 0; }
.center-page .yk-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}
.back-link { display: inline-block; margin-top: 18px; color: var(--accent); text-decoration: none; font-weight: 600; }

/* Личный кабинет и авторизация */
.account-app { max-width: 480px; margin: 0 auto; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

.auth-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
}
.auth-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(36,31,26,0.1); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin: 20px 0;
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.yandex-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  box-sizing: border-box;
}
.yandex-btn:hover { border-color: var(--accent); }
.yandex-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fc3f1d;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

.yk-badge.center { display: block; text-align: center; margin-top: 14px; }

.account-profile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.account-profile h2 { font-family: Georgia, serif; margin: 0 0 2px; }
.account-profile > div:first-child { flex: 1; min-width: 140px; }

.points-badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
}

.logout-btn {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
}
.logout-btn:hover { border-color: var(--accent); color: var(--accent); }

.booking-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--ink);
}
.booking-row:hover { border-color: var(--accent); }
.booking-row .meta { flex-direction: row; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* Дашборды: кабинет лектора и админка */
.dashboard { max-width: 760px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-header .section-title { margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-value { font-family: Georgia, serif; font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.82rem; color: var(--ink-soft); margin-top: 4px; }

.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.dashboard-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.dashboard-row-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-lecture-form, #new-lecture-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 4px 0;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.role-form {
  flex-wrap: wrap;
}
.role-select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; }
.lecturer-link-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lecturer-link-field select,
.lecturer-link-field input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
}
.or-label { font-size: 0.8rem; color: var(--ink-soft); }

.photo-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.photo-upload .lecturer-photo {
  width: 96px;
  height: 96px;
  aspect-ratio: unset;
  border-radius: 12px;
  margin: 0;
  flex-shrink: 0;
}
.card-poster-preview {
  width: 96px;
  height: 128px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--accent-soft);
  flex-shrink: 0;
}
.card-poster-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-poster-preview .photo-placeholder { color: var(--accent); opacity: 0.5; }
.photo-upload-controls { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.upload-btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}
.upload-btn:hover { border-color: var(--accent); color: var(--accent); }

.incomplete-note { color: var(--warn); font-style: italic; }
