/* ===========================================================================
   Aura Studio — "יצירת סרטון" (Create Video) feature styles
   ---------------------------------------------------------------------------
   Fully self-contained. Shares NO selectors or structure with the garment
   modal in studio.css. Uses the shared theme CSS variables only, and defines
   its OWN keyframes so it has zero dependency on studio.css.
   =========================================================================== */

/* SPLIT-SCREEN COMMAND CENTER: the Create Video feature opens as a centered,
   cinema-proportioned modal (wider than tall) over an atmospheric aura backdrop.
   It inherits the site's global theme tokens (--ink, --brand, etc.). */
.video-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  /* Soft atmospheric gradient aura on the sides / backdrop */
  background: radial-gradient(circle at 15% 20%, rgba(197, 160, 89, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 85% 85%, rgba(197, 160, 89, 0.10) 0%, transparent 50%),
              #121214;
}
.video-overlay.is-open { display: flex; animation: videoFade 0.18s ease both; }
@keyframes videoFade { from { opacity: 0; } to { opacity: 1; } }

/* Centered cinema-screen modal: wider but slightly shorter. */
.video-modal {
  position: relative;
  width: 100%; max-width: 860px;
  height: 100%; max-height: 620px;
  display: flex; flex-direction: column;
  border: 1px solid rgba(197, 160, 89, 0.25);
  border-radius: 24px;
  overflow: hidden;
  color: var(--ink);
  /* Dark-glass base — same charcoal glass as the Audio Addition panel. */
  background: rgba(18, 18, 20, 0.7);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.8), 0 0 60px rgba(197, 160, 89, 0.08);
  animation: videoPop 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.video-modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 56px; flex: none;
  border-bottom: 1px solid rgba(197, 160, 89, 0.22);
  background: rgba(18, 18, 20, 0.4);
  /* Glassmorphism */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.video-modal__title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.video-modal__close {
  width: 34px; height: 34px; line-height: 1;
  display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--line);
  background: transparent; color: var(--muted);
  font-size: 22px; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.video-modal__close:hover { color: var(--ink); border-color: var(--brand-2); }
