/*
 * Admin console styling — neutral, classic, and deliberately separate from the
 * invitation's ornate look. Plain CSS, no framework.
 */

:root {
  --admin-bg: #f5f6f8;
  --admin-surface: #ffffff;
  --admin-ink: #1f2430;
  --admin-muted: #6b7280;
  --admin-line: #e3e6eb;
  --admin-accent: #b8835c;
  --admin-green: #2f855a;
}

* {
  box-sizing: border-box;
}

body.admin {
  margin: 0;
  background: var(--admin-bg);
  color: var(--admin-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

/* ---- Sidebar layout ----------------------------------------------------- */

.admin-layout {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.admin-sidebar {
  flex: 0 0 15rem;
  width: 15rem;
  min-height: 100vh;
  background: var(--admin-surface);
  border-right: 1px solid var(--admin-line);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
}

/* Push the signed-in user block to the bottom of the sidebar. */
.admin-sidebar__user {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--admin-line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-sidebar__email {
  font-size: 0.8rem;
  color: var(--admin-muted);
  word-break: break-all;
}

.admin-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem 1.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-line);
}

.admin__brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--admin-ink);
  text-decoration: none;
}

.admin__tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
  background: var(--admin-accent);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

/* ---- Account/event switcher --------------------------------------------- */

.admin-switcher {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.5rem 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--admin-line);
}

.admin-switcher__form,
.admin-switcher__static,
.admin-switcher__empty {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.admin-switcher__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
}

.admin-switcher__value {
  font-size: 0.9rem;
  font-weight: 600;
}

.admin-switcher select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  background: var(--admin-surface);
  color: var(--admin-ink);
}

.admin-switcher__empty p.empty {
  padding: 0;
  margin: 0;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-nav__link {
  display: block;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  color: var(--admin-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.admin-nav__link:hover {
  background: var(--admin-bg);
  color: var(--admin-ink);
}

.admin-nav__link.is-active {
  background: var(--admin-accent);
  color: #fff;
}

.admin__main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3rem;
}

@media (max-width: 42rem) {
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    min-height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--admin-line);
  }

  .admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* ---- Flash messages ----------------------------------------------------- */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.flash--notice {
  background: #e6f4ec;
  color: var(--admin-green);
}

.flash--alert {
  background: #fdf0dd;
  color: #92400e;
}

/* ---- Headings ---------------------------------------------------------- */

.admin__title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
}

.admin__section-title {
  margin: 2rem 0 0.75rem;
  font-size: 1.05rem;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Stat cards -------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* The per-event cards on events#index nest .stats inside .card__body, which
   supplies its own padding -- the standalone spacing would double up there. */
.card__body .stats {
  margin-bottom: 0;
}

.stat {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
}

.stat__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat__label {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

.stat__sub {
  color: var(--admin-muted);
  font-weight: 400;
  font-size: 1.1rem;
}

/* ---- Invitation lists ------------------------------------------------------- */

.invitation-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  overflow: hidden;
}

.invitation-table th,
.invitation-table td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--admin-line);
  font-size: 0.95rem;
}

.invitation-table th {
  background: #fafbfc;
  color: var(--admin-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.invitation-table tr:last-child td {
  border-bottom: none;
}

.invitation-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-weight: 600;
}

.badge--confirmed {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--pending {
  color: #92400e;
  background: #fdf0dd;
}

.badge--declined {
  color: #b91c1c;
  background: #fbe9e9;
}

.badge--active {
  color: #fff;
  background: var(--admin-accent);
}

.badge--owner {
  color: #fff;
  background: var(--admin-accent);
}

.badge--admin {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--member {
  color: var(--admin-muted);
  background: var(--admin-line);
}

.badge--queued {
  color: var(--admin-muted);
  background: var(--admin-line);
}

.badge--sent {
  color: var(--admin-accent);
  background: #e7edfb;
}

.badge--delivered {
  color: var(--admin-green);
  background: #e6f4ec;
}

.badge--failed {
  color: #92400e;
  background: #fdf0dd;
}

.empty {
  color: var(--admin-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

.invitation-table td.actions {
  white-space: nowrap;
}

.invitation-table td.actions a {
  margin-right: 0.75rem;
  font-size: 0.85rem;
}

/* ---- Icons -------------------------------------------------------------- */

.icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.icon-link .icon {
  width: 0.95rem;
  height: 0.95rem;
}

.icon-link--danger {
  color: #b91c1c;
}

.icon-link--danger:hover {
  color: #991b1b;
}

/* ---- Header / actions / buttons ----------------------------------------- */

.admin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin__header .admin__title {
  margin: 0;
}

/* .admin__actions has a single consumer (events/show.html.slim). Centering it
   visually balances the button row against the full-width Detalles card that
   auto-fit grid produces in .card-grid--tight directly below it. */
.admin__actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Shared button component. Works uniformly across links (<a>), <button>, and
   submit/button inputs so every action in the console looks the same. */
.button,
button.button,
input[type="submit"].button,
input[type="button"].button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid var(--admin-line);
  color: var(--admin-ink);
  background: var(--admin-surface);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.button .icon {
  width: 1rem;
  height: 1rem;
}

.button--primary {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

/* Full-width variant for stacked contexts (sidebar sign-out, login submit). */
.button--block {
  width: 100%;
}

/* button_to renders a wrapping <form>; keep it from adding layout/spacing so the
   button behaves like any other .button in flex/stacked containers. */
form.button_to {
  margin: 0;
  display: contents;
}

/* ---- Forms --------------------------------------------------------------- */

.form-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-muted);
}

.form-field input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-errors {
  background: #fdf0dd;
  border: 1px solid #f0d3a8;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  color: #92400e;
}

.form-errors h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

/* ---- Invitation details --------------------------------------------------- */

.invitation-details {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  overflow: hidden;
}

.invitation-details__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--admin-line);
}

.invitation-details__row:last-child {
  border-bottom: none;
}

.invitation-details__label {
  color: var(--admin-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ---- Cards -------------------------------------------------------------- */

.card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.04), 0 6px 16px rgba(31, 36, 48, 0.05);
  overflow: hidden;
}

.card--link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card--link:hover {
  border-color: var(--admin-accent);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #fafbfc;
  border-bottom: 1px solid var(--admin-line);
}

.card__title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--admin-muted);
}

