/* Native HTML/JavaScript adaptations. The main visual rules are in the original stylesheets. */

.site-header__catalog-mobile { display: none; }
.site-header__credits {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.site-header__credits .cult-pro-badge-content { gap: 4px; }
.site-header__credits .formula-coin { width: 12px; height: 12px; }
@media (max-width: 767px) {
  .site-header__actions .site-header__tools-desktop,
  .site-header__actions .site-header__settings-avatar,
  .site-header__actions .site-header__credits,
  .site-header__actions [data-formula-login][data-link] { display: none; }
}

/* Keep the standalone composer's own palette API, with Formula as its host theme. */
body[data-page] .nf-composer {
  --pc-bg: var(--surface);
  --pc-surface: var(--bg-card-2);
  --pc-line: var(--border);
  --pc-text: var(--text);
  --pc-muted: var(--text-muted);
  --pc-accent: color-mix(in srgb, var(--accent) 70%, #ff42d3 10%);
  --pc-on-accent: var(--accent-foreground);
  --pc-mode-active-bg: var(--accent-soft);
  --pc-mode-active-border: var(--accent-line);
  --pc-highlight-bg: var(--accent-soft);
  --pc-highlight-border: var(--accent-line);
  --pc-highlight-hover-bg: color-mix(in srgb, var(--accent) 20%, var(--surface));
  --pc-popup-bg: var(--surface);
  --pc-input-bg: var(--bg);
  --pc-media-bg: var(--bg);
  --pc-workspace-bg: var(--surface);
  --pc-option-text: var(--text);
  --pc-bright-text: var(--text);
  --pc-error-text: var(--danger);
  --pc-invalid-border: var(--danger-line);
  --pc-incompatible-border: var(--danger-line);
  --pc-input-invalid-border: var(--danger-line);
  --pc-token-remove-hover-bg: var(--danger-soft);
  --pc-token-remove-hover-text: var(--danger);
  --pc-attachment-remove-hover-bg: var(--danger-soft);
}

/* The existing body isolation keeps this fixed effect behind all page content. */
#neuro {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -2;
  opacity: 0.1;
  filter: saturate(1.2);
  transition: opacity 0.35s ease, filter 0.35s ease;
}

#neuro.is-disabled {
  display: none;
}

[hidden] {
  display: none !important;
}

/* Overlay layout must never override the native closed state of <dialog>. */
dialog.modal__dialog:not([open]) {
  display: none !important;
  pointer-events: none;
}

.account-avatar-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.has-modal,
.has-expanded-editor {
  overflow: hidden;
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Dropdowns are portaled by main.js to avoid clipping inside horizontal controls. */
.dropdown-panel {
  position: fixed;
  z-index: 120;
}

[data-select-menu][data-floating],
.studio-model-menu,
.param-menu {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(24px);
}

.param-menu__option {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.param-menu__option:hover,
.param-menu__option:focus-visible {
  background: color-mix(in srgb, var(--text) 8%, var(--surface));
}

[data-filter][aria-pressed="true"],
[data-marketing-filter][aria-pressed="true"] {
  color: var(--accent);
  border-color: currentColor;
}

.gallery__empty {
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}

/* Plain contenteditable replaces the original rich-text framework. */
.editable-content {
  position: relative;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.editable-content p {
  margin: 0;
}

.editable-content p.is-editor-empty:first-child::before {
  float: left;
  height: 0;
  color: color-mix(in srgb, var(--text) 38%, transparent);
  content: attr(data-placeholder);
  pointer-events: none;
}

.studio-dock__root.is-expanded .studio-prompt__prompt-editor-wrapper {
  min-height: 280px;
}

.studio-dock__root.is-expanded .editable-content {
  min-height: 260px;
  max-height: 55vh;
  overflow-y: auto;
}

/* User-selected files are local object URLs; no upload happens in the template. */
.upload-preview {
  display: flex;
  gap: 10px;
  margin: 10px 0;
  overflow-x: auto;
}

.upload-preview figure {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 88px;
  margin: 0;
}

.upload-preview img,
.upload-preview video {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.upload-preview button {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text);
  cursor: pointer;
}

.is-copied {
  color: var(--accent) !important;
}

.models-prices-list__container.is-expanded [class*="hidden"],
.models-prices-list__container.is-expanded [class*="collapsed"] {
  display: contents;
}

@media (max-width: 767px) {
  .dropdown-panel,
  [data-select-menu][data-floating] {
    max-width: calc(100vw - 24px);
  }
}

.formula-auth-error {
  color: var(--danger);
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.auth__social-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
