@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Oxanium:wght@200..800&display=swap');

:root {
  --dark-blue: #091747;
  --purple: #5850ec;
  --light-gray: #f4f5f7;
  --dark-gray: #6b7280;
  --green: #166534;
  --light-green: #dcfce7;
  --red: #dc2626;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* Back Button Styling */
header {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1001;
}
/* Back Button Styling */
.back-button-container {
  width: 100%;
  padding: 30px 30px 0; /* Space at the top */
}

.back-button {
  display: inline-block;
  color: var(--purple);
  text-decoration: none;
  font-size: 16px;
  font-weight: bold;
}

.back-button:hover {
  text-decoration: underline;
}

#edit {
  display: flex;
  justify-content: center;
  background: #fff;
}

#edit .container {
  display: grid;
  gap: 20px;
  max-width: 1920px;
  padding: 80px 20px;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
}

#edit .container .image-animation {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  background: #fff;
  box-shadow: 1px 1px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

#edit .container .image-animation .button-group {
  display: flex;
  gap: 10px;
}

#edit .container .image-animation .button-group button {
  padding: 8px 12px;
  background: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark-gray);
  cursor: pointer;
}

#edit .container .image-animation .button-group button.active {
  color: var(--purple);
  background: rgba(88, 80, 236, 0.2);
}

#edit .container .image-animation .animation-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 640px;
  overflow-y: auto;
}

#edit .container .image-animation .animation-list .scane-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border: 2px solid var(--dark-blue);
  border-radius: 8px;
  position: relative;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane.active {
  background: rgba(88, 80, 236, 0.2);
}

#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .scane-label {
  width: 85px; /* Fixed width for Scene number */
  text-align: center;
  flex-shrink: 0; /* Prevents the label from shrinking */
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--green);
  background: var(--light-green);
  border-radius: 999px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

/* New: Inline Button Group for Image Mode */
.button-group-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap; /* Allows buttons to wrap */
  justify-content: flex-end;
}

/* Button style for Create Image */
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-create-image {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 4px;
  background: var(--purple);
  cursor: pointer;
}

/* Button style for Select Content (always purple) */
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-select-content {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 4px;
  background: var(--purple) !important;
  cursor: pointer;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper button:disabled {
  background: #aaa;
  cursor: not-allowed;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane textarea {
  padding: 8px;
  font-size: 14px;
  background: #fff;
  border: 1px solid var(--dark-blue);
  border-radius: 4px;
  resize: none;
}

#edit .container .image-animation .animation-list .scane-wrapper select {
  padding: 8px;
  font-size: 14px;
  color: #000;
  background: #fff;
  border: 1px solid var(--dark-blue);
  border-radius: 4px;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane-subtitle {
  font-size: 14px;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane-subtitle span {
  font-weight: 600;
}

/* SCENE SUBTITLE */
#edit .container .image-animation .animation-list .scane-wrapper .scane-subtitle.words-input-wrapper {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#edit .container .image-animation .animation-list .scane-wrapper .scane-subtitle.words-input-wrapper .word-input {
  field-sizing: content;
  padding: 8px;
  font-size: 14px;
  color: #000;
  background: #fff;
  border: 1px solid var(--dark-blue);
  border-radius: 4px;
}

/* Tooltip container */
#edit .container .image-animation .animation-list .transition-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

#edit .container .image-animation .animation-list .transition-selector select {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  color: #000;
  background: #fff;
  border: 2px solid var(--dark-blue);
  border-radius: 4px;
  resize: none;
}

.tooltip-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 99px;
  width: 20px;
  height: fit-content;
  aspect-ratio: 1/1;
  cursor: pointer;
  background: var(--dark-gray);
  z-index: 10;
}

.tooltip {
  display: inline-block;
  position: relative;
  height: 12px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 280px;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 6px 8px;
  border-radius: 4px;
  position: absolute;
  top: 50%;
  right: 120%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 9999;
}

.tooltip .tooltip-text::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent transparent #333;
}

.tooltip-wrapper.active .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* IMAGE WRAPPER / PREVIEW */
#edit .container .image-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 20px;
  overflow: hidden;
  padding-top: 20px;
}

#edit .container .image-wrapper .image-scane {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9/16;  
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  background: #ccc;
}

#edit .container .image-wrapper .image-scane img {
  width: 100%;
  height: 100%;
  display: block;
}

#edit .container .image-wrapper .btn-create-video {
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 4px;
  background: var(--purple);
  cursor: pointer;
}

#edit .container .image-wrapper .btn-create-video:hover {
  background: rgba(88, 80, 236, 0.8);
}

/* Loading overlay for the main preview */
.preview-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(128,128,128,0.5);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.preview-loading-spinner {
  width: 30px;
  height: 30px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

#preview-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Changed from 'contain' to 'cover' */
  background: black;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@media only screen and (min-width: 768px) {
  #edit .container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media only screen and (min-width: 1440px) {
  #edit .container .image-animation .animation-list {
    max-height: 600px;
  }
}

/* NEW: AI Animate button styling */
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-animate-image {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 4px;
  background: var(--purple);
  cursor: pointer;
  margin-left: 5px;
}

/* Make these specific buttons the same width */
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-select-content,
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-create-image,
#edit .container .image-animation .animation-list .scane-wrapper .scane .label-wrapper .btn-animate-image {
  width: 120px; /* Fixed width for all three buttons */
  text-align: center;
  white-space: nowrap;
}