/* ============================================================
   Админка — sidebar-layout
   ============================================================ */

/* ============= Auth overlay ============= */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #1c1c1b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 200ms ease;
}

.auth-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-card {
  background: #232321;
  border: 1px solid #313130;
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.5);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e8e6e0;
  margin: 0;
}

.auth-sub {
  font-size: 13px;
  color: #8b8b85;
  margin: -10px 0 4px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-field span {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b8b85;
}

.auth-field input {
  background: #1c1c1b;
  border: 1px solid #3a3a38;
  border-radius: 8px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  color: #e8e6e0;
  transition: border-color 160ms ease;
}

.auth-field input:focus {
  outline: none;
  border-color: #6ea2ff;
}

.auth-error {
  margin: 0;
  padding: 10px 14px;
  background: rgba(232, 112, 96, 0.1);
  border: 1px solid rgba(232, 112, 96, 0.3);
  border-radius: 8px;
  color: #e87060;
  font-size: 13px;
}

.app-shell[hidden] { display: none; }



html:has(body.admin-body),
.admin-body {
  background: #1c1c1b;
  color: var(--bg);
  overflow: hidden;
  height: 100%;
}

.app-shell {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ============= SIDE PANEL ============= */
.side {
  background: #232321;
  color: #e8e6e0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #313130;
}

.side-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #313130;
  flex-shrink: 0;
  min-height: 60px;
}

.side-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}

.side-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #6ea2ff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin-right: -4px;
}

.side-back[hidden] { display: none; }
.event-list-more[hidden] { display: none; }

/* ===== Category list (форматы / направления / темы) ===== */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.cat-row:hover { background: #2d2d2b; border-color: #3a3a38; }
.cat-row:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }

.cat-row-label {
  flex: 1;
  font-size: 13px;
  color: #e8e6e0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-row-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 140ms ease;
}

.cat-row:hover .cat-row-actions,
.cat-row:focus-within .cat-row-actions { opacity: 1; }

.img-controls .btn[hidden] { display: none; }
.event-card-img[hidden] { display: none; }
.ev-modal-image[hidden] { display: none; }

.side-back:hover { color: #88b6ff; }
.side-back:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; border-radius: 4px; }

.side-preview-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: #8b8b85;
  transition: background-color 160ms ease, color 160ms ease;
}

.side-preview-link:hover { background: #2d2d2b; color: #e8e6e0; }

.side-view {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 24px;
}

.side-view-edit { padding: 16px 18px 24px; }

/* ===== Add button ===== */
.add-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #2d2d2b;
  color: #6ea2ff;
  border: 1px solid #3a3a38;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
  margin-bottom: 16px;
}

.add-btn:hover { background: #353533; border-color: #4a4a48; }
.add-btn:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }

.add-btn-plus {
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

/* ===== Section rows (Past Events, etc.) ===== */
.section-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 24px;
}

.section-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #2d2d2b;
  border: none;
  border-radius: 10px;
  padding: 14px 16px;
  color: #e8e6e0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease;
}

.section-row:hover { background: #353533; }
.section-row:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }

.section-row-label { flex: 1; }

.section-row-count {
  font-size: 12px;
  font-weight: 600;
  background: #1c1c1b;
  color: #8b8b85;
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px;
  text-align: center;
}

.section-row svg { color: #6b6b66; }

/* ===== List header ===== */
.event-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b8b85;
}

.event-list-count {
  font-size: 11px;
  color: #6b6b66;
}

/* ===== Event list ===== */
.event-list {
  display: flex;
  flex-direction: column;
}

.event-list-row {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.event-list-row:hover { background: #2d2d2b; }
.event-list-row:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }
.event-list-row.is-hidden { opacity: 0.5; }

.event-list-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #3a3a38 center/cover no-repeat;
  flex-shrink: 0;
}

.event-list-text {
  min-width: 0;
}

.event-list-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  color: #e8e6e0;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-list-date {
  font-size: 11px;
  color: #8b8b85;
  margin-top: 2px;
}

.event-list-more {
  background: transparent;
  border: none;
  color: #6b6b66;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 140ms ease, color 140ms ease;
}

.event-list-more:hover { background: #1c1c1b; color: #e8e6e0; }
.event-list-more:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }

/* ===== Empty / help ===== */
.empty-line {
  color: #6b6b66;
  font-size: 13px;
  text-align: center;
  padding: 24px 12px;
}

.side-help {
  font-size: 13px;
  color: #8b8b85;
  line-height: 1.5;
  margin: 0 0 16px;
}

/* ============= EDIT FORM ============= */
.ed-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ed-field { display: flex; flex-direction: column; gap: 6px; }

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

.ed-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b8b85;
}