.video-modal__body {
  flex: 1; min-height: 0; padding: 0; overflow: hidden;
}
@keyframes videoPop {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---- Split-screen 2-column grid ---- */
.video-split {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
/* Both columns stay visible. video.js toggles [hidden] on these to switch
   "steps", but in the split-screen layout they must remain side by side, so
   we neutralize the attribute here (inner elements still toggle normally). */
.video-col[hidden] { display: flex !important; }
.video-col {
  display: flex; align-items: center; justify-content: center;
  min-height: 0; padding: 26px;
}
.video-col--left {
  border-inline-end: 1px solid rgba(197, 160, 89, 0.18);
}
.video-col--right {
  padding: 24px 22px;
  overflow-y: auto;
}

/* ---- Right column: AI Assistant panel ---- */
.video-assistant {
  display: flex; flex-direction: column;
  width: 100%; height: 100%;
  gap: 9px;
}
.video-assistant__eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.28em;
  color: #E7C878;
}

/* ---- Vertical 9:16 frame with gold glow ---- */
.video-frame {
  position: relative; overflow: hidden;
  height: 100%; max-height: 448px; aspect-ratio: 9 / 16;
  border-radius: 20px;
  border: 1px solid rgba(197, 160, 89, 0.35);
  background: #121214;
  box-shadow:
    0 0 0 1px rgba(197, 160, 89, 0.25),
    0 0 40px rgba(197, 160, 89, 0.55),
    0 0 90px rgba(197, 160, 89, 0.35);
}
.video-player {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  animation: videoFade 0.5s ease both;
}
.video-player[hidden] { display: none; }

/* ---- Loading sequence (robot animation) ---- */
.video-loader { position: absolute; inset: 0; }
.video-loader[hidden] { display: none; }

/* Percentage counter — top corner */
.video-counter {
  position: absolute; top: 12px; inset-inline-end: 14px; z-index: 3;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 20px; font-weight: 700; letter-spacing: 0.04em;
  color: #E7C878;
  text-shadow: 0 0 12px rgba(197, 160, 89, 0.9);
}

/* Horizontal neon gold laser scanner — moves up and down.
   Uses top:0 -> 100% (relative to the frame's own height) so it works with the
   split-screen height-driven frame at any size. */
.video-scanner {
  position: absolute; left: 0; right: 0; top: 0; z-index: 2;
  height: 3px;
  background: linear-gradient(90deg, transparent, #E7C878 20%, #C5A059 50%, #E7C878 80%, transparent);
  box-shadow: 0 0 14px 3px rgba(197, 160, 89, 0.9), 0 0 40px 8px rgba(197, 160, 89, 0.5);
  animation: videoScan 2.2s ease-in-out infinite alternate;
}
@keyframes videoScan {
  from { top: 0; }
  to { top: calc(100% - 3px); }
}

/* Live queue/status badge — shows "ממתין בתור… / מעבד…" under the % counter so a
   long Kling render reads as active progress instead of a frozen bar. */
.video-status {
  position: absolute; top: 50%; left: 0; right: 0; z-index: 3;
  transform: translateY(28px);
  text-align: center;
  font-family: "Assistant", system-ui, sans-serif;
  font-size: 13px; font-weight: 600; letter-spacing: 0.2px;
  color: #E7C878;
  text-shadow: 0 0 10px rgba(197, 160, 89, 0.6);
  opacity: 0.95;
}
.video-status::after {
  content: "";
  display: inline-block; width: 1em; text-align: left;
  animation: videoStatusDots 1.4s steps(4, end) infinite;
}
@keyframes videoStatusDots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}

.video-format {
  position: relative;
  width: 100%;
}
.video-format__button {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid rgba(197, 160, 89, 0.35);
  border-radius: 10px;
  background: rgba(18, 18, 20, 0.45);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.video-format__button:hover {
  border-color: var(--brand-2);
  background: rgba(197, 160, 89, 0.12);
  transform: translateY(-1px);
}
.video-format__button-label { flex: 1; }
.video-format__button-value {
  margin-inline-start: 8px;
  color: #E7C878;
  font-size: 12px;
  font-weight: 700;
}
.video-format__menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline: 0;
  z-index: 8;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(197, 160, 89, 0.45);
  border-radius: 12px;
  background: rgba(18, 18, 20, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.video-format__menu[hidden] { display: none; }
.video-format__option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
}
.video-format__option:hover,
.video-format__option.is-active {
  border-color: rgba(197, 160, 89, 0.45);
  background: rgba(197, 160, 89, 0.13);
  color: #E7C878;
}
.video-format__icon {
  width: 18px;
  color: #E7C878;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

/* Typewriter log — monospace, gold */
.video-log {
  position: absolute; left: 14px; right: 14px; bottom: 16px; z-index: 3;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12.5px; line-height: 1.7;
  color: #E7C878;
  text-shadow: 0 0 8px rgba(197, 160, 89, 0.55);
  min-height: 44px;
}
.video-log__line { display: block; white-space: pre-wrap; word-break: break-word; }
.video-log__caret {
  display: inline-block; width: 8px;
  animation: videoCaret 0.8s steps(1) infinite;
}
@keyframes videoCaret { 50% { opacity: 0; } }

/* ---- Download button: gold gradient ---- */
.video-download {
  width: 100%; max-width: 100%;
  padding: 14px 20px;
  border: none; border-radius: 14px;
  font-family: inherit; font-size: 15px; font-weight: 800; letter-spacing: 0.02em;
  color: #fff; cursor: pointer;
  background: linear-gradient(90deg, #C5A059 0%, #C5A059 45%, #E7C878 100%);
  box-shadow: 0 12px 30px rgba(197, 160, 89, 0.45), 0 0 24px rgba(231, 200, 120, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  animation: videoFade 0.5s ease both;
}
.video-download:hover { transform: translateY(-2px); filter: brightness(1.08); }
.video-download:active { transform: translateY(0); }
.video-download[hidden] { display: none; }
.video-download:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.3); }
.video-download:disabled:hover { transform: none; filter: grayscale(0.3); }

/* ---- Right column: AI Assistant text + upload + chat ---- */
.video-intro__title {
  margin: 0; font-size: 19px; font-weight: 800; color: #ffffff; text-align: start;
}
/* Soft-gold secondary subtext (title stays white) */
.video-intro__sub {
  margin: 0; font-size: 12.5px; line-height: 1.6; text-align: start;
  color: rgba(197, 160, 89, 0.75);
}
/* Upload zone: darker contrasting box, flexes to fill the middle of the panel */
.video-intro__drop {
  position: relative; display: flex; align-items: center; justify-content: center;
  flex: 1; min-height: 90px; width: 100%;
  border-radius: 18px; cursor: pointer; overflow: hidden;
  border: 1px dashed rgba(197, 160, 89, 0.4);
  background: rgba(10, 10, 12, 0.4);
  transition: border-color 0.15s, background 0.15s;
}
.video-intro__drop:hover {
  border-color: rgba(197, 160, 89, 0.75);
  background: rgba(10, 10, 12, 0.6);
}
.video-intro__drop-text {
  padding: 0 16px; text-align: center; font-size: 13px; color: #ffffff;
}
.video-intro__preview {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.video-intro__preview[hidden] { display: none; }
/* When an image is uploaded, the preview is clickable (opens full-size modal)
   instead of reopening the file picker — so the drop box no longer acts as a
   label in that state. */
.video-intro__drop.has-image { cursor: zoom-in; }
.video-intro__drop.has-image:hover { border-color: rgba(197, 160, 89, 0.75); }

/* Delete/Replace image icon — top-right corner of the upload box. */
.video-intro__remove {
  position: absolute; top: 8px; inset-inline-end: 8px; z-index: 3;
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(10, 10, 12, 0.75);
  color: #fff; font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.video-intro__remove:hover { background: #d9534f; border-color: transparent; transform: scale(1.06); }
.video-intro__remove[hidden] { display: none; }

/* Duration selector row ("בחר אורך") — sits above the background input. */
.video-length {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
}
.video-length__label {
  font-size: 13px; font-weight: 700; color: #E7C878;
  white-space: nowrap;
}
.video-length__select {
  flex: 1;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(197, 160, 89, 0.6);
  background: rgba(10, 10, 12, 0.5);
  color: #ffffff;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.video-length__select:hover,
.video-length__select:focus {
  outline: none;
  border-color: rgba(197, 160, 89, 0.9);
  box-shadow: 0 0 16px rgba(197, 160, 89, 0.25);
}
.video-length__select option { background: #17171c; color: #ffffff; }

/* Background choice — two clear toggle buttons ("פרומפט חופשי" / "עצלן לחץ כאן") */
.video-bg {
  display: flex; gap: 8px; width: 100%;
}
.video-bg__opt {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  background: rgba(10, 10, 12, 0.5);
  color: rgba(245, 245, 250, 0.75);
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.video-bg__opt:hover { color: #E7C878; border-color: rgba(197, 160, 89, 0.7); }
.video-bg__opt.is-active {
  color: #1a1408;
  background: linear-gradient(135deg, #C5A059 0%, #E7C878 100%);
  border-color: transparent;
  box-shadow: 0 0 16px rgba(197, 160, 89, 0.3);
}
.video-chat[hidden] { display: none; }

/* Rounded chat input row — fully rounded with a neon gold border */
.video-chat {
  display: flex; align-items: center;
  width: 100%;
  padding: 4px 6px;
  border-radius: 30px;
  border: 1px solid rgba(197, 160, 89, 0.6);
  background: rgba(10, 10, 12, 0.5);
  box-shadow: 0 0 16px rgba(197, 160, 89, 0.18);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.video-chat:focus-within {
  border-color: rgba(197, 160, 89, 0.9);
  box-shadow: 0 0 22px rgba(197, 160, 89, 0.35);
}
.video-intro__prompt {
  width: 100%; resize: none;
  max-height: 60px;
  padding: 8px 14px;
  border: none; border-radius: 26px;
  background: transparent; color: #ffffff;
  font-family: inherit; font-size: 13.5px; line-height: 1.5;
}
.video-intro__prompt:focus { outline: none; }
.video-intro__prompt::placeholder { color: rgba(197, 160, 89, 0.55); }

/* Push the action buttons to the bottom of the right panel */
.video-action { margin-top: auto; }

.video-intro__error {
  width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(217, 83, 79, 0.45);
  border-radius: 10px;
  background: rgba(217, 83, 79, 0.1);
  color: #f0a3a0;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: center;
}

/* Keep the video credit summary inside the visible assistant panel after the
   format control is added. */
.video-assistant .credit-summary {
  margin-top: 6px;
  padding: 9px 12px;
}

/* Responsive: stack the two columns on narrow screens. */
@media (max-width: 720px) {
  .video-modal { max-height: none; height: auto; max-width: 420px; }
  .video-split { grid-template-columns: 1fr; }
  .video-col--left { border-inline-end: 0; border-bottom: 1px solid rgba(197, 160, 89, 0.18); }
  .video-frame { max-height: 60vh; }
}

/* ---- Main action button "צור סרטון": energetic fluid gradient ---- */
#videoSubmit {
  background: linear-gradient(135deg, #C5A059 0%, #B08D45 100%);
  box-shadow: 0 8px 20px rgba(197, 160, 89, 0.3);
  transition: all 0.3s ease;
}
#videoSubmit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(197, 160, 89, 0.5);
  filter: brightness(1.1);
}

/* Inline error surfaced inside the loader on API failure. */
.video-error {
  position: absolute; left: 14px; right: 14px; bottom: 16px; z-index: 4;
  font-family: "Courier New", ui-monospace, monospace;
  font-size: 12.5px; line-height: 1.6; color: #ff9db0;
  text-shadow: 0 0 8px rgba(255, 80, 120, 0.4);
}
