/* ===========================================================================
   Aura Studio — "הוספת שמע" (Audio Addition) — "Cyber-Music Studio Console"
   ---------------------------------------------------------------------------
   Fully self-contained. Shares NO selectors with studio.css or video.css.
   Every selector is namespaced under `.as-` to guarantee zero collisions.
   =========================================================================== */

:root {
  --as-neon: #C5A059;        /* royal gold (brand) */
  --as-cyber: #E7C878;       /* light gold accent  */
  --as-lilac: #E7C878;       /* terminal gold      */
  --as-glass: rgba(18, 18, 20, 0.7);
}

/* Immersive full-screen overlay — fills the whole viewport. */
.as-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  padding: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(197, 160, 89, 0.18) 0%, transparent 55%),
    radial-gradient(circle at 85% 90%, rgba(231, 200, 120, 0.12) 0%, transparent 55%),
    #121214;
}
.as-overlay.is-open { display: block; animation: asFade 0.22s ease both; }
@keyframes asFade { from { opacity: 0; } to { opacity: 1; } }

/* Panel fills 100% width & height — no max-width box, no border radius. */
.as-panel {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 0;
  overflow: hidden;
  color: #f3ecff;
  background: var(--as-glass);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: inset 0 0 120px rgba(197, 160, 89, 0.08);
}