.card__body {
  padding: 1.25rem;
}

.card__footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: #fafbfc;
  border-top: 1px solid var(--admin-line);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
  align-items: start;
}

/* Wider minimum for the operational band (Detalles / Invitaciones), so those
   two cards sit side by side rather than wrapping to three narrow columns. */
.card-grid--tight {
  grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
}

/* ---- Page head (show / edit) ------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.page-head__main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.page-head__main .admin__title {
  margin: 0;
}

.page-head__actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

/* ---- Definition-list details ------------------------------------------- */

.detail-list {
  margin: 0;
}

.detail-list__row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.detail-list__row:first-child {
  padding-top: 0;
}

.detail-list__row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.detail-list dt {
  color: var(--admin-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-list dd {
  margin: 0;
  font-size: 0.98rem;
}

.detail-list dd.is-muted {
  color: var(--admin-muted);
  font-style: italic;
}

/* Freeform copy (intro quote, greeting, dress-code note) keeps its authored
   line breaks without needing a helper to turn them into <br>. */
.detail-list dd.is-copy {
  white-space: pre-line;
}

.detail-count {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.detail-count__unit {
  color: var(--admin-muted);
  font-size: 0.9rem;
  margin-left: 0.3rem;
}

/* ---- Public link box --------------------------------------------------- */

.link-box {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--admin-ink);
  background: var(--admin-bg);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  word-break: break-all;
  margin: 0.5rem 0 1rem;
}

/* ---- Read-only content overview (admin/events/show) --------------------- */

/* Honest inline note — e.g. "this content isn't editable from the console
   yet". Deliberately not a .flash: it's a permanent property of the page, not
   the result of an action. */
.callout {
  margin: 0 0 1.25rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--admin-line);
  border-left: 3px solid var(--admin-accent);
  border-radius: 8px;
  background: var(--admin-surface);
  color: var(--admin-muted);
  font-size: 0.85rem;
}

/* Generic name + supporting-lines list, shared by hosts, venues and lodgings. */
.content-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.content-list__item {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.content-list__item:first-child {
  padding-top: 0;
}

.content-list__item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.content-list__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.content-list__meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--admin-muted);
}

/* Agenda entries keep their authored order; the fixed time column is what
   makes the list read as a timeline. */
.agenda-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.agenda-list__item {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--admin-line);
}

.agenda-list__item:first-child {
  padding-top: 0;
}

.agenda-list__item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.agenda-list__time {
  color: var(--admin-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agenda-list__label {
  font-size: 0.95rem;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.swatch {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 1px solid var(--admin-line);
}

/* Thumbnails are sized down with object-fit rather than Active Storage
   variants, so the overview never depends on image processing being
   available. */
.content-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.content-thumbs:last-child {
  margin-bottom: 0;
}

.content-thumb {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--admin-line);
  background: var(--admin-bg);
}

.content-copy {
  margin: 0;
  font-size: 0.95rem;
  white-space: pre-line;
}

/* ---- Button hover + form polish ---------------------------------------- */

.button:hover {
  border-color: var(--admin-muted);
}

.button--primary:hover {
  filter: brightness(0.95);
  border-color: var(--admin-accent);
}

.form-field input:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(184, 131, 92, 0.16);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.form-help {
  font-size: 0.8rem;
  color: var(--admin-muted);
  margin: 0.15rem 0 0;
}

@media (max-width: 32rem) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Pagination (Kaminari default theme) ------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 1.5rem;
}

.pagination a,
.pagination .current,
.pagination .gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--admin-line);
  background: var(--admin-surface);
  color: var(--admin-ink);
}

.pagination a:hover {
  border-color: var(--admin-muted);
  background: var(--admin-bg);
}

.pagination .current {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

.pagination .gap {
  border-color: transparent;
  background: transparent;
  color: var(--admin-muted);
  min-width: auto;
  padding: 0 0.25rem;
}

.table-caption {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--admin-muted);
  text-align: center;
}

/* ---- Invitation status filters ------------------------------------------ */

.invitation-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.1rem;
}

.invitation-filters a {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--admin-muted);
  border: 1px solid var(--admin-line);
  background: var(--admin-surface);
  transition: border-color 0.1s, color 0.1s;
}

.invitation-filters a:hover {
  border-color: var(--admin-muted);
  color: var(--admin-ink);
}

.invitation-filters a.is-active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

/* ---- Auth / login screen ------------------------------------------------ */

.auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth__card {
  width: 100%;
  max-width: 22rem;
  background: var(--admin-surface);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(31, 36, 48, 0.04), 0 6px 16px rgba(31, 36, 48, 0.05);
  padding: 1.75rem;
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.auth__title {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
}

.auth__remember {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0 1rem;
  font-size: 0.9rem;
  color: var(--admin-muted);
}

.auth__actions {
  margin-top: 0.25rem;
}
