* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.video-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #2a2a2a;
  padding: 20px;
  min-width: 0; /* Allow shrinking */
}

.video-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  min-height: 200px; /* Minimum height for very small screens */
  max-height: calc(100vh - 300px); /* Prevent overflow */
}

.video-element {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  position: relative;
  max-width: 100%;
  max-height: 100%;
}

.video-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  padding: 20px;
}

.video-placeholder h3 {
  font-size: clamp(16px, 4vw, 24px); /* Responsive font size */
  margin-bottom: 10px;
}

.video-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vw, 20px); /* Responsive gap */
  margin-top: 20px;
  padding: clamp(10px, 2vw, 20px);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  backdrop-filter: blur(10px);
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

.control-btn {
  background: #4caf50;
  border: none;
  border-radius: 50%;
  width: clamp(40px, 6vw, 50px); /* Responsive button size */
  height: clamp(40px, 6vw, 50px);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 2.5vw, 18px);
  transition: all 0.3s ease;
  flex-shrink: 0; /* Prevent shrinking */
}

.control-btn:hover {
  background: #45a049;
  transform: scale(1.1);
}

.control-btn.play {
  background: #2196f3;
}

.control-btn.play:hover {
  background: #1976d2;
}

.time-display {
  font-family: "Courier New", monospace;
  font-size: clamp(12px, 2vw, 16px);
  color: #fff;
  min-width: clamp(80px, 15vw, 120px);
  text-align: center;
  flex-shrink: 0;
}

.sidebar {
  width: 350px;
  background: #2a2a2a;
  border-left: 1px solid #404040;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0; /* Prevent shrinking */
}

.audio-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #fff;
}

