/* ==========================================================================
   bynd-competitions-core.css
   Styles for /admin/competitions/ setup builder + reusable banner card
   used by the /dashboard/ hint banner and /dashboard/activity/ preview.
   Beyond has no --radius var — use 8px hardcoded where WMD used var(--radius).
   ========================================================================== */

/* ===== SETUP PANEL ===== */
.as-desc {
  font-size: 12px; color: var(--text-secondary);
  margin: 6px 0 18px; line-height: 1.55;
}
.as-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 18px;
  margin-bottom: 14px;
}
.as-card-title {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 600; margin-bottom: 4px;
}
.as-card-desc {
  font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5;
}
.as-radio-row { display: flex; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; }
.as-radio-row label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-primary); cursor: pointer;
}
.as-input, .as-select {
  width: 100%; max-width: 520px;
  background: var(--bg-input, var(--bg-card)); border: 1px solid var(--border);
  color: var(--text-primary); padding: 8px 10px; border-radius: 4px;
  font-family: inherit; font-size: 13px;
}
.as-img-preview {
  margin-top: 10px; max-width: 520px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg-input, var(--bg-card));
  aspect-ratio: 8 / 1; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
/* Image dim overlay — alpha driven by --as-img-dim (0..1) from the slider. */
.as-img-preview::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: rgba(0, 0, 0, var(--as-img-dim, 0));
}
.as-img-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Only injected when header_type = 'image_with_title'. */
.as-img-preview-title {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0 14px; text-align: center;
  font-size: clamp(14px, 3vw, 22px); font-weight: 700;
  color: #fff; letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0,0,0,0.75), 0 0 4px rgba(0,0,0,0.6);
  pointer-events: none;
}
.as-img-preview .hint {
  font-size: 11px; color: var(--text-muted); padding: 0 14px; text-align: center;
}
.as-field { margin-bottom: 10px; }
.as-field-label {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 600; margin-bottom: 5px;
}
.as-actions {
  display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; margin-top: 14px; margin-bottom: 14px;
  padding: 14px 16px; border-radius: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  position: sticky; bottom: 12px; z-index: 5;
}
.as-actions .btn {
  display: inline-flex; align-items: center;
  text-decoration: none; line-height: 1; white-space: nowrap;
}
.as-status {
  font-size: 13px; flex: 1; min-width: 200px;
  padding: 6px 10px; border-radius: 4px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.as-status.error   { background: rgba(255,107,107,0.12); color: #ff6b6b; font-weight: 500; }
.as-status.success { background: rgba(74,222,128,0.12); color: #4ade80; font-weight: 500; }
.as-status.busy    { color: var(--text-secondary); font-style: italic; }

/* Dashboard banner inputs — emoji + color side-by-side row */
.as-banner-row {
  display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.as-field-emoji { width: 130px; }
.as-field-color { width: 90px; }
.as-input-narrow { max-width: 130px; }
.as-input-color {
  padding: 4px 6px; height: 36px; width: 80px; cursor: pointer;
}

/* Shared banner card — preview inside setup + rendered on /dashboard/. */
.ac-banner-link {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px; border-radius: 8px;
  background: color-mix(in srgb, var(--banner-color, var(--primary)) 12%, transparent);
  border: 1px solid var(--banner-color, var(--primary));
  color: var(--text-primary); text-decoration: none;
  transition: background 0.12s;
  max-width: 520px;
}
.ac-banner-link:hover {
  background: color-mix(in srgb, var(--banner-color, var(--primary)) 20%, transparent);
}
.ac-banner-emoji {
  font-size: 24px; line-height: 1;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card); border-radius: 50%;
  flex-shrink: 0;
}
.ac-banner-emoji:empty { display: none; }
.ac-banner-text { flex: 1; min-width: 0; }
.ac-banner-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-banner-subtitle {
  font-size: 12px; color: var(--text-secondary); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ac-banner-view {
  font-size: 10px; font-weight: 700; letter-spacing: 0.10em;
  font-family: var(--font-mono);
  color: var(--banner-color, var(--primary));
  flex-shrink: 0;
}

/* Publish-state pill in the action bar */
.as-pub-state {
  font-size: 10px; padding: 4px 10px; border-radius: 10px;
  letter-spacing: 0.10em; text-transform: uppercase; font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-input, var(--bg-card)); color: var(--text-secondary);
}
.as-pub-state.live { background: rgba(74,222,128,0.16); color: #4ade80; }

/* Reveal state row */
.as-reveal-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-reveal-state {
  font-size: 10px; padding: 4px 10px; border-radius: 10px;
  letter-spacing: 0.10em; text-transform: uppercase; font-weight: 700;
  font-family: var(--font-mono);
  background: var(--bg-input, var(--bg-card)); color: var(--text-secondary);
}
.as-reveal-state.revealed { background: rgba(252,211,77,0.18); color: #fcd34d; }

.as-clear-btn {
  margin-left: auto;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 8px 12px; border-radius: 4px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-family: inherit; transition: all 0.15s;
}
.as-clear-btn:hover {
  color: #ff6b6b; border-color: rgba(255,107,107,0.5);
  background: rgba(255,107,107,0.06);
}
.as-clear-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile layout — explicit grid-template-areas keep each row locked so
   the sticky action bar never crushes into a single line at 480px. */
@media (max-width: 768px) {
  .as-actions {
    display: grid;
    grid-template-columns: auto 1fr 1fr;
    grid-template-areas:
      "pill save  publish"
      ".    clear preview"
      "status status status";
    gap: 8px;
    align-items: center;
  }
  .as-actions .as-pub-state { grid-area: pill; justify-self: start; }
  .as-actions #asSaveBtn    { grid-area: save;    width: 100%; }
  .as-actions #asPublishBtn { grid-area: publish; width: 100%; }
  .as-actions .as-clear-btn { grid-area: clear;   width: 100%; margin-left: 0; }
  .as-actions a             { grid-area: preview; width: 100%; }
  .as-actions .as-status    { grid-area: status;  min-width: 0; flex: none; }
}

/* ===== ARCHIVE (history snapshots) ===== */
.as-archive-form {
  display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap;
}
.as-archive-form input { flex: 1; min-width: 220px; }
.as-archive-empty {
  padding: 14px; font-size: 12px; color: var(--text-muted); text-align: center;
  background: var(--bg-input, var(--bg-card)); border-radius: 6px;
}
.as-archive-row {
  background: var(--bg-input, var(--bg-card)); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; margin-bottom: 8px;
}
.as-archive-row-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.as-archive-label {
  font-weight: 600; color: var(--text-primary); flex: 1; min-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.as-archive-date {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
}
.as-archive-actions {
  display: flex; gap: 6px;
}
.as-archive-actions button {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); padding: 4px 10px; border-radius: 4px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.06em;
  font-family: inherit; transition: all 0.15s;
}
.as-archive-actions button:hover { color: var(--text-primary); border-color: var(--text-muted); }
.as-archive-actions button.del:hover { color: #ff6b6b; border-color: rgba(255,107,107,0.5); }
.as-archive-preview {
  display: none; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.as-archive-preview.open { display: block; }
.as-archive-preview-section {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 10px;
}
.as-archive-preview-section b { color: var(--text-primary); }
.as-archive-preview-section .lbl {
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-secondary); font-weight: 600; display: block; margin-bottom: 4px;
}
.as-archive-intro-render { font-size: 13px; line-height: 1.5; }
.as-archive-intro-render p { margin: 0 0 6px; }
.as-archive-intro-render h1 { font-size: 18px; margin: 6px 0 4px; }
.as-archive-intro-render h2 { font-size: 16px; margin: 6px 0 4px; }
.as-archive-intro-render h3 { font-size: 14px; margin: 4px 0 4px; }

/* ===== QUILL OVERRIDES ===== */
#asIntroEditor { background: var(--bg-input, var(--bg-card)); }
.ql-toolbar.ql-snow,
.ql-container.ql-snow {
  border-color: var(--border) !important;
  background: var(--bg-input, var(--bg-card));
}
.ql-toolbar.ql-snow { border-radius: 4px 4px 0 0; }
.ql-container.ql-snow {
  border-radius: 0 0 4px 4px;
  color: var(--text-primary);
  font-family: inherit;
  min-height: 140px;
}
.ql-editor { min-height: 140px; }
.ql-snow .ql-stroke { stroke: var(--text-secondary); }
.ql-snow .ql-fill { fill: var(--text-secondary); }
.ql-snow .ql-picker { color: var(--text-secondary); }
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--primary); }
.ql-snow.ql-toolbar button:hover .ql-fill,
.ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--primary); }
.ql-editor.ql-blank::before { color: var(--text-muted); font-style: normal; }
