/* i2v.css — I2V Studio (Image → Video)
   Matches Mojoe dark theme + video.css layout style
*/

/* -------------------------
   Layout
------------------------- */

.i2v-panel {
  display: flex;
  flex-direction: column;
  min-height: 480px;
  gap: 20px;
}

.i2v-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.i2v-top-row {
  display: flex;
  gap: 20px;
  align-items: stretch;
}

.i2v-top-left {
  flex: 0 0 420px;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.i2v-top-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.i2v-bottom {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* -------------------------
   Cards
------------------------- */

.i2v-source-card,
.i2v-settings-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* -------------------------
   Image Source Preview
------------------------- */

.i2v-source-preview {
  width: 100%;
  aspect-ratio: 3 / 3.4;
  background: #0f1424;
  border-radius: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.1);

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}

.i2v-source-preview:hover,
.i2v-source-preview.drag-over {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(15, 20, 36, 1);
}

.i2v-source-preview.has-image {
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.3);
}

.i2v-source-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.i2v-source-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
}

.i2v-source-actions {
  display: flex;
  gap: 10px;
}

/* -------------------------
   Textareas (keep consistent)
------------------------- */

.textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
}

.textarea:focus {
  outline: none;
  border-color: #38bdf8;
}

/* -------------------------
   Add scene button
------------------------- */

.i2v-add-scene {
  margin-top: 8px;
  background: rgba(56, 189, 248, 0.07);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  color: #cbd5e1;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  text-align: left;
}

.i2v-add-scene:hover {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(56, 189, 248, 0.10);
}

.i2v-add-scene:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* -------------------------
   Generate strip (pill)
------------------------- */

.i2v-generate-strip {
  /* Match Image Studio: compact pill with a gap between button + cost */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  row-gap: 10px;
  flex-wrap: wrap;
  align-self: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: radial-gradient(
    circle at 0 0,
    rgba(248, 113, 113, 0.22),
    rgba(15, 23, 42, 0.96)
  );
  border: 1px solid rgba(55, 65, 81, 0.9);
  max-width: 100%;
}

.i2v-generate-btn {
  flex: 0 0 auto;
  min-width: 150px;
  justify-content: center;
  text-align: center;
}

.i2v-credit-est {
  flex: 0 0 auto;
  font-size: 11px;
  color: rgba(165, 180, 252, 1);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: rgba(15, 23, 42, 0.96);
  white-space: nowrap;
}

.i2v-status {
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  min-height: 20px;
}

.i2v-status.active { color: #38bdf8; }
.i2v-status.error  { color: #f87171; }
.i2v-status.success{ color: #4ade80; }

/* -------------------------
   Gallery
------------------------- */

.i2v-gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 8px 2px 0;
  overflow-y: auto;
}

.image-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 0.75rem 0;
  font-size: 12px;
  color: var(--sub, #94a3b8);
}

/* Reuse same thumb wrappers as video.css */
.image-thumb {
  width: 100%;
  display: flex;
  justify-content: center;
}

.video-thumb-inner {
  position: relative;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 9 / 16;
  margin-inline: auto;

  border-radius: 0.9rem;
  overflow: hidden;

  background: radial-gradient(circle at top, #1e293b 0, #020617 60%, #000 100%);
  padding: 2px;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.4),
    0 0 20px rgba(59, 130, 246, 0.2);
}

.video-thumb-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(148, 163, 184, 0.35);
  pointer-events: none;
}

.video-thumb-inner video {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 0.75rem;
  object-fit: cover;
}
.i2v-panel .image-thumb-actions {
  position: absolute;
  inset-inline: 6px;
  top: 8px;
  bottom: auto;
  justify-content: flex-end;
  pointer-events: none;
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 2;
}
.i2v-panel .image-thumb-action-btn {
  border: none;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.86);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.5);
  backdrop-filter: blur(6px);
}

.image-thumb-action-btn:hover {
  border-color: rgba(248, 113, 113, 0.9);
}

/* -------------------------
   Mobile stacking
------------------------- */

@media (max-width: 900px) {
  .i2v-top-row {
    flex-direction: column;
  }
  .i2v-top-left {
    max-width: 100%;
    flex: 1;
  }
}

@media (max-width: 680px) {
  .i2v-generate-strip {
    flex-direction: column;
    align-items: stretch;
    border-radius: 18px;
  }

  .i2v-credit-est {
    position: static;
    transform: none;
    width: 100%;
    text-align: center;
  }
}
/* I2V video thumbs: keep actions clickable (container is click-through) */
.i2v-panel .image-thumb-actions .image-thumb-action-btn { pointer-events: auto; }

/* -------- Variant A: preview + selected thumbs -------- */
.i2v-variant-a .i2v-card-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.i2v-variant-a .i2v-card-hint{opacity:.9}
.i2v-variant-a .i2v-preview-card{padding-bottom:14px}
.i2v-variant-a .i2v-main-preview{
  width:100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: rgba(2,6,23,.55);
  border: 1px solid rgba(255,255,255,.07);
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 8px;
}
.i2v-variant-a .i2v-main-video{
  width:100%;
  height:100%;
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}
.i2v-variant-a .i2v-main-empty{
  padding: 18px;
  font-size: 12px;
}
.i2v-variant-a .i2v-thumb-grid{
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.i2v-variant-a .video-thumb-inner.is-selected{
  box-shadow:
    0 0 0 1px rgba(56,189,248,.75),
    0 0 22px rgba(56,189,248,.22);
}

.i2v-variant-a .i2v-scene-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.i2v-variant-a .i2v-scene-chips{
  display:flex;
  gap: 8px;
}
.i2v-variant-a .i2v-chip{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor:pointer;
}
.i2v-variant-a .i2v-chip:disabled{opacity:.5; cursor:not-allowed}
.i2v-variant-a .i2v-chip.is-active{
  border-color: rgba(56,189,248,.40);
  background: linear-gradient(135deg, rgba(251,55,160,.12), rgba(56,189,248,.10));
}

@media (max-width: 900px){
  .i2v-variant-a .i2v-main-preview{aspect-ratio: 9 / 16;}
}


/* Toggle remove scene state */
.i2v-add-scene.is-remove{
  background: rgba(248, 113, 113, 0.08);
  border-style: solid;
  border-color: rgba(248, 113, 113, 0.45);
}
.i2v-add-scene.is-remove:hover{
  border-color: rgba(248, 113, 113, 0.75);
  background: rgba(248, 113, 113, 0.10);
}
