/* ============================================================
   Momenti — Admin-App „Mitternacht & Kerzenlicht“
   Baut auf tokens.css auf. Desktop-first, responsive.
   ============================================================ */

/* ---------- Grundgerüst ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.section-title {
  font-size: 22px;
  margin-bottom: 16px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(20, 14, 27, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--m-line);
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.logout-form {
  margin: 0;
  display: inline-flex;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--m-r-pill);
  background: transparent;
  color: var(--m-text-dim);
  font: 600 15px/1 var(--m-font-body);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.topbar-link:hover {
  color: var(--m-text);
  background: rgba(246, 239, 231, 0.07);
}

/* ---------- Meldungen ---------- */
.alert {
  border: 1px solid;
  border-radius: var(--m-r-input);
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 15px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.alert-ok {
  background: rgba(123, 224, 173, 0.1);
  border-color: rgba(123, 224, 173, 0.32);
  color: var(--m-live);
}

.alert-error {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.38);
  color: #ffb0b0;
}

.alert.is-hiding {
  opacity: 0;
  transform: translateY(-6px);
}

/* ---------- Auth-Seiten: Karte im Kerzenschein ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  animation: m-rise 0.5s ease both;
}

/* Signatur: sanfter Kerzenschein-Glow hinter der Karte */
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: -140px -180px;
  background: radial-gradient(
    closest-side,
    rgba(255, 180, 84, 0.16),
    rgba(255, 123, 166, 0.06) 55%,
    transparent 78%
  );
  pointer-events: none;
  z-index: 0;
}

.auth-brand,
.auth-card,
.auth-switch {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.auth-claim {
  margin: 0;
  color: var(--m-text-dim);
  font-size: 15px;
}

.auth-card {
  width: 100%;
  padding: 28px;
}

.auth-title {
  font-size: 24px;
  margin-bottom: 18px;
}

.auth-alt {
  margin: 18px 0 0;
  text-align: center;
  font-size: 14px;
}

.auth-switch {
  margin: 0;
  color: var(--m-text-dim);
  font-size: 14px;
}

.auth-note {
  margin: 0 0 18px;
  color: var(--m-text-dim);
  font-size: 14.5px;
}

.btn-block {
  width: 100%;
}

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--m-text-faint);
}

/* ---------- Dashboard ---------- */
.hero {
  margin: 12px 0 32px;
}

.hero-title {
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.15;
}

.hero-name {
  background: var(--m-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  margin: 8px 0 0;
  color: var(--m-text-dim);
  font-size: 16px;
  max-width: 56ch;
}

.new-event-card {
  padding: 24px 28px;
  margin-bottom: 40px;
  border-color: rgba(255, 180, 84, 0.22);
  animation: m-rise 0.5s ease both;
}

.new-event-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 16px;
  align-items: end;
}

.new-event-form .field {
  margin-bottom: 0;
}

.new-event-submit {
  white-space: nowrap;
}

.events-title {
  margin-bottom: 18px;
}

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

.event-card {
  display: block;
  padding: 22px 24px;
  text-decoration: none;
  color: var(--m-text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: m-rise 0.5s ease both;
}

.event-grid .event-card:nth-child(1) { animation-delay: 0.04s; }
.event-grid .event-card:nth-child(2) { animation-delay: 0.09s; }
.event-grid .event-card:nth-child(3) { animation-delay: 0.14s; }
.event-grid .event-card:nth-child(4) { animation-delay: 0.19s; }
.event-grid .event-card:nth-child(5) { animation-delay: 0.24s; }
.event-grid .event-card:nth-child(n + 6) { animation-delay: 0.28s; }

.event-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 180, 84, 0.4);
  box-shadow: var(--m-shadow);
}

.event-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.event-card-title {
  font-size: 19px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.event-period {
  margin: 10px 0 0;
  color: var(--m-text-dim);
  font-size: 14px;
}

.event-stats {
  margin: 6px 0 0;
  color: var(--m-text-faint);
  font-size: 14px;
}

.event-stats-sep {
  margin: 0 6px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--m-line-strong);
  border-radius: var(--m-r-card);
}

.empty-title {
  font-size: 20px;
}

.empty-text {
  margin: 10px auto 0;
  color: var(--m-text-dim);
  max-width: 48ch;
}

/* ---------- Event-Detail ---------- */
.breadcrumb {
  margin-bottom: 14px;
}

.back-link {
  color: var(--m-text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--m-amber);
}

.detail-head {
  margin-bottom: 28px;
}

.detail-title {
  font-size: clamp(26px, 4vw, 34px);
  overflow-wrap: anywhere;
}

.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 0;
}

