/* Admin-only additions. Layered on site.css for shared base
   (body/header/h1/color tokens/font/.muted). */

:root {
  --error-bg: #fff0f0;
  --error-text: #8a1f1f;
  --disabled-bg: #f0f0eb;
}

@media (prefers-color-scheme: dark) {
  :root {
    --error-bg: #2a0e0e;
    --error-text: #f08080;
    --disabled-bg: #252520;
  }
}

body.narrow { max-width: 720px; }

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

h2 {
  font-family: 'Bungee', sans-serif;
  font-size: 16px;
  letter-spacing: 1.5px;
  margin: 24px 0 10px;
}

.box {
  border: 2px solid var(--line);
  background: var(--surface);
  padding: 20px;
}

.field { display: block; margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 4px;
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.field input:focus,
.field select:focus,
.field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field input[type="text"].otp {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 8px;
  text-align: center;
}
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:disabled { background: var(--disabled-bg); cursor: not-allowed; opacity: 0.7; }

button.primary {
  background: var(--text);
  color: var(--bg);
  border: 2px solid var(--line);
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
button.primary:hover { background: var(--accent); border-color: var(--accent); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary, a.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}
button.secondary:hover, a.secondary:hover { background: var(--hover); }

.error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-text);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.events-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.events-table th, .events-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
}
.events-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

/* Layered on site.css's .muted (color only). */
.muted { font-size: 13px; }

.hidden { display: none !important; }

/* Section header with title+description on the left and an action on
   the right (e.g., "+ Add event"). */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.section-header h2 { margin-top: 0; }

/* Side-by-side form fields (e.g., Date + Time). */
.row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Tag chip rows inside the event form — reuse site.css's .tag look. */
.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Small inline buttons used on event-row actions. */
.btn-small {
  background: transparent;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}
.btn-small:hover { background: var(--hover); }
.btn-small:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-small.danger { border-color: var(--accent); color: var(--accent); }
.btn-small.danger:hover { background: var(--accent); color: var(--surface); }

.actions-col { white-space: nowrap; text-align: right; width: 1%; }

/* Event dialog — modal create/edit form. */
dialog.event-dialog {
  border: 2px solid var(--line);
  background: var(--surface);
  padding: 0;
  max-width: 640px;
  width: 92vw;
  color: var(--text);
}
dialog.event-dialog::backdrop {
  background: rgba(26, 26, 26, 0.6);
}
@media (prefers-color-scheme: dark) {
  dialog.event-dialog::backdrop { background: rgba(0, 0, 0, 0.8); }
}
.event-dialog-header {
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.event-dialog-header h2 { margin: 0; }
.event-url-display {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  margin-top: 2px;
}

.image-preview {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 10px;
  display: flex;
  justify-content: center;
}
.image-preview img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.event-dialog-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}
.event-dialog-footer {
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

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