.ed-field input[type="text"],
.ed-field input[type="url"],
.ed-field input[type="date"],
.ed-field input[type="time"],
.ed-field select,
.ed-field textarea {
  background: #1c1c1b;
  border: 1px solid #3a3a38;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: #e8e6e0;
  width: 100%;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.ed-field input::placeholder,
.ed-field textarea::placeholder { color: #5a5a55; }

.ed-field input:focus,
.ed-field textarea:focus,
.ed-field select:focus {
  outline: none;
  border-color: #6ea2ff;
  background: #1c1c1b;
}

/* ===== Rich text editor ===== */
.rt-editor {
  border: 1px solid #3a3a38;
  border-radius: 8px;
  background: #1c1c1b;
  overflow: hidden;
}

.rt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  background: #232321;
  border-bottom: 1px solid #3a3a38;
}

.rt-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #8b8b85;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background-color 140ms ease, color 140ms ease;
}

.rt-btn:hover { background: #2d2d2b; color: #e8e6e0; }
.rt-btn.is-active { background: #2d2d2b; color: #e8e6e0; }
.rt-btn:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 1px; }

.rt-sep {
  width: 1px;
  height: 18px;
  background: #3a3a38;
  margin: 0 4px;
}

.rt-content {
  min-height: 120px;
  padding: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: #e8e6e0;
  outline: none;
}

.rt-content:empty::before {
  content: attr(data-placeholder);
  color: #5a5a55;
  pointer-events: none;
}

.rt-content p { margin: 0 0 10px; }
.rt-content p:last-child { margin-bottom: 0; }
.rt-content ul, .rt-content ol { padding-left: 20px; margin: 0 0 10px; }
.rt-content li { margin-bottom: 4px; }
.rt-content a { color: #6ea2ff; text-decoration: underline; }
.rt-content b, .rt-content strong { font-weight: 700; }

/* ===== Image uploader ===== */
.img-uploader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.img-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1c1c1b center/cover no-repeat;
  border: 1px dashed #3a3a38;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #5a5a55;
  font-size: 13px;
}

.img-preview.has-image { border-style: solid; }
.img-preview.has-image .img-placeholder { display: none; }

.img-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== Fieldset (button, visibility) ===== */
.ed-fieldset {
  margin: 0;
  padding: 14px 14px 16px;
  border: 1px solid #3a3a38;
  border-radius: 10px;
  background: #1c1c1b;
}

.ed-legend {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b8b85;
  padding: 0 6px;
  margin-left: -6px;
}

.ed-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  color: #e8e6e0;
}

.ed-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

.ed-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #3a3a38;
  flex-shrink: 0;
  transition: background-color 200ms ease;
}

.ed-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e8e6e0;
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.ed-toggle input:checked + .ed-toggle-track {
  background: #6ea2ff;
}

.ed-toggle input:checked + .ed-toggle-track .ed-toggle-thumb {
  transform: translateX(16px);
}

.ed-toggle input:focus-visible + .ed-toggle-track {
  outline: 2px solid #6ea2ff;
  outline-offset: 2px;
}

.ed-toggle-text { flex: 1; }

.ed-toggle-fields {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ed-toggle-fields[hidden] { display: none; }

/* ===== Edit footer ===== */
.ed-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid #3a3a38;
  margin-top: 6px;
}

/* ============= PREVIEW PANE ============= */
.preview-pane {
  background: var(--bg);
  overflow-y: auto;
}

#preview-frame {
  width: 100%;
  height: 100%;        /* стартовое значение; JS подставит реальную высоту контента */
  min-height: 100%;
  border: none;
  display: block;
}

/* ============= Buttons ============= */
.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 100ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid #6ea2ff; outline-offset: 2px; }
.btn:active { transform: scale(0.98); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-block + .btn-block { margin-top: 8px; }

.btn-primary {
  background: #6ea2ff;
  color: #0c1a2e;
}
.btn-primary:hover { background: #88b6ff; }

.btn-ghost {
  background: #2d2d2b;
  color: #e8e6e0;
  border-color: #3a3a38;
}
.btn-ghost:hover { background: #353533; border-color: #4a4a48; }

.btn-danger {
  background: transparent;
  color: #e87060;
  border-color: rgba(232, 112, 96, 0.3);
}
.btn-danger:hover { background: rgba(232, 112, 96, 0.1); border-color: #e87060; }

/* ============= Context menu ============= */
.ctx-menu {
  position: fixed;
  z-index: 200;
  background: #2d2d2b;
  border: 1px solid #3a3a38;
  border-radius: 10px;
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.5);
  animation: ctxIn 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ctx-menu[hidden] { display: none; }

@keyframes ctxIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  color: #e8e6e0;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.ctx-item:hover { background: #353533; }
.ctx-item-danger { color: #e87060; }
.ctx-item-danger:hover { background: rgba(232, 112, 96, 0.15); }
.ctx-item svg { color: currentColor; opacity: 0.8; }

/* ============= Toast ============= */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1c1c1b;
  color: #e8e6e0;
  border: 1px solid #3a3a38;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 250;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
  animation: toastIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast[hidden] { display: none; }
.toast.is-error { color: #e87060; border-color: rgba(232, 112, 96, 0.4); }

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============= Responsive ============= */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .preview-pane { display: none; }
  .side { border-right: none; }
}
