/*=========================
   Table of Contents
=========================*/
/*
   1   Theme Switcher Toolbar
   2   Palette Picker
   3   Theme Picker Modal (2026-07-20)
   4   Mobile
*/

/*=========================
   Theme Switcher Toolbar
=========================*/
/* Fixed bar only for the /theme-preview/ page — !important on everything
   on purpose: needs to beat the CSS of the theme being previewed (which
   changes on every theme switch), it isn't part of any theme itself.

   Reworked: the horizontal list of buttons (1 per theme) stopped fitting
   past the 4th/5th theme, and got worse with every new theme. Replaced
   with a single button ("Theme: <name> ▾") that opens a modal with the
   thumbnail grid (see section 3) — even on wide screens, not just mobile.
   Palette switching (previously only in the editor) was added here too,
   using the same color dots as the editor (see section 2). */
.site-footer {
  padding-bottom: 80px !important;
}
.theme-switcher {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 99999 !important;
  display: grid !important;
  grid-template-columns: 1fr auto 1fr !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 12px max(24px, 4%) 16px !important;
  background: #0d0d1a !important;
  border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-sizing: border-box !important;
}
.theme-switcher > .menu-logo {
  justify-self: start !important;
}
.theme-switcher-controls {
  justify-self: center !important;
}
.theme-switcher-actions {
  justify-self: end !important;
}
.theme-switcher-controls {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}
.theme-switcher-theme-btn {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 13px !important;
  font-family: inherit !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  white-space: nowrap !important;
}
.theme-switcher-theme-btn:hover {
  border-color: rgba(255, 255, 255, 0.5) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
.theme-switcher-theme-btn strong {
  font-weight: 600 !important;
}
.theme-switcher-cta {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 16px !important;
  border-radius: 8px !important;
  background: #5b4be0 !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: background 0.15s !important;
  flex-shrink: 0 !important;
}
.theme-switcher-cta:hover {
  background: #4a3bc9 !important;
}
.theme-switcher-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-shrink: 0 !important;
}
.theme-switcher-back {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 7px 14px !important;
  border-radius: 8px !important;
  border: 1.5px solid rgba(255, 255, 255, 0.25) !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 13px !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: all 0.15s ease !important;
}
.theme-switcher-back:hover {
  border-color: rgba(255, 255, 255, 0.5) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}

/*=========================
   Palette Picker
=========================*/
/* Same color dots as the editor (`.editor-palette-dot` in
   workspace/editor.css) — own class names (not literally reused) because
   this file never loads alongside the workspace CSS; see
   `static/js/sites/theme-preview-palette.js` for the simplified
   equivalent of `applyPalette` (without the form sync, which only exists
   in the editor). */
.theme-switcher-palette {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  position: relative !important;
  padding: 6px 10px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border-radius: 999px !important;
}
.palette-dot {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 999px !important;
  cursor: pointer !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}
.palette-dot:hover {
  transform: scale(1.12) !important;
}
.palette-dot.is-active {
  border-color: #fff !important;
  box-shadow: 0 0 0 2px #0d0d1a, 0 0 0 4px #fff !important;
}
.palette-dot--default {
  background: #fff !important;
  background-image: linear-gradient(
    135deg,
    transparent 46%,
    #e11d48 46%,
    #e11d48 54%,
    transparent 54%
  ) !important;
}
.palette-dot--more {
  display: grid !important;
  place-items: center !important;
  background: rgba(255, 255, 255, 0.12) !important;
  color: rgba(255, 255, 255, 0.8) !important;
}
.palette-popover {
  position: absolute !important;
  bottom: calc(100% + 10px) !important;
  left: 0 !important;
  /* No `!important` here specifically, on purpose — Alpine controls
     `display:none`/`display:grid` via inline `x-show`; `!important` on
     this property specifically would beat the inline style and the
     popover would never hide. The other properties stay `!important`
     (same reason as the rest of the file: guard against any generic
     selector from the theme being previewed). */
  display: grid;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px !important;
  width: 120px !important;
  padding: 10px !important;
  background: #17172a !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.5) !important;
  z-index: 100000 !important;
}

/*=========================
   Theme Picker Modal
=========================*/
/* Adapted copy of `.theme-modal`/`.create-event-template-*`
   (workspace/editor.css + workspace/components.css) — can't just link
   those two files here (they're workspace CSS, full of admin UI styling
   that makes no sense on a public page). `core/tokens.css` is loaded
   separately (only the base layout now — see sites/layouts/base.html) so
   these rules work off the same tokens.

   Changed in this copy: `--text-100`/`--text-300`/`--surface-200`/
   `--text-base` (used in the original) don't exist in `core/tokens.css` —
   they're orphaned tokens, undefined even in the editor itself (found
   while migrating this CSS here) — replaced with `--text`/`--text-muted`/
   `--surface-hover`/`--text-md`, the real equivalents that do exist. No
   confirmation warning/checkbox (those exist in the editor because
   switching themes there resets real customizations) — here it's just
   navigation between preview pages, nothing to confirm. */
.theme-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.theme-modal {
  background: var(--background);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 760px;
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-4);
  border-bottom: var(--border-width) solid var(--border-color);
}
.theme-modal-header h2 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
}
.theme-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.theme-modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.theme-modal-body {
  padding: var(--space-5);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.create-event-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.create-event-template-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-xl);
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.create-event-template-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-100);
  box-shadow: var(--shadow-sm);
}
.create-event-template-card.active {
  background: var(--primary-10);
  border-color: var(--primary-100);
}
.create-event-template-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-hover);
}
.create-event-template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.create-event-template-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
  background: var(--primary-gradient);
  color: var(--white);
}
.create-event-template-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.create-event-template-content strong {
  color: var(--text);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
}
.create-event-template-content small {
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}
.create-event-template-check {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--primary-100);
  color: var(--white);
}

/*=========================
   Mobile
=========================*/
@media (max-width: 640px) {
  .theme-switcher {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 10px 16px 14px !important;
  }
  .theme-switcher > .menu-logo {
    display: none !important;
  }
  .theme-switcher-controls {
    order: 1 !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
  }
  .theme-switcher-actions {
    order: 2 !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
  }
  .theme-switcher-back,
  .theme-switcher-cta {
    flex: 1 1 auto !important;
    justify-content: center !important;
  }
  .create-event-template-grid {
    grid-template-columns: 1fr;
  }
  .theme-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .theme-modal {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }
}