/* --- Header --------------------------------------------------------------- */
.as-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  height: 60px;
  padding: 0 26px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.25);
  background: rgba(18, 18, 20, 0.55);
}
.as-panel__brand { display: flex; align-items: center; gap: 12px; }
.as-panel__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--as-neon);
  box-shadow: 0 0 12px var(--as-neon), 0 0 24px var(--as-neon);
  animation: asPulseDot 1.6s ease-in-out infinite;
}
@keyframes asPulseDot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.as-panel__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #f3ecff;
  text-shadow: 0 0 18px rgba(197, 160, 89, 0.5);
}
.as-panel__close {
  width: 38px; height: 38px;
  display: grid; place-items: center; line-height: 1;
  border-radius: 10px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  background: transparent; color: var(--as-lilac);
  font-size: 24px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.as-panel__close:hover {
  color: #fff;
  border-color: var(--as-neon);
  box-shadow: 0 0 18px rgba(197, 160, 89, 0.5);
}

/* --- Body / console layout ------------------------------------------------ */
/* Zero-scroll: the body is a centered flex host and never scrolls. */
.as-panel__body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.as-console {
  /* Fits on a single screen by default, but if content ever overflows the
     column scrolls vertically so the "מיקס" button always stays reachable
     at the bottom. */
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;             /* center everything horizontally */
  /* "safe center" centers when it fits, but starts from the top when the
     content is taller than the panel — so nothing is clipped above the scroll. */
  justify-content: safe center;
  gap: 16px;
  padding: 18px 24px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  /* Clean, subtle gold scrollbar (Firefox). WebKit rules are below. */
  scrollbar-width: thin;
  scrollbar-color: rgba(197, 160, 89, 0.4) transparent;
}
/* Clean, subtle gold scrollbar matching the theme (WebKit/Chromium). */
.as-console::-webkit-scrollbar { width: 8px; }
.as-console::-webkit-scrollbar-track { background: transparent; }
.as-console::-webkit-scrollbar-thumb {
  background: rgba(197, 160, 89, 0.35);
  border-radius: 999px;
}
.as-console::-webkit-scrollbar-thumb:hover { background: rgba(197, 160, 89, 0.55); }

/* --- TOP CENTER: fixed 9:16 vertical upload/preview box ------------------- */
.as-stage { flex: none; display: grid; place-items: center; width: 100%; }
.as-video {
  position: relative;
  /* Clean 9:16 vertical ratio (~300x533), perfectly centered. Height-driven so
     width auto-follows the ratio and it never breaks or overflows the screen. */
  height: 533px;
  max-height: 52vh;         /* shrink gracefully on short screens (no scroll) */
  width: auto;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(197, 160, 89, 0.5);
  background: #000;
  box-shadow:
    0 0 30px rgba(197, 160, 89, 0.35),
    0 0 70px rgba(231, 200, 120, 0.2),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
  animation: asAura 3.2s ease-in-out infinite;
}
@keyframes asAura {
  0%,100% { box-shadow: 0 0 30px rgba(197, 160, 89,0.35), 0 0 70px rgba(231, 200, 120,0.2), inset 0 0 30px rgba(0,0,0,0.6); }
  50%     { box-shadow: 0 0 44px rgba(197, 160, 89,0.55), 0 0 100px rgba(231, 200, 120,0.3), inset 0 0 30px rgba(0,0,0,0.6); }
}
.as-video__el { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.45s ease; }
.as-video__scan {
  position: absolute; left: 0; right: 0; height: 40%;
  background: linear-gradient(180deg, transparent, rgba(231, 200, 120, 0.18), transparent);
  animation: asScan 2.6s linear infinite;
  pointer-events: none;
}
@keyframes asScan { 0% { top: -40%; } 100% { top: 100%; } }

/* --- "סיום" glassmorphism finish button (bottom-left corner) ------------- */
.as-finish {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 6;
  padding: 10px 22px;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;                    /* clean, readable white text */
  /* Semi-transparent dark blue/black frosted glass */
  background: rgba(18, 18, 20, 0.55);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  /* Thin subtle glowing accent border */
  border: 1px solid rgba(197, 160, 89, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45), 0 0 16px rgba(197, 160, 89, 0.25);
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.12s;
}
.as-finish:hover {
  transform: translateY(-1px);
  border-color: var(--as-neon);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 22px rgba(197, 160, 89, 0.5);
}

/* --- STEP 1: manual upload dropzone (inside the video box) ---------------- */
.as-drop {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  padding: 16px;
  background:
    radial-gradient(circle at 50% 40%, rgba(197, 160, 89, 0.12), transparent 60%),
    #121214;
  border: 1.5px dashed rgba(197, 160, 89, 0.45);
  border-radius: 18px;
  transition: border-color 0.15s, background 0.15s;
}
.as-drop[hidden] { display: none; }
.as-drop:hover, .as-drop.is-drag {
  border-color: #C5A059;
  background:
    radial-gradient(circle at 50% 40%, rgba(197, 160, 89, 0.2), transparent 60%),
    #121214;
}
.as-drop__ico {
  font-size: 26px; color: #E7C878;
  text-shadow: 0 0 14px rgba(197, 160, 89, 0.8);
}
.as-drop__t { font-size: 13px; font-weight: 700; color: #f3ecff; }
.as-drop__s { font-size: 11px; color: var(--as-lilac); opacity: 0.75; letter-spacing: 0.5px; }

/* --- AI Hologram Initialization loader (inside the video box) ------------- */
.as-holo {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #121214;
  opacity: 1;
  transition: opacity 0.5s ease;
}
.as-holo[hidden] { display: none; }
/* Power-on flash: quick bright glow, then fade out. */
.as-holo.is-flash { animation: asHoloFlash 0.55s ease forwards; }
@keyframes asHoloFlash {
  0%   { opacity: 1; filter: brightness(1); }
  35%  { opacity: 1; filter: brightness(2.6); background: #26262a; }
  60%  { opacity: 0.7; filter: brightness(1.6); }
  100% { opacity: 0; filter: brightness(1); }
}

/* Subtle moving digital grid pattern. */
.as-holo__grid {
  position: absolute;
  inset: -50%;
  background-image:
    linear-gradient(rgba(197, 160, 89, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(197, 160, 89, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  animation: asGridMove 3.5s linear infinite;
}
@keyframes asGridMove { from { transform: translateY(0); } to { transform: translateY(26px); } }

/* Glowing gold monospace status text, centered. */
.as-holo__text {
  position: relative;
  z-index: 1;
  padding: 0 14px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
  color: #E7C878;
  text-shadow: 0 0 10px rgba(197, 160, 89, 0.9), 0 0 22px rgba(197, 160, 89, 0.6);
  direction: rtl;
}
.as-holo__caret {
  display: inline-block;
  color: #E7C878;
  animation: asBlink 0.9s steps(1) infinite;
}

/* --- CENTER: futuristic audio spectrum equalizer ------------------------- */
.as-spectrum {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  height: auto;
  max-height: 130px;
  width: 100%;
  /* Narrower, more compact equalizer, kept centered. */
  max-width: 520px;
  margin: 0 auto;
  padding: 0 10px;
}
.as-spectrum__bar {
  flex: 1;
  min-width: 4px;
  max-width: 16px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--as-cyber) 0%, var(--as-neon) 100%);
  box-shadow: 0 0 8px rgba(197, 160, 89, 0.5);
  transform-origin: bottom;
  /* Idle rhythmic pulse — duration/delay set inline per bar by the JS. */
  animation-name: asEq;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  height: 20%;
}
@keyframes asEq {
  0%, 100% { height: 6%; opacity: 0.75; }
  50%      { height: 24%; opacity: 1; }
}
/* Aggressive mode — faster, taller, hotter glow while rendering. */
.as-spectrum.is-hot .as-spectrum__bar {
  animation-name: asEqHot;
  box-shadow: 0 0 14px rgba(197, 160, 89, 0.9), 0 0 26px rgba(231, 200, 120, 0.5);
}
@keyframes asEqHot {
  0%, 100% { height: 5%; }
  25%      { height: 30%; }
  50%      { height: 12%; }
  75%      { height: 26%; }
}

/* --- TERMINAL: gold render log ------------------------------------------ */
.as-terminal {
  flex: none;
  width: 100%;
  max-width: 620px;
  min-height: 96px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.35);
  background: rgba(18, 18, 20, 0.75);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--as-lilac);
  text-align: left;
  direction: ltr;
  box-shadow: inset 0 0 30px rgba(197, 160, 89, 0.08);
}
.as-terminal__line { display: block; text-shadow: 0 0 10px rgba(197, 160, 89, 0.5); }
.as-terminal__caret {
  display: inline-block;
  color: var(--as-cyber);
  animation: asBlink 0.9s steps(1) infinite;
}
@keyframes asBlink { 0%,50% { opacity: 1; } 51%,100% { opacity: 0; } }

/* --- BOTTOM: single "בחר שמע" dropdown + Mix action ---------------------- */
/* Vertical stack: one selector, with the Mix button centered beneath it. */
.as-controls {
  flex: none;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Dropdown wrapper — the menu opens ABOVE the button (dropup) so it never
   pushes the layout or overflows below the fold. */
.as-select { position: relative; width: 100%; }

/* The visible "בחר שמע" trigger button. */
.as-select__btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #f3ecff;
  border: 1px solid rgba(197, 160, 89, 0.45);
  background: linear-gradient(145deg, rgba(30, 30, 32, 0.85), rgba(18, 18, 20, 0.9));
  transition: border-color 0.15s, box-shadow 0.18s, transform 0.12s;
}
.as-select__btn:hover { border-color: var(--as-neon); box-shadow: 0 8px 26px rgba(197, 160, 89, 0.28); }
.as-select__note { color: var(--as-cyber); font-size: 16px; text-shadow: 0 0 10px rgba(231, 200, 120, 0.7); }
.as-select__label { flex: 1; text-align: center; }
.as-select__chev { color: var(--as-lilac); font-size: 12px; transition: transform 0.18s; }
.as-select.is-open .as-select__chev { transform: rotate(180deg); }

/* The options menu — floats above the trigger. */
.as-select__menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);   /* open upward */
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  background: rgba(18, 18, 20, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(197, 160, 89, 0.15);
  z-index: 5;
  animation: asMenuIn 0.16s ease both;
}
.as-select__menu[hidden] { display: none; }
@keyframes asMenuIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.as-select__opt {
  /* Row layout: style name fills the row, the preview button sits at the END
     (right edge in this RTL menu). */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #f3ecff;
  transition: background 0.13s, color 0.13s;
}
.as-select__opt:hover,
.as-select__opt:focus { background: rgba(197, 160, 89, 0.18); outline: none; }
.as-select__opt.is-selected { color: var(--as-cyber); background: rgba(231, 200, 120, 0.12); }
.as-select__opt-name { flex: 1; text-align: start; }

/* Small round speaker/play preview button at the end of each style row.
   No default browser border/background (that caused the "white dashes"). */
.as-preview {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 50%;
  background: rgba(197, 160, 89, 0.1);
  color: #E7C878;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  -webkit-appearance: none;
  appearance: none;
}
.as-preview::before {
  content: "🔊";
  font-size: 14px;
  line-height: 1;
}
/* When this style's preview is actively playing, swap to a stop glyph + glow. */
.as-preview.is-playing {
  background: rgba(231, 200, 120, 0.28);
  border-color: #E7C878;
  box-shadow: 0 0 12px rgba(231, 200, 120, 0.4);
}
.as-preview.is-playing::before { content: "⏸"; }
/* Loading state: spinning glyph while the MiniMax sample is fetched/generated. */
.as-preview.is-loading::before {
  content: "◌";
  animation: asPreviewSpin 0.8s linear infinite;
}
@keyframes asPreviewSpin { to { transform: rotate(360deg); } }
.as-preview.is-loading {
  background: rgba(231, 200, 120, 0.18);
  border-color: rgba(231, 200, 120, 0.6);
}
.as-preview:hover {
  background: rgba(231, 200, 120, 0.25);
  border-color: #E7C878;
}
.as-preview:active { transform: scale(0.92); }

/* Luxurious gradient action button — smaller, centered below the 2 columns. */
.as-action {
  width: 66%;               /* ~2/3 width of the controls block, centered */
  align-self: center;
  padding: 11px 22px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #fff;
  background: linear-gradient(135deg, #B08D45 0%, #C5A059 45%, #E7C878 100%);
  background-size: 200% 100%;
  box-shadow: 0 14px 40px rgba(197, 160, 89, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.12s, box-shadow 0.18s, background-position 0.4s;
}
.as-action:hover { transform: translateY(-2px); background-position: 100% 0; box-shadow: 0 18px 52px rgba(197, 160, 89, 0.55); }
.as-action:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.as-action[hidden] { display: none; }

.as-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: #E7C878;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.as-loading[hidden] { display: none; }
.as-loading__dot {
  width: 9px;
  height: 9px;
  border: 2px solid rgba(231, 200, 120, 0.3);
  border-top-color: #E7C878;
  border-radius: 50%;
  animation: asLoadingSpin 0.8s linear infinite;
}
@keyframes asLoadingSpin { to { transform: rotate(360deg); } }

/* Golden download button — revealed when rendering completes. */
.as-download {
  width: 100%;

/* ---- Credit cost + balance under the "מיקס" button ---- */
.as-credits {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  margin-top: 10px; text-align: center;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
}
.as-credits__cost { color: #7CF6E3; }
.as-credits__cost b { color: #C9FFF6; font-weight: 800; }
.as-credits__ico { color: #7CF6E3; }
.as-credits__bal { color: rgba(200, 230, 240, 0.55); font-weight: 500; }
.as-credits__bal b { color: rgba(200, 230, 240, 0.85); font-weight: 700; }
/* Not enough balance -> warn in red */
.as-credits.is-insufficient .as-credits__cost,
.as-credits.is-insufficient .as-credits__cost b,
.as-credits.is-insufficient .as-credits__ico { color: #ff8a8a; }

  padding: 13px 22px;
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #2a1c00;
  background: linear-gradient(135deg, #ffe38a 0%, #f5c542 45%, #d98f00 100%);
  box-shadow: 0 14px 44px rgba(245, 197, 66, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  animation: asGoldIn 0.4s ease both;
  transition: transform 0.12s, box-shadow 0.18s;
}
.as-download:hover { transform: translateY(-2px); box-shadow: 0 18px 56px rgba(245, 197, 66, 0.6); }
.as-download[hidden] { display: none; }
@keyframes asGoldIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Reduced-motion respect. */
@media (prefers-reduced-motion: reduce) {
  .as-video, .as-video__scan, .as-spectrum__bar, .as-panel__dot,
  .as-card__wave, .as-terminal__caret { animation: none !important; }
}