.detail-period {
  color: var(--m-text-dim);
  font-size: 15px;
}

.detail-stats {
  margin: 8px 0 0;
  color: var(--m-text-faint);
  font-size: 14px;
}

/* QR-Karte: das Herzstück */
.qr-card {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 28px;
  animation: m-rise 0.5s ease both;
}

.qr-frame {
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--m-shadow-soft), var(--m-glow-amber);
}

.qr-frame img {
  width: 220px;
  height: 220px;
  border-radius: 8px;
}

.qr-info {
  flex: 1;
  min-width: 0;
}

.qr-text {
  margin: 0 0 18px;
  color: var(--m-text-dim);
  max-width: 52ch;
}

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

.guest-link-input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--m-text-dim);
}

.copy-btn {
  flex-shrink: 0;
}

.copy-btn.is-copied {
  border-color: var(--m-live);
  color: var(--m-live);
}

.qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin: 36px 0 26px;
  border-bottom: 1px solid var(--m-line);
  overflow-x: auto;
}

.tab {
  position: relative;
  flex-shrink: 0;
  background: none;
  border: 0;
  padding: 10px 16px 14px;
  color: var(--m-text-dim);
  font: 600 15px/1 var(--m-font-body);
  cursor: pointer;
  transition: color 0.15s ease;
}

.tab:hover {
  color: var(--m-text);
}

.tab.is-active {
  color: var(--m-text);
}

.tab.is-active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px;
  background: var(--m-gradient);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
  animation: m-rise 0.35s ease both;
}

/* ---------- Galerie ---------- */
.guest-section {
  margin-bottom: 36px;
}

.guest-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.guest-name {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.guest-count {
  flex-shrink: 0;
}

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

.photo-tile {
  margin: 0;
}

.photo-link {
  display: block;
  border-radius: 12px;
}

.photo-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--m-surface-2);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.photo-tile img:hover {
  transform: scale(1.02);
  box-shadow: var(--m-shadow-soft);
}

.photo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--m-text-dim);
}

.photo-stats {
  display: inline-flex;
  gap: 12px;
}

.photo-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.photo-stat svg {
  opacity: 0.75;
}

.photo-delete-form {
  margin: 0;
}

.photo-delete {
  background: none;
  border: 0;
  padding: 2px 4px;
  color: var(--m-text-faint);
  font: 600 12.5px/1 var(--m-font-body);
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.photo-delete:hover {
  color: var(--m-danger);
}

/* ---------- Beste Momente ---------- */
.best-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.best-item {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
}

.best-item.best-top {
  border-color: rgba(255, 180, 84, 0.45);
}

.best-item.best-rank-1 {
  box-shadow: var(--m-shadow-soft), var(--m-glow-amber);
}

.best-rank {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--m-surface-2);
  color: var(--m-text-dim);
  font: 700 15px/1 var(--m-font-display);
}

.best-item.best-top .best-rank {
  background: var(--m-gradient);
  color: var(--m-on-accent);
}

.best-photo {
  flex-shrink: 0;
  display: block;
  border-radius: 10px;
}

.best-photo img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--m-surface-2);
}

.best-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.best-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.best-likes {
  flex-shrink: 0;
  color: var(--m-amber);
  font-weight: 600;
  font-size: 14.5px;
}

/* ---------- Einstellungen & Profil ---------- */
.settings-grid,
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}

.form-card {
  padding: 24px 28px;
}

.danger-zone {
  padding: 24px 28px;
  border-color: rgba(255, 107, 107, 0.35);
}

.danger-title {
  color: var(--m-danger);
}

.danger-text {
  margin: 0 0 18px;
  color: var(--m-text-dim);
  font-size: 14.5px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--m-line);
  padding: 24px;
  text-align: center;
}

.site-footer-text {
  margin: 0;
  color: var(--m-text-faint);
  font-size: 13.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .new-event-form {
    grid-template-columns: 1fr 1fr;
  }

  .new-event-title-field {
    grid-column: 1 / -1;
  }

  .new-event-submit {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .container {
    padding: 24px 16px 64px;
  }

  .topbar-inner {
    padding: 12px 16px;
  }

  .topbar-link {
    padding: 8px 10px;
    font-size: 14px;
  }

  .qr-card {
    flex-direction: column;
    text-align: center;
  }

  .qr-info {
    width: 100%;
  }

  .qr-text {
    margin-left: auto;
    margin-right: auto;
  }

  .guest-link-row {
    flex-direction: column;
  }

  .qr-actions {
    justify-content: center;
  }

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

  .best-item {
    gap: 12px;
    padding: 10px 14px;
  }

  .best-photo img {
    width: 56px;
    height: 56px;
  }
}
