/* popups.css */
/* Confirmation Popup Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.popup-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Select Content Popup Styles */
.popup-content.select-content-popup {
  max-width: 900px;
  width: 90%;
  height: auto;
  aspect-ratio: 16/9;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  gap: 15px;
}

.popup-content.select-content-popup h3 {
  text-align: center;
  margin: 0;
  font-size: 18px;
}

/* Close button as an "×" in the top right */
.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #333;
}

.popup-text {
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: #333;
}

.popup-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.popup-button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
}

.popup-confirm {
  background: var(--purple);
  color: white;
}

.popup-cancel {
  background: #f0f0f0;
  color: #333;
}

/* Alert Toast Styles */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1001;
}

.toast {
  padding: 1rem 1.5rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideIn 0.3s ease-out;
  opacity: 0.95;
}

.toast-success {
  background: #38a169;
  color: white;
}

.toast-error {
  background: #dc2626;
  color: white;
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.fade-out {
  animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
  from { opacity: 0.95; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* Select Content Popup Grid Layout */
.select-content-images-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 15px;
  overflow-y: auto;
  padding: 10px;
  align-items: start;
  justify-items: center;
}

.select-content-image {
  width: 120px;
  height: 180px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  transition: transform 0.2s;
  display: flex;
  flex-direction: column;
  position: relative;
}

.select-content-image:hover {
  transform: scale(1.05);
}

.select-content-image.selected {
  border-color: var(--purple);
  box-shadow: 0 0 10px rgba(88, 80, 236, 0.3);
}

.select-content-image img,
.select-content-video {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  background: #f0f0f0;
}

.image-label {
  text-align: center;
  font-size: 12px;
  margin-top: 8px;
  color: #333;
  font-weight: 500;
}

.select-content-image .image-label {
  display: none;
}

/* Video Control Prevention Styles */
.select-content-video,
#preview-video {
  pointer-events: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.select-content-video::-webkit-media-controls,
#preview-video::-webkit-media-controls {
  display: none !important;
}

.select-content-video::-webkit-media-controls-panel,
.select-content-video::-webkit-media-controls-play-button,
.select-content-video::-webkit-media-controls-start-playback-button,
.select-content-video::-webkit-media-controls-overlay-play-button,
.select-content-video::-webkit-media-controls-fullscreen-button,
#preview-video::-webkit-media-controls-panel,
#preview-video::-webkit-media-controls-play-button,
#preview-video::-webkit-media-controls-start-playback-button,
#preview-video::-webkit-media-controls-overlay-play-button,
#preview-video::-webkit-media-controls-fullscreen-button {
  display: none !important;
  -webkit-appearance: none !important;
}

video::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

video::-webkit-media-controls-container {
  pointer-events: none !important;
}

/* Loading overlay for videos */
.video-loading-overlay {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 180px;
  background: rgba(0,0,0,0.5);
  top: 0;
  left: 0;
  z-index: 1;
  border-radius: 6px;
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
  .popup-content.select-content-popup {
    aspect-ratio: auto;
    height: 80vh;
    width: 95%;
  }

  .select-content-images-container {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .select-content-image {
    width: 100px;
    height: 178px;
  }

  .select-content-image img,
  .select-content-video {
    height: 150px;
  }

  .video-loading-overlay {
    height: 150px;
  }
}

/* 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;
  text-align: center;
  white-space: nowrap;
}

/* NEW CSS for the upload image card inside the Select Content popup */
.select-content-upload {
  width: 120px;
  height: 180px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #fafafa;
  transition: background 0.2s;
}

.select-content-upload:hover {
  background: #f0f0f0;
}

.select-content-upload .upload-rectangle {
  font-size: 48px;
  color: #ccc;
}

.select-content-upload .upload-label {
  margin-top: 8px;
  font-size: 14px;
  color: #333;
}
