/* ═══════════════════════════════════════════════════════════════════════════
   Design System — retro-informed, not retro-replica
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Root variables ──────────────────────────────────────────────────────── */

:root {
  --bg: #f0eff4;
  --event-bg: var(--bg);
  --text: #1a1a2e;
  --link: #0055aa;
  --link-visited: #551a8b;
  --muted: #666;
  --border: #999;
  --btn-face: #c0c0c0;
  --btn-highlight: #fff;
  --btn-shadow: #808080;
  --btn-dark-shadow: #404040;
  --rainbow: linear-gradient(to right, #ff0000, #ff8800, #ffdd00, #00cc00, #0066ff, #8800ff);
}

/* ── Base ────────────────────────────────────────────────────────────────── */

html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

body {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--event-bg);
  background-repeat: repeat;
  margin: 0;
  padding: 0;
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.25;
  margin: 0.75em 0 0.4em;
}

h1 { font-size: 1.6em; }
h2 { font-size: 1.35em; }
h3 { font-size: 1.15em; }
h4 { font-size: 1em; }

p {
  margin: 0.5em 0;
}

/* ── Links ───────────────────────────────────────────────────────────────── */

a {
  color: var(--link);
  text-decoration: underline;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  color: var(--link);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.wrapper {
  max-width: 64em;
  margin: 0 auto;
  padding: 0 1em 2em;
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Rainbow HR ──────────────────────────────────────────────────────────── */

hr {
  border: none;
  height: 2px;
  background: var(--rainbow);
  margin: 12px 0;
}

/* ── Buttons (Windows 95 beveled) ────────────────────────────────────────── */

button,
.btn {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 0.85em;
  padding: 4px 12px;
  background: var(--btn-face);
  color: var(--text);
  border: 2px outset var(--btn-face);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}

button:active,
.btn:active {
  border-style: inset;
  padding: 4px 9px 2px 11px;
}

button:focus-visible,
.btn:focus-visible {
  outline: 1px dotted var(--text);
  outline-offset: -4px;
}

/* ── Form inputs ─────────────────────────────────────────────────────────── */

input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="search"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
input[type="color"],
textarea,
select {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1em;
  padding: 3px 4px;
  border: 2px inset var(--btn-face);
  background: #fff;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: 1px dotted var(--link);
  outline-offset: 0;
}

input[type="color"] {
  padding: 1px 2px;
  height: 28px;
  width: 48px;
  cursor: pointer;
}

label {
  display: inline-block;
  margin-bottom: 0.15em;
}

/* ── Form groups (replaces <br><br> spacers) ──────────────────────────────── */

.form-group {
  margin-bottom: 1em;
}

.form-group label {
  display: block;
  margin-bottom: 0.25em;
  font-weight: bold;
}

/* ── Tables (classic HTML default double-border) ──────────────────────────── */

table {
  border-collapse: separate;
  border-spacing: 2px;
  border: 2px outset #808080;
  width: 100%;
}

table th,
table td {
  border: 2px inset #808080;
  padding: 1px 4px;
  text-align: left;
  vertical-align: top;
}

table th {
  background: var(--btn-face);
  font-weight: bold;
}

/* ── Info table (event detail "When/Where/Who") ──────────────────────────── */

.info-table {
  width: 100%;
  table-layout: fixed;
  background: var(--event-table-bg, transparent);
}

.info-table td {
  padding: 4px 8px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.info-table td:first-child {
  white-space: nowrap;
  width: 5em;
  font-weight: bold;
}

.info-table td > *:first-child {
  margin-top: 0;
}

.info-table td > *:last-child {
  margin-bottom: 0;
}

.info-table ul,
.info-table ol {
  padding-left: 1.4em;
  margin: 0.4em 0;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0.5em 0;
}

.logo {
  text-decoration: none;
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  font-size: 1.1em;
  font-weight: bold;
}

.logo:visited {
  /* don't change logo colors for visited */
  color: inherit;
}

.logo span:nth-child(1)  { color: #ff0000; }
.logo span:nth-child(2)  { color: #ff6600; }
.logo span:nth-child(3)  { color: #ff9900; }
.logo span:nth-child(4)  { color: #ffdd00; }
.logo span:nth-child(5)  { color: #88cc00; }
.logo span:nth-child(6)  { color: #00cc00; }
.logo span:nth-child(7)  { color: #00aacc; }
.logo span:nth-child(8)  { color: #0066ff; }
.logo span:nth-child(9)  { color: #4400ee; }
.logo span:nth-child(10) { color: #8800ff; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}

.nav-links form {
  display: inline;
}

/* ── Error / Success messages ────────────────────────────────────────────── */

.error-msg {
  color: #cc0000;
  font-weight: bold;
}

.success-msg {
  color: #006600;
  font-weight: bold;
}

/* ── Event cards (list view) ─────────────────────────────────────────────── */

.event-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.event-card {
  display: flex;
  gap: 0;
  border: 2px outset #808080;
  padding: 2px;
  background: #f5f4f8;
  align-items: stretch;
  width: calc(50% - 6px);
}

.event-card-image {
  flex-shrink: 0;
  width: 100px;
  border: 2px inset #808080;
}

.event-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-card-info {
  flex: 1;
  min-width: 0;
  border: 2px inset #808080;
  padding: 4px 8px;
}

.event-card-info h3 {
  margin: 0 0 0.2em;
  font-size: 1.05em;
}

.event-card-meta {
  font-size: 0.9em;
  color: var(--muted);
}

.event-card-rsvp {
  font-size: 0.9em;
  margin-top: 0.2em;
}

.event-card-rsvp .count-going {
  color: #228822;
  font-weight: bold;
}

.event-card-rsvp .count-maybe {
  color: #b8860b;
  font-weight: bold;
}

/* Full width cards on small screens */
@media (max-width: 640px) {
  .event-card {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .event-card {
    flex-direction: column;
  }

  .event-card-image {
    width: 100%;
  }
}

/* ── Event detail image ──────────────────────────────────────────────────── */

.event-hero-image {
  border: 1px solid var(--border);
  display: block;
  width: 100%;
  max-width: 420px;
  margin-bottom: 12px;
  position: relative;
  z-index: -5000;
}

/* ── Event canvas (customizable zone) ────────────────────────────────────── */

.event-canvas {
  --event-text: var(--text);
  --event-table-bg: transparent;

  position: relative;
  color: var(--event-text);
  padding: 1em;
  margin: 0 -1em;
}

.event-canvas a {
  color: var(--link);
}

.event-canvas a:visited {
  color: var(--link-visited);
}

.event-canvas a:hover {
  color: var(--link);
}

.event-canvas a.btn,
.event-canvas a.btn:visited,
.event-canvas a.btn:hover {
  color: var(--text);
  text-decoration: none;
}

.event-canvas h1,
.event-canvas h2,
.event-canvas h3,
.event-canvas h4 {
  color: var(--event-text);
}

.event-canvas > h1:first-child,
.event-canvas > marquee + hr + h1 {
  margin-top: 0;
}

.event-canvas .info-table td:first-child {
  color: var(--event-text);
  font-weight: bold;
}

/* ── RSVP badges (88x31 style) ───────────────────────────────────────────── */

.rsvp-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0.75em 0;
}

.rsvp-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 31px;
  padding: 0 6px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-decoration: none;
  background: var(--btn-face);
  color: var(--text);
  border: 2px outset var(--btn-face);
}

.rsvp-badge:active {
  border-style: inset;
  transform: translate(1px, 1px);
}

.rsvp-badge--going {
  color: #228822;
}

.rsvp-badge--maybe {
  color: #b8860b;
}

/* Selected state: permanently pressed (minesweeper) */
.rsvp-badge--selected {
  border-style: inset;
  transform: translate(1px, 1px);
  background: var(--btn-shadow);
  cursor: default;
}

.rsvp-badge--selected.rsvp-badge--going {
  color: #66ee66;
}

.rsvp-badge--selected.rsvp-badge--maybe {
  color: #f0d060;
}

.rsvp-badge--selected.rsvp-badge--cant {
  color: #ddd;
}

.rsvp-counts {
  margin: 0.5em 0;
}


/* ── Guest list ──────────────────────────────────────────────────────────── */

.guest-list {
  list-style: none;
  padding: 0;
  margin: 0.5em 0;
}

.guest-list li {
  padding: 2px 0;
  font-size: 0.95em;
}

.guest-list li::before {
  content: '\2666';
  font-family: Wingdings, sans-serif;
  margin-right: 0.4em;
  color: var(--muted);
}

/* ── Inline auth (RSVP section) ──────────────────────────────────────────── */

.inline-auth {
  border: 2px inset var(--btn-face);
  background: #fff;
  padding: 12px;
  margin: 0.75em 0;
}

.inline-auth p {
  margin: 0 0 0.5em;
}

.inline-auth .no-spam {
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 0.5em;
}

/* ── Wingdings / Webdings decorative utility ──────────────────────────────── */

.wd {
  font-family: Wingdings, 'Wingdings', sans-serif;
}

.wbd {
  font-family: Webdings, 'Webdings', sans-serif;
}

/* ── Marquee ─────────────────────────────────────────────────────────────── */

marquee {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  font-size: 1.15em;
  padding: 4px 0;
}

#marquee-wrap[data-editable] marquee {
  cursor: text;
}

.marquee-edit-input {
  display: block;
  width: 100%;
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  font-size: 1.15em;
  padding: 4px 0;
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  color: inherit;
  outline: none;
}

.marquee-edit-input:focus {
  border-bottom-color: var(--link, #4a86e8);
}

.marquee-edit-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  text-align: center;
  font-size: 0.85em;
  color: var(--muted);
  padding: 0.5em 0;
}

.footer img {
  width: 1.2em;
  vertical-align: middle;
}

/* ── Calendar subscribe ──────────────────────────────────────────────────── */

.cal-subscribe {
  margin-top: 1em;
}

.cal-subscribe .cal-url-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.cal-subscribe .cal-url-row input {
  flex: 1;
}

/* ── Details/Summary ─────────────────────────────────────────────────────── */

details {
  margin: 0.75em 0;
}

summary {
  cursor: pointer;
  font-weight: bold;
}

/* ── Markdown preview ────────────────────────────────────────────────────── */

.md-preview {
  border: 1px solid var(--border);
  padding: 8px;
  min-height: 6em;
  max-width: 40em;
}

/* ── Image cropper areas ─────────────────────────────────────────────────── */

.cropper-wrapper {
  margin: 8px 0;
}

.crop-preview {
  margin: 8px 0;
}

.crop-preview img {
  border: 2px solid var(--border);
}

/* ── API tokens ──────────────────────────────────────────────────────────── */

.token-created-box {
  border: 1px solid #006600;
  padding: 10px;
  margin: 10px 0;
  background: #f0fff0;
}

/* ── Style picker (event customization) ──────────────────────────────────── */

/* ── Style Toolbar — Windows 95 style ────────────────────────────────── */

.style-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1px 0;
  margin-bottom: 2px;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #c0c0c0;
  border-bottom: 2px solid #808080;
  border-top: 1px solid #fff;
}

/* Push page content below the fixed toolbar */
body:has(.style-toolbar) .wrapper {
  padding-top: 32px;
}

.toolbar-inner {
  max-width: 64em;
  margin: 0 auto;
  padding: 0 1em;
}

.style-toolbar-bar {
  display: flex;
  gap: 2px;
  padding: 2px 3px;
}

.style-toolbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 2px outset #dfdfdf;
  border-radius: 0;
  background: #c0c0c0;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  white-space: nowrap;
  margin-right: 2px;
}

.style-toolbar-btn:hover {
  background: #d4d0c8;
}

.style-toolbar-btn:active,
.style-toolbar-btn--active {
  border-style: inset;
  background: #b0b0b0;
}

.style-toolbar-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #000;
}

/* ── Style Panels — Win95 dialog windows ─────────────────────────────── */

.style-panel {
  display: none;
  position: fixed;
  top: 42px;
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: 340px;
  max-height: calc(100vh - 50px);
  overflow-y: auto;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  box-shadow: 2px 2px 0 #000;
  z-index: 101;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* When a panel has been dragged, remove centering so explicit left/top work */
.style-panel--dragged {
  right: auto;
  margin: 0;
}

.style-panel--wide {
  width: 440px;
}

/* Colors panel needs extra width for the native color picker */
.style-panel--colors {
  width: 400px;
}

.style-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  user-select: none;
  cursor: grab;
}

.style-panel-header:active {
  cursor: grabbing;
}

.style-panel-close {
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  font-size: 10px;
  cursor: pointer;
  color: #000;
  padding: 0 3px;
  line-height: 1;
  font-weight: bold;
  font-family: inherit;
  min-width: 16px;
  min-height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.style-panel-close:active {
  border-style: inset;
}

.style-panel-body {
  padding: 12px 14px 14px;
}

.style-panel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.style-panel-row--block {
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.style-panel-label {
  font-size: 11px;
  font-weight: bold;
  color: #000;
  min-width: 45px;
}

.style-panel-hint {
  font-size: 10px;
  color: #444;
  margin: 0 0 6px;
}

.style-panel-input {
  width: 100%;
  padding: 3px 4px;
  border: 2px inset #dfdfdf;
  border-radius: 0;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
}

.style-panel-toggle {
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.style-panel-done {
  display: block;
  width: 80px;
  padding: 3px 8px;
  margin: 10px auto 0;
  background: #c0c0c0;
  color: #000;
  border: 2px outset #dfdfdf;
  border-radius: 0;
  font-weight: bold;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.style-panel-done:active {
  border-style: inset;
}

/* ── Color Picker Dropdown ───────────────────────────────────────────── */

.cp-wrap {
  position: relative;
}

.cp-trigger {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 4px;
  border: 2px outset #dfdfdf;
  border-radius: 0;
  background: #c0c0c0;
  cursor: pointer;
  font-family: inherit;
}

.cp-trigger:active {
  border-style: inset;
}

.cp-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 1px solid #000;
}

.cp-swatch--transparent {
  background: #c0c0c0 !important;
  position: relative;
}

.cp-swatch--transparent::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), #ff0000 calc(50% - 1px), #ff0000 calc(50% + 1px), transparent calc(50% + 1px));
}

.cp-caret {
  font-size: 8px;
  color: #000;
}

.cp-dropdown {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  box-shadow: 2px 2px 0 #000;
  padding: 6px;
  width: 220px;
}

.cp-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  margin-bottom: 6px;
}

.cp-dot {
  width: 16px;
  height: 16px;
  border-radius: 0;
  border: 1px solid #808080;
  cursor: pointer;
}

.cp-dot:hover {
  border: 2px solid #000;
  margin: -1px;
}

.cp-transparent-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 3px 4px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  font-size: 10px;
  font-family: inherit;
}

.cp-transparent-btn:hover {
  border-color: #000;
}

.cp-transparent-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #000;
  background: #fff;
  position: relative;
}

.cp-transparent-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1px), #ff0000 calc(50% - 1px), #ff0000 calc(50% + 1px), transparent calc(50% + 1px));
}

.cp-custom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid #808080;
  font-size: 10px;
  color: #000;
}

.cp-custom-row input[type="color"] {
  width: 20px;
  height: 20px;
  border: 2px inset #dfdfdf;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  background: none;
}

@media (max-width: 640px) {
  .style-panel,
  .style-panel--wide,
  .style-panel--colors {
    left: 4px;
    right: 4px;
    width: auto;
    margin: 0;
  }
  .style-toolbar-btn {
    padding: 3px 6px;
    font-size: 10px;
  }
  .style-toolbar-bar {
    gap: 2px;
    padding: 2px;
  }
}

.tile-grid {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tile-option {
  width: 44px;
  height: 44px;
  border: 2px outset #dfdfdf;
  cursor: pointer;
  background-size: auto;
  background-repeat: repeat;
  background-color: #c0c0c0;
}

.tile-option:active {
  border-style: inset;
}

.tile-option--selected {
  border: 2px inset #dfdfdf;
}

.tile-option--none {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #000;
  background: #c0c0c0;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cursor-options {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}

.cursor-option {
  padding: 3px 8px;
  border: 2px outset #dfdfdf;
  background: #c0c0c0;
  cursor: pointer;
  font-size: 11px;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.cursor-option:active {
  border-style: inset;
}

.cursor-option--selected {
  border-style: inset;
  background: #a0a0a0;
}


/* ── Event header row (title + edit button) ─────────────────────────────── */

.event-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1em;
}

.event-header-row h1 {
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.btn-edit-event {
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: 0.75em;
}

/* ── Event detail two-column layout ──────────────────────────────────────── */

.event-detail-layout {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.event-detail-left {
  flex-shrink: 0;
}

.event-detail-right {
  flex: 1;
  min-width: 0;
}

@media (min-width: 1060px) {
  .event-detail-layout {
    flex-direction: row;
    gap: 2em;
    align-items: flex-start;
  }

  .event-detail-left {
    width: 40%;
    max-width: 420px;
  }
}

/* ── Host action bar ─────────────────────────────────────────────────────── */

.host-actions {
  display: flex;
  gap: 0.5em;
  align-items: center;
  flex-wrap: wrap;
}

.host-actions form {
  display: inline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Inline Edit Mode — form fields styled as event preview
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Title input styled as h1 ───────────────────────────────────────────── */

input.edit-title,
input.edit-title:focus {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.6em;
  font-weight: bold;
  line-height: 1.25;
  color: var(--event-text, var(--text));
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  padding: 2px 0;
  margin: 0 0 0.4em;
  width: 100%;
  outline: none;
}

input.edit-title:focus {
  border-bottom-color: var(--link);
}

.edit-title::placeholder {
  color: var(--muted);
  font-style: italic;
  font-weight: bold;
}

.marquee-preview-row {
  margin-bottom: 0.5em;
}

.marquee-preview-row input[type="text"] {
  font-family: 'Comic Sans MS', 'Comic Sans', cursive;
  font-size: 1.15em;
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  padding: 2px 0;
  width: 100%;
  text-align: center;
  color: var(--text);
  outline: none;
}

.marquee-preview-row input[type="text"]:focus {
  border-bottom-color: var(--link);
}

.marquee-preview-row input[type="text"]::placeholder {
  color: var(--muted);
  font-style: italic;
}

/* ── Image upload zone ──────────────────────────────────────────────────── */

.image-upload-zone {
  width: 100%;
  max-width: 420px;
  aspect-ratio: 1;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 12px;
  background: #f5f4f8;
  color: var(--muted);
  font-size: 0.9em;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.image-upload-zone:hover {
  border-color: var(--link);
  color: var(--link);
}

.image-upload-zone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-upload-zone .upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.15s;
}

.image-upload-zone:hover .upload-overlay {
  opacity: 1;
}

/* ── Inline edit inputs inside info table ─────────────────────────────── */

.info-table .edit-input {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1em;
  color: var(--event-text, var(--text));
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  padding: 2px 0;
  width: 100%;
  outline: none;
}

.info-table .edit-input:focus {
  border-bottom-color: var(--link);
  outline: none;
}

.info-table .edit-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.info-table select.edit-input {
  border-bottom: 1px dotted var(--border);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 1.2em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

/* textarea inside md wrapper is handled by .edit-md-wrapper styles */

/* Datetime inputs side-by-side */
.edit-datetime-row {
  display: flex;
  gap: 0.3em;
  align-items: center;
  white-space: nowrap;
}

.edit-datetime-row span {
  color: var(--muted);
  font-size: 0.85em;
  flex-shrink: 0;
}

.edit-datetime-row input[type="datetime-local"] {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 0.85em;
  color: var(--event-text, var(--text));
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  padding: 2px 0;
  outline: none;
  min-width: 0;
}

.edit-datetime-row input[type="datetime-local"]:focus {
  border-bottom-color: var(--link);
}

/* ── Markdown editor inside table cell (GitHub-style) ──────────────────── */

.edit-md-wrapper {
  border: none;
  overflow: hidden;
  margin: -4px -8px;
  box-sizing: border-box;
}

.edit-md-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 3px double var(--border);
  background: transparent;
  padding: 0 4px;
}

.edit-md-tabs button {
  font-size: 0.8em;
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--muted);
  font-weight: normal;
}

.edit-md-tabs button:active {
  border-style: none;
  border-bottom: 2px solid transparent;
  padding: 4px 10px;
}

.edit-md-tabs button[disabled] {
  color: var(--text);
  border-bottom-color: var(--link);
  font-weight: bold;
}

.edit-md-tabs small {
  margin-left: auto;
}

.edit-md-wrapper textarea {
  display: block;
  width: 100%;
  min-height: 10em;
  border: none;
  padding: 8px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1em;
  color: var(--event-text, var(--text));
  background: var(--event-table-bg, transparent);
  resize: none;
  outline: none;
  overflow: hidden;
  box-sizing: border-box;
}

.edit-md-preview {
  padding: 8px;
  min-height: 10em;
  background: var(--event-table-bg, transparent);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1em;
  color: var(--event-text, var(--text));
  line-height: 1.5;
  overflow: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.edit-md-preview p {
  margin: 0.5em 0;
}

.edit-md-preview ul,
.edit-md-preview ol {
  margin: 0.5em 0;
}

.edit-md-preview *:first-child {
  margin-top: 0;
}

.edit-md-preview *:last-child {
  margin-bottom: 0;
}

/* ── Edit form actions ──────────────────────────────────────────────────── */

.edit-actions {
  display: flex;
  gap: 0.75em;
  align-items: center;
  margin: 1em 0;
}

.edit-actions .btn-save {
  font-size: 0.9em;
  padding: 6px 20px;
  font-weight: bold;
}

.edit-actions .btn-save-draft {
  font-size: 0.9em;
  padding: 6px 16px;
}

/* ── Checkbox row ────────────────────────────────────────────────────────── */

.edit-options {
  margin: 0.75em 0;
  font-size: 0.9em;
}

.edit-options label {
  cursor: pointer;
}

/* ── Doodle Scene (animated canvas on event page) ────────────────────────── */

.doodle-scene-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.doodle-scene-wrap--bg {
  z-index: -10000;
}

.doodle-scene-wrap--items {
  z-index: -1;
}

.doodle-scene-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Doodle Drawing Canvas (guest drawing UI) ────────────────────────────── */

/* doodle-section is just a data-attribute wrapper — no visible styling */
.doodle-section {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
}

.doodle-prompt {
  font-weight: bold;
  margin: 0 0 0.5em;
  font-size: 1.05em;
}

.doodle-draw-canvas {
  display: block;
  width: 100%;
  max-width: 400px;
  border: 2px inset #dfdfdf;
  border-radius: 0;
  cursor: crosshair;
  touch-action: none;
  /* Checkerboard indicates transparency */
  background-image:
    linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
    linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: #f0f0f0;
}

.doodle-color-picker {
  width: 20px;
  height: 20px;
  border: 1px solid #000;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  background: none;
  vertical-align: middle;
}

.doodle-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.doodle-color-picker::-webkit-color-swatch {
  border: 1px solid #808080;
  border-radius: 0;
}

.doodle-color-picker::-moz-color-swatch {
  border: 1px solid #808080;
  border-radius: 0;
}

/* ── Doodle draw panel (floating, same pattern as style-panels) ─────── */

.doodle-draw-panel {
  width: 440px;
  z-index: 200;
}

.doodle-draw-panel .doodle-draw-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 2px inset #808080;
}

.doodle-draw-panel .doodle-panel-body {
  padding: 6px;
}

/* Editable prompt field — matches .edit-title (dotted underline, no box) */
input.doodle-prompt-edit,
input.doodle-prompt-edit:focus {
  display: block;
  width: 100%;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15em;
  font-weight: bold;
  line-height: 1.25;
  color: var(--event-text, var(--text));
  background: transparent;
  border: none;
  border-bottom: 1px dotted var(--border);
  padding: 2px 0;
  margin: 0 0 0.5em;
  outline: none;
}
input.doodle-prompt-edit:focus {
  border-bottom-color: var(--link);
}
.doodle-prompt-edit::placeholder {
  color: var(--muted);
  font-style: italic;
  font-weight: bold;
}

/* Non-editable prompt text (show page) */
.doodle-prompt {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.15em;
  font-weight: bold;
  margin: 0 0 0.5em;
}

/* Thank-you banner shown after RSVP auto-opens the doodle panel */
.doodle-rsvp-thanks {
  margin: 0 0 0.4em;
}
.doodle-rsvp-thanks-text {
  margin: 0;
  font-size: 0.95em;
}

.doodle-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 4px 0;
}

/* Doodle-specific color picker trigger (unified picker style) */

.doodle-cp-wrap {
  position: relative;
}

.doodle-cp-trigger {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  cursor: pointer;
  font-size: 0.75em;
}

.doodle-cp-trigger:active {
  border-style: inset;
}

.doodle-cp-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid #808080;
}

.doodle-tool {
  font-size: 11px;
  padding: 2px 6px;
  border: 2px outset #dfdfdf;
  border-radius: 0;
  background: #c0c0c0;
  cursor: pointer;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.doodle-tool:active {
  border-style: inset;
}

.doodle-tool--active {
  border-style: inset;
  background: #a0a0a0;
}

.doodle-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9em;
  padding: 4px 12px;
  cursor: pointer;
  margin-top: 0.5em;
  border: 2px outset #dfdfdf;
  background: #c0c0c0;
  font-family: inherit;
}

.doodle-edit-btn:active {
  border-style: inset;
}

.doodle-edit-btn-thumb {
  width: 24px;
  height: 24px;
  object-fit: contain;
  border: 1px solid #808080;
  background: #f0f0f0;
}

.doodle-bg-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.doodle-bg-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  padding: 3px;
  border: 2px solid #c0c0c0;
  cursor: pointer;
  font-size: 10px;
  font-family: 'MS Sans Serif', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-align: center;
}

.doodle-bg-option:hover {
  border-color: #000080;
}

.doodle-bg-option--selected {
  border: 2px inset #dfdfdf;
  background: #a0a0a0;
  color: #fff;
}

.doodle-bg-option--none {
  justify-content: center;
  background: #c0c0c0;
  font-weight: bold;
  font-size: 10px;
  min-height: 48px;
}

.doodle-bg-preview {
  display: block;
  width: 56px;
  height: 32px;
  border: 1px solid #000;
  margin-bottom: 2px;
}

/* ── Doodle Drawing Canvas inside Style Picker ───────────────────────────── */

.doodle-picker-canvas-wrap {
  margin: 4px 0;
  padding: 6px;
  border: 2px inset #dfdfdf;
  background: #c0c0c0;
}

.doodle-picker-canvas-wrap .doodle-draw-canvas {
  max-width: 100%;
}

.doodle-unsaved-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 8px;
  background: #ffffcc;
  border: 1px solid #cc9;
  font-size: 0.8em;
  color: #664;
}

.doodle-unsaved-icon {
  font-size: 1.1em;
}


/* ── Host Moderation Panel ───────────────────────────────────────────────── */

.doodle-mod-panel {
  margin-top: 0.75em;
}

.doodle-mod-list {
  list-style: none;
  padding: 0;
  margin: 0.5em 0 0;
}

.doodle-mod-item {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 4px 0;
  border-bottom: 1px solid var(--border, #eee);
}

.doodle-mod-thumb {
  width: 36px;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 2px;
  object-fit: contain;
  background: #fff;
}

.doodle-mod-name {
  flex: 1;
  font-size: 0.85em;
}

.doodle-mod-delete {
  font-size: 0.75em;
  padding: 2px 8px;
  cursor: pointer;
  border: 1px solid #c00;
  border-radius: 3px;
  background: #fff;
  color: #c00;
}

.doodle-mod-delete:hover {
  background: #fdd;
}

/* ── Auto-save status indicator ──────────────────────────────────────── */

.autosave-status {
  font-size: 0.8em;
  margin-left: 0.75em;
  opacity: 0.7;
}

.autosave-saving {
  color: var(--muted, #888);
}

.autosave-saved {
  color: #2a7;
}

.autosave-error {
  color: #c33;
  opacity: 1;
}

/* ── Draft badge ─────────────────────────────────────────────────────── */

.draft-badge {
  display: inline-block;
  font-size: 0.65em;
  font-weight: normal;
  padding: 1px 6px;
  border-radius: 3px;
  background: #e8e4f0;
  color: #665;
  vertical-align: middle;
  margin-left: 4px;
}

.event-card--draft {
  opacity: 0.75;
  border-style: dashed;
}