.audio-file {
  background: #3a3a3a;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid #404040;
  position: relative;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.audio-play-btn {
  background: #4caf50;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.3s ease;
}

.audio-play-btn:hover {
  background: #45a049;
  transform: scale(1.1);
}

.audio-play-btn.playing {
  background: #ff9800;
}

.audio-progress {
  flex: 1;
  height: 4px;
  background: #555;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.audio-progress-fill {
  height: 100%;
  background: #4caf50;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s ease;
}

.audio-time {
  font-size: 11px;
  color: #ccc;
  font-family: "Courier New", monospace;
  min-width: 40px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.add-audio-btn {
  background: #2196f3;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-audio-btn:hover {
  background: #1976d2;
  transform: translateY(-1px);
}

.audio-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.audio-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remove-audio-btn {
  background: #f44336;
  border: none;
  border-radius: 4px;
  width: 20px;
  height: 20px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.remove-audio-btn:hover {
  background: #d32f2f;
  transform: scale(1.1);
}

.upload-area {
  border: 2px dashed #555;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 15px;
  background: rgba(255, 255, 255, 0.02);
}

.upload-area:hover {
  border-color: #2196f3;
  background: rgba(33, 150, 243, 0.05);
}

.upload-area.dragover {
  border-color: #4caf50;
  background: rgba(76, 175, 80, 0.1);
}

.upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.upload-area p {
  color: #ccc;
  margin-bottom: 5px;
}

.upload-area small {
  color: #888;
  font-size: 11px;
}

.audio-filename {
  font-size: 14px;
  color: #fff;
  flex: 1;
  margin-right: 10px;
}

.audio-duration {
  font-size: 12px;
  color: #888;
  font-family: "Courier New", monospace;
}

.volume-control {
  margin-top: 10px;
}

.volume-label {
  font-size: 12px;
  color: #ccc;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
}

.volume-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: #2196f3;
  border-radius: 50%;
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #2196f3;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.timeline-container {
  height: 200px;
  background: #1a1a1a;
  border-top: 1px solid #404040;
  padding: 20px;
  overflow-x: auto;
  flex-shrink: 0; /* Prevent shrinking */
}

.timeline {
  height: 100%;
  background: #2a2a2a;
  border-radius: 8px;
  position: relative;
  min-width: 800px;
}

.timeline-tracks {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.track {
  flex: 1;
  border-bottom: 1px solid #404040;
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px;
}

.track:last-child {
  border-bottom: none;
}

.track-label {
  width: 80px;
  font-size: 12px;
  color: #ccc;
  padding-right: 10px;
}

.track-content {
  flex: 1;
  height: 40px;
  background: #3a3a3a;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.video-clip {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #45a049);
  border-radius: 4px;
  width: 60%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
}

.audio-clip {
  height: 100%;
  background: linear-gradient(90deg, #2196f3, #1976d2);
  border-radius: 4px;
  width: 40%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
  margin-left: 10px;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff4444;
  left: 20%;
  z-index: 10;
}

.playhead::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -6px;
  width: 14px;
  height: 14px;
  background: #ff4444;
  transform: rotate(45deg);
}

.export-section {
  border-top: 1px solid #404040;
  padding-top: 20px;
  margin-top: 20px;
}

.export-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 15px;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.export-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.format-selector {
  margin-bottom: 15px;
}

.format-select {
  width: 100%;
  background: #3a3a3a;
  border: 1px solid #404040;
  border-radius: 6px;
  padding: 10px;
  color: white;
  font-size: 14px;
}

.waveform {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: repeating-linear-gradient(
    90deg,
    rgba(33, 150, 243, 0.3) 0px,
    rgba(33, 150, 243, 0.3) 2px,
    transparent 2px,
    transparent 4px
  );
}

#spinner {
  display: block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.spinner-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100%; /* 50% of the viewport width */
  height: 100%; /* 50% of the viewport height */
  background-color: rgba(0, 0, 0, 0.9); /* Semi-transparent background */
  transform: translate(-50%, -50%); /* Center horizontally and vertically */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999999999;
  border-radius: 10px;
  box-sizing: border-box;
}

.spinner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Additional styling for the text */
.spinner-container p {
  margin-top: 20px;
  font-size: 18px;
  color: white; /* White text for visibility on dark overlay */
  display: block;
  width: 200px;
  position: absolute;
  left: 50%;
  top: 50%;
}

.spinner-msg {
  position: absolute;
  bottom: 200px;
  color: #fff;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */

/* Tablet and smaller desktop screens */
@media (max-width: 1200px) {
  .sidebar {
    width: 300px;
  }

  .video-preview {
    padding: 15px;
  }
}

/* Tablet screens */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }
  .spinner-overlay {
    width: 100%; /* 50% of the viewport width */
  }
  .sidebar {
    width: 100%;
    max-height: 300px;
    border-left: none;
    border-top: 1px solid #404040;
  }

  .video-preview {
    padding: 10px;
  }

  .video-container {
    min-height: 200px;
    max-height: 40vh;
  }

  .timeline-container {
    height: 150px;
    padding: 15px;
  }

  .video-controls {
    padding: 15px;
    gap: 15px;
  }
}

/* Mobile screens */
@media (max-width: 480px) {
  .editor-container {
    height: 100dvh; /* Use dynamic viewport height for mobile */
  }

  .video-preview {
    padding: 8px;
  }

  .video-container {
    min-height: 150px;
    max-height: 35vh;
  }

  .video-controls {
    padding: 10px;
    gap: 10px;
  }

  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }

  .time-display {
    font-size: 12px;
    min-width: 80px;
  }

  .sidebar {
    padding: 15px;
    max-height: 250px;
  }

  .timeline-container {
    height: 120px;
    padding: 10px;
  }

  .section-title {
    font-size: 14px;
  }

  .upload-area {
    padding: 20px 15px;
  }

  .upload-icon {
    font-size: 24px;
  }
}

/* Very small mobile screens */
@media (max-width: 320px) {
  .video-container {
    min-height: 120px;
    max-height: 30vh;
  }

  .control-btn {
    width: 35px;
    height: 35px;
    font-size: 12px;
  }

  .time-display {
    font-size: 10px;
    min-width: 70px;
  }

  .timeline-container {
    height: 100px;
  }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .main-content {
    flex-direction: row;
  }

  .sidebar {
    width: 280px;
    max-height: none;
    border-top: none;
    border-left: 1px solid #404040;
  }

  .timeline-container {
    height: 80px;
  }

  .video-container {
    max-height: calc(100vh - 150px);
  }
}
