/* Panel de administración: estética propia, independiente del tema de cada evento. */

:root {
  color-scheme: light;
  --a-bg: #f5f4f8;
  --a-panel: #ffffff;
  --a-ink: #1d1b22;
  --a-muted: #6b6775;
  --a-line: #e5e2eb;
  --a-soft: #f0eef5;
  --a-brand: #6f42e8;
  --a-brand-ink: #ffffff;
  --a-brand-soft: #efe9ff;
  --a-danger: #c62f45;
  --a-ok: #1f8f5c;
  --a-ok-soft: #e3f5ec;
  --a-warn: #9a6512;
  --a-warn-soft: #fdf1dc;
  --a-shadow: 0 1px 2px rgba(20, 16, 40, 0.06), 0 8px 24px -12px rgba(20, 16, 40, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --a-bg: #121116;
    --a-panel: #1b1a21;
    --a-ink: #f0eef5;
    --a-muted: #a29daf;
    --a-line: #2d2a36;
    --a-soft: #24222c;
    --a-brand: #9d7bff;
    --a-brand-ink: #14101f;
    --a-brand-soft: #2a2340;
    --a-danger: #ff6b7f;
    --a-ok: #4fd393;
    --a-ok-soft: #173326;
    --a-warn: #f0b860;
    --a-warn-soft: #33270f;
    --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  }
}

body {
  min-height: 100vh;
  background: var(--a-bg);
  color: var(--a-ink);
  font-size: 15px;
}

a {
  color: inherit;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.7rem;
  font-weight: 700;
}

h2 {
  font-size: 1.02rem;
  font-weight: 700;
}

.muted {
  color: var(--a-muted);
}

.small {
  font-size: 0.82rem;
}

/* ---------- Barra superior ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--a-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--a-line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
}

.logo-mark {
  width: 26px;
  height: 30px;
  border-radius: 3px;
  background: #fff;
  border: 4px solid #fff;
  border-bottom-width: 9px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  background-image: linear-gradient(135deg, var(--a-brand), #e86fa8);
  transform: rotate(-6deg);
}

.logo-tag {
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--a-brand-soft);
  color: var(--a-brand);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin {
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 80px;
}

/* ---------- Botones ---------- */

.btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--a-line);
  background: var(--a-panel);
  color: var(--a-ink);
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: none;
}

.btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--a-brand) 40%, var(--a-line));
}

.btn.primary {
  background: var(--a-brand);
  border-color: var(--a-brand);
  color: var(--a-brand-ink);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: var(--a-danger);
  border-color: color-mix(in srgb, var(--a-danger) 35%, var(--a-line));
}

.btn.sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.83rem;
  border-radius: 9px;
}

.btn:focus-visible,
.tab:focus-visible,
.event-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--a-brand) 45%, transparent);
  outline-offset: 2px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Paneles ---------- */

.panel {
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--a-shadow);
}

.panel > h2 {
  margin-bottom: 14px;
}

.page-head {
  display: grid;
  gap: 6px;
  margin-bottom: 24px;
}

.page-head.row,
.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.crumb {
  justify-self: start;
  color: var(--a-muted);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.crumb:hover {
  color: var(--a-ink);
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--a-warn-soft);
  color: var(--a-warn);
  font-size: 0.86rem;
  line-height: 1.45;
}

.notice strong {
  font-weight: 700;
}

.notice code {
  padding: 1px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--a-warn) 15%, transparent);
  font-size: 0.82rem;
}

.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--a-muted);
}

.loading {
  display: grid;
  place-items: center;
  padding: 80px 0;
}

.loading .spinner {
  border-color: var(--a-line);
  border-top-color: var(--a-brand);
}

/* ---------- Login ---------- */

.login {
  width: min(100%, 380px);
  margin: 10vh auto 0;
  display: grid;
  gap: 16px;
  padding: 28px;
}

/* ---------- Lista de eventos ---------- */

.event-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.event-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--a-panel);
  border: 1px solid var(--a-line);
  border-radius: 16px;
  box-shadow: var(--a-shadow);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.event-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--a-brand) 35%, var(--a-line));
}

