/* Final dashboard UI polish. Keeps black dominant and uses the We Are Elixir rainbow as the interaction/accent system. */

:root {
  --elixir-red: #ff3159;
  --elixir-gold: #ffbe0b;
  --elixir-lime: #7ce33f;
  --elixir-cyan: #00c5ff;
  --elixir-violet: #8f49ff;
  --elixir-pink: #ff3aa5;
  --elixir-rainbow: linear-gradient(90deg,var(--elixir-red),var(--elixir-gold),var(--elixir-lime),var(--elixir-cyan),var(--elixir-violet),var(--elixir-pink));
  --elixir-rainbow-soft: linear-gradient(110deg,rgba(255,49,89,.10),rgba(255,190,11,.05),rgba(0,197,255,.08),rgba(143,73,255,.08),rgba(255,58,165,.08));
}

/* Stronger Elixir atmosphere inside the authenticated app. */
.workspace-page::before,
.workspace-page::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(100px);
}
.workspace-page::before {
  width: 420px;
  height: 420px;
  left: 22vw;
  top: 12vh;
  background: rgba(255,49,89,.08);
}
.workspace-page::after {
  width: 480px;
  height: 480px;
  right: -120px;
  bottom: -100px;
  background: rgba(0,197,255,.08);
}

/* Key editing surfaces get a restrained rainbow edge, like Elixir CTAs against black. */
.app-workspace .form-card,
.app-workspace .preview-card,
.app-workspace > .card:not(.module-card),
.app-workspace .config-panel {
  position: relative;
}
.app-workspace .form-card,
.app-workspace .preview-card {
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 0%, rgba(0,197,255,.055), transparent 30%),
    radial-gradient(circle at 4% 100%, rgba(255,58,165,.045), transparent 30%),
    linear-gradient(145deg,rgba(255,255,255,.052),rgba(255,255,255,.014));
  border-color: rgba(255,255,255,.13);
}
.app-workspace .form-card::before,
.app-workspace .preview-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--elixir-rainbow);
  opacity: .9;
  pointer-events: none;
}

/* Cleaner form typography and spacing. */
.app-workspace .form-card label,
.app-workspace .config-body label {
  color: #f4f4f6;
  font-weight: 800;
  letter-spacing: -.01em;
}
.app-workspace .form-card label > span:first-child,
.app-workspace .config-body label > span:first-child {
  line-height: 1.3;
}
.app-workspace label small {
  color: #9f9fa8;
  font-weight: 600;
}