.event-card-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.event-card-body strong {
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending {
  color: var(--a-warn);
}

.chip {
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--a-soft);
  color: var(--a-muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.chip.on {
  background: var(--a-ok-soft);
  color: var(--a-ok);
}

/* Muestras de color de los temas */
.theme-swatch {
  position: relative;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid var(--a-line);
}

.theme-swatch i {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.theme-noche {
  background: linear-gradient(135deg, #0d0b1f, #2a1f4d 55%, #4b2a5e);
}
.theme-rosa {
  background: linear-gradient(135deg, #fff5f7, #fbd9e3 55%, #efb8cb);
}
.theme-blanco {
  background: linear-gradient(135deg, #fdfbf6, #f2ebdd 55%, #e3d7bf);
}
.theme-esmeralda {
  background: linear-gradient(135deg, #03201a, #0b3a2f 55%, #14594a);
}

/* ---------- Formulario ---------- */

.editor {
  display: grid;
  gap: 18px;
  max-width: 860px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
}

.span-2 {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > span,
.field > legend {
  font-size: 0.84rem;
  font-weight: 650;
  padding: 0;
}

.field small {
  color: var(--a-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.field input:not([type='checkbox'], [type='radio'], [type='color']),
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: var(--a-panel);
  font-size: 0.93rem;
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--a-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--a-brand) 20%, transparent);
}

.field.invalid input {
  border-color: var(--a-danger);
}

.prefix,
.suffix {
  display: flex;
  align-items: center;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--a-panel);
}

.prefix > span,
.suffix > span {
  padding: 0 10px;
  color: var(--a-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.prefix input,
.suffix input {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.prefix > span {
  border-right: 1px solid var(--a-line);
  align-self: stretch;
  display: grid;
  place-items: center;
  background: var(--a-soft);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-row input[type='color'] {
  width: 56px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--a-line);
  border-radius: 10px;
  background: var(--a-panel);
  cursor: pointer;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.theme-option {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 12px 8px;
  border: 2px solid var(--a-line);
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.theme-option:has(input:checked) {
  border-color: var(--a-brand);
  background: var(--a-brand-soft);
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-option .theme-swatch {
  width: 100%;
  height: 56px;
}

.radio-card {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--a-line);
  border-radius: 12px;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--a-brand);
  background: var(--a-brand-soft);
}

.radio-card input {
  margin-top: 3px;
  accent-color: var(--a-brand);
}

.radio-card span {
  display: grid;
  gap: 2px;
}

.radio-card + .radio-card {
  margin-top: 8px;
}

/* Interruptores */
.switch {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-ui {
  flex: none;
  position: relative;
  width: 42px;
  height: 24px;
  margin-top: 1px;
  border-radius: 99px;
  background: var(--a-line);
  transition: background 0.2s ease;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-ui {
  background: var(--a-brand);
}

.switch input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-ui {
  outline: 3px solid color-mix(in srgb, var(--a-brand) 45%, transparent);
  outline-offset: 2px;
}

.switch-text {
  display: grid;
  gap: 2px;
  font-size: 0.9rem;
  font-weight: 600;
}

.switch-text small {
  font-weight: 400;
  color: var(--a-muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.spacer {
  flex: 1;
}

/* ---------- Vista de evento ---------- */

.event-title {
  font-family: var(--font-script);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1.1;
}

.event-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.side {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 76px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--a-soft);
}

.tab {
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--a-muted);
  font-size: 0.84rem;
  font-weight: 650;
}

.tab[aria-selected='true'] {
  background: var(--a-panel);
  color: var(--a-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tab b {
  margin-left: 4px;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--a-line);
  font-size: 0.74rem;
}

.tab.has-pending b {
  background: var(--a-warn);
  color: #fff;
}

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

.post {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--a-line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--a-panel);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.post.leaving {
  opacity: 0;
  transform: scale(0.96);
}

.post-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #15131a;
}

.post-media img,
.post-media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-note {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  background: linear-gradient(150deg, #fbe9c9, #fffaf0 70%);
  color: #2b2622;
  font-family: 'Caveat Variable', 'Segoe Print', cursive;
  font-size: 1.35rem;
  line-height: 1.1;
  text-align: center;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.kind-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.post-body {
  flex: 1;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px 12px 6px;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.88rem;
}

.post-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-meta time {
  color: var(--a-muted);
  font-size: 0.8rem;
}

.post-message {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--a-muted);
  overflow-wrap: anywhere;
}

.flag {
  margin: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--a-warn-soft);
  color: var(--a-warn);
  font-size: 0.76rem;
  font-weight: 700;
}

.post-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 12px;
}

.post-actions .delete {
  margin-left: auto;
  color: var(--a-danger);
  border-color: transparent;
  background: none;
}

.qr-preview {
  width: 160px;
  margin: 0 auto 14px;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--a-line);
}

.link-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.link-row input {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--a-line);
  border-radius: 9px;
  background: var(--a-soft);
  font-size: 0.8rem;
  color: var(--a-muted);
}

.link-label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--a-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.toggles {
  display: grid;
  gap: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.stats div {
  padding: 10px 4px;
  border-radius: 12px;
  background: var(--a-soft);
}

.stats strong {
  display: block;
  font-size: 1.4rem;
}

.stats span {
  font-size: 0.75rem;
  color: var(--a-muted);
}

.screen-panel .btn.primary {
  width: 100%;
  margin-bottom: 10px;
}

.screen-panel .btn-row .btn {
  flex: 1;
}

@media (max-width: 960px) {
  .event-grid {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    order: -1;
  }
}

@media (max-width: 640px) {
  .grid-2,
  .theme-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2 > .field:not(.switch) {
    grid-column: 1 / -1;
  }

  .event-title {
    font-size: 2.4rem;
  }

  .posts {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* El toast de base.css también funciona acá */
.toast {
  background: var(--a-ink);
  color: var(--a-bg);
}