/* Elixir dark controls. Browser-native white controls are intentionally eliminated. */
.app-workspace input:not([type="checkbox"]):not([type="color"]),
.app-workspace textarea,
.app-workspace select {
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(3,3,4,.82);
  color: #f8f8f8;
  caret-color: var(--elixir-cyan);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.018);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
  color-scheme: dark;
}
.app-workspace textarea { min-height: auto; }
.app-workspace input::placeholder,
.app-workspace textarea::placeholder { color: #777781; opacity: 1; }
.app-workspace input:not([type="checkbox"]):not([type="color"]):hover,
.app-workspace textarea:hover,
.app-workspace select:hover { border-color: rgba(255,255,255,.24); }
.app-workspace input:not([type="checkbox"]):not([type="color"]):focus,
.app-workspace textarea:focus,
.app-workspace select:focus {
  border-color: var(--elixir-cyan);
  background: rgba(5,5,6,.96);
  box-shadow:
    0 0 0 1px rgba(0,197,255,.5),
    0 0 0 4px rgba(0,197,255,.09),
    0 12px 34px rgba(0,0,0,.26);
}

/* Non-searchable selects get a custom dark chevron rather than browser chrome. */
.app-workspace select:not(.picker-native) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, #b9b9c1 50%),
    linear-gradient(135deg, #b9b9c1 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.app-workspace select option {
  color: #f8f8f8;
  background: #0b0b0c;
}

/* Searchable channels/roles: enhanced combobox UI backed by the existing select. */
.searchable-picker.picker-enhanced {
  position: relative;
  display: grid;
  gap: 8px;
  isolation: isolate;
}
.searchable-picker.picker-enhanced > .picker-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
.searchable-picker.picker-enhanced > [data-picker-search] {
  min-height: 52px;
  padding-right: 48px;
  border-color: rgba(255,255,255,.15);
  background:
    linear-gradient(rgba(5,5,6,.94),rgba(5,5,6,.94)) padding-box,
    linear-gradient(110deg,rgba(255,49,89,.35),rgba(0,197,255,.2),rgba(143,73,255,.26)) border-box;
}
.searchable-picker.picker-enhanced > [data-picker-search][aria-expanded="true"] {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(0,197,255,.45), 0 0 0 4px rgba(0,197,255,.08);
}
.picker-toggle {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: rgba(255,255,255,.055);
  color: #d7d7dc;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.picker-toggle:hover { color: #fff; background: rgba(255,255,255,.10); }
.picker-enhanced.picker-open .picker-toggle { transform: rotate(180deg); color: #050505; background: var(--elixir-rainbow); }
.picker-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow: auto;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0%, rgba(0,197,255,.09), transparent 36%),
    #0c0c0f;
  box-shadow: 0 24px 70px rgba(0,0,0,.62), 0 0 0 1px rgba(0,0,0,.3);
  scrollbar-color: #484852 #0c0c0f;
}
.picker-popover[hidden] { display: none; }
.picker-option {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr);
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #d8d8de;
  text-align: left;
  cursor: pointer;
}
.picker-option:hover,
.picker-option:focus-visible { background: rgba(255,255,255,.065); color: #fff; outline: none; }
.picker-option.is-selected {
  color: #fff;
  background: linear-gradient(90deg,rgba(255,49,89,.11),rgba(0,197,255,.09),rgba(143,73,255,.10));
}
.picker-option-mark {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  color: transparent;
  background: rgba(0,0,0,.22);
  font-size: .72rem;
  font-weight: 900;
}
.picker-option.is-selected .picker-option-mark {
  border-color: transparent;
  color: #050505;
  background: var(--elixir-rainbow);
}
.picker-option.picker-clear { color: #aaaab2; border-bottom: 1px solid rgba(255,255,255,.07); border-radius: 8px 8px 3px 3px; margin-bottom: 4px; }
.picker-empty { padding: 15px 12px; color: #8f8f98; font-size: .84rem; text-align: center; }

/* Multi-select role pickers surface chosen roles as removable chips. */
.picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.picker-chips:empty { display: none; }
.picker-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 7px 4px 10px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: linear-gradient(90deg,rgba(255,49,89,.08),rgba(0,197,255,.07),rgba(143,73,255,.08));
  color: #e8e8ec;
  font-size: .78rem;
  font-weight: 700;
}
.picker-chip button {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #bdbdc4;
  cursor: pointer;
  line-height: 1;
}
.picker-chip button:hover { background: rgba(255,49,89,.18); color: #fff; }

/* Checkbox switches: colourful when active, quiet when off. */
.app-workspace input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 42px;
  height: 24px;
  min-width: 42px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 999px;
  background:
    radial-gradient(circle at 26% 50%, #9a9aa2 0 6px, transparent 6.8px),
    #111216;
  cursor: pointer;
  transition: .17s ease;
}
.app-workspace input[type="checkbox"]:checked {
  border-color: transparent;
  background:
    radial-gradient(circle at 74% 50%, #050505 0 6px, transparent 6.8px),
    var(--elixir-rainbow);
  box-shadow: 0 0 0 3px rgba(0,197,255,.06);
}
.app-workspace input[type="checkbox"]:focus-visible { outline: 2px solid var(--elixir-cyan); outline-offset: 2px; }

/* Colour wheel gets a proper swatch treatment instead of a plain rectangular input. */
.app-workspace .colour-picker {
  grid-template-columns: 58px minmax(0,1fr);
  min-height: 58px;
  padding: 4px 12px 4px 4px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  background: rgba(3,3,4,.62);
}
.app-workspace input[type="color"] {
  width: 50px;
  height: 50px;
  min-height: 50px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--elixir-rainbow);
  cursor: pointer;
}
.app-workspace input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.app-workspace input[type="color"]::-webkit-color-swatch { border: 2px solid #050505; border-radius: 50%; }
.app-workspace input[type="color"]::-moz-color-swatch { border: 2px solid #050505; border-radius: 50%; }
.app-workspace .colour-value { color: #d8d8de; font-weight: 700; letter-spacing: .03em; }

/* Accordions carry more Elixir colour and have clearer open/closed hierarchy. */
.app-workspace .config-panel {
  overflow: hidden;
  border-color: rgba(255,255,255,.13);
  background: linear-gradient(145deg,rgba(255,255,255,.04),rgba(255,255,255,.012));
}
.app-workspace .config-panel > summary {
  position: relative;
  transition: background .16s ease, border-color .16s ease;
}
.app-workspace .config-panel > summary::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--elixir-rainbow);
  opacity: .28;
}
.app-workspace .config-panel > summary:hover { background: rgba(255,255,255,.025); }
.app-workspace .config-panel[open] > summary {
  background: var(--elixir-rainbow-soft);
  border-bottom-color: rgba(255,255,255,.10);
}
.app-workspace .config-panel[open] > summary::before { opacity: 1; }
.app-workspace .config-panel > summary::after {
  border-color: rgba(255,255,255,.13);
  background: rgba(255,255,255,.04);
}
.app-workspace .config-panel[open] > summary::after {
  color: #050505;
  border-color: transparent;
  background: var(--elixir-rainbow);
}

/* Secondary actions get a colourful outline instead of disappearing into grey. */
.app-workspace .button.secondary:not(:disabled) {
  border: 1px solid transparent;
  background:
    linear-gradient(#0d0d10,#0d0d10) padding-box,
    linear-gradient(90deg,rgba(255,49,89,.78),rgba(0,197,255,.72),rgba(143,73,255,.78)) border-box;
  color: #f5f5f7;
}
.app-workspace .button.secondary:hover:not(:disabled) {
  background:
    linear-gradient(#141419,#141419) padding-box,
    var(--elixir-rainbow) border-box;
}
.app-workspace .button:not(.secondary):not(.danger):not(.ghost):not(:disabled) {
  box-shadow: 0 10px 30px rgba(0,197,255,.08);
}

/* Saved-object rows read as interactive objects instead of flat admin list items. */
.app-workspace .template-row {
  position: relative;
  overflow: hidden;
  border-color: rgba(255,255,255,.11);
  background: rgba(3,3,4,.52);
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.app-workspace .template-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--elixir-rainbow);
  opacity: .35;
}
.app-workspace .template-row:hover {
  border-color: rgba(255,255,255,.20);
  background: rgba(255,255,255,.035);
  transform: translateY(-1px);
}
.app-workspace .template-row:hover::before { opacity: 1; }

/* Embed preview: Discord-like content inside an unmistakably Elixir shell. */
.app-workspace .preview-card {
  background:
    radial-gradient(circle at 95% 5%, rgba(143,73,255,.10), transparent 34%),
    radial-gradient(circle at 5% 95%, rgba(255,49,89,.07), transparent 32%),
    linear-gradient(145deg,rgba(255,255,255,.045),rgba(255,255,255,.012));
}
.app-workspace .preview-card > .eyebrow {
  display: inline-block;
  background: var(--rainbow-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-workspace .discord-preview {
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 15px;
  background: #1e1f22;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 18px 45px rgba(0,0,0,.28);
}
.app-workspace .preview-avatar { box-shadow: 0 0 0 2px #1e1f22, 0 0 0 3px rgba(255,255,255,.09); }
.app-workspace .preview-embed {
  background: #2b2d31;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
}

/* Give section headings a little more of the website's colour energy. */
.app-workspace > .section-heading {
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 92% 0%, rgba(0,197,255,.13), transparent 30%),
    radial-gradient(circle at 0% 100%, rgba(255,49,89,.08), transparent 32%),
    linear-gradient(145deg,rgba(255,255,255,.048),rgba(255,255,255,.014));
}
.app-workspace > .section-heading::after {
  content: "";
  position: absolute;
  right: -38px;
  bottom: -70px;
  width: 145px;
  height: 145px;
  border-radius: 50%;
  background: var(--elixir-rainbow);
  filter: blur(48px);
  opacity: .12;
  pointer-events: none;
}

/* Role rows become distinct mini-cards. */
.app-workspace .role-row {
  border-color: rgba(255,255,255,.12);
  background: linear-gradient(120deg,rgba(255,49,89,.025),rgba(0,0,0,.28),rgba(0,197,255,.025));
}

/* Keep dropdowns visible above cards/preview where space gets tight. */
.app-workspace .form-row,
.app-workspace .config-body,
.app-workspace .role-row,
.app-workspace .card { overflow: visible; }
.app-workspace .preview-card { overflow: hidden; }

@media (max-width: 760px) {
  .picker-popover { position: fixed; left: 3vw; right: 3vw; top: auto; bottom: 18px; max-height: min(54vh, 360px); }
  .picker-enhanced.picker-open::before {
    content: "";
    position: fixed;
    z-index: 70;
    inset: 0;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(3px);
  }
  .picker-enhanced.picker-open .picker-popover,
  .picker-enhanced.picker-open .picker-toggle,
  .picker-enhanced.picker-open > [data-picker-search] { z-index: 80; }
  .app-workspace .colour-picker { grid-template-columns: 54px minmax(0,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .picker-toggle,
  .template-row,
  .app-workspace input,
  .app-workspace textarea,
  .app-workspace select { transition: none; }
}
