/* Quiz Video Generator Styles */

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 15px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

h1 {
  text-align: center;
  color: #333;
  margin: 30px 0;
  font-size: 2.5em;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.slogan {
  text-align: center;
  color: #666;
  margin: -10px 0 30px 0;
  font-size: 1.2em;
  font-weight: 500;
  font-style: italic;
  background: linear-gradient(45deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 30px;
}

/* Tablet responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
  .main-content {
    gap: 25px;
    padding: 25px;
  }
  
  #quizCanvas {
    max-width: 500px;
  }
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
  
  /* Reorder sections for mobile */
  .main-content {
    display: flex;
    flex-direction: column;
  }
  
  .preview-section {
    order: -1; /* Preview comes first on mobile */
  }
  
  .form-section {
    order: 1; /* Form comes second on mobile */
  }
}

.form-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
  position: relative;
}

.form-section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
}

.form-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 15;
  border-radius: 10px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.background-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.upload-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.upload-btn {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: transform 0.2s ease;
}

.upload-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.or-divider {
  text-align: center;
  color: #666;
  font-style: italic;
  position: relative;
}

.or-divider::before,
.or-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #ddd;
}

.or-divider::before {
  left: 0;
}

.or-divider::after {
  right: 0;
}

.image-preview {
  position: relative;
  display: inline-block;
  max-width: 200px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.image-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.remove-upload-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-upload-btn:hover {
  background: #d32f2f;
}

.add-answer-btn {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.3s ease;
  margin-top: 10px;
}

.add-answer-btn:hover {
  background: #45a049;
}

.process-btn {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  width: 100%;
  transition: transform 0.2s ease;
  margin-top: 20px;
}

.process-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.process-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.validation-message {
  background: #ffebee;
  border: 1px solid #f44336;
  color: #c62828;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 14px;
  text-align: center;
}

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

.answer-input-wrapper {
  position: relative;
  flex: 1;
}

.answer-input input {
  width: 100%;
  padding-right: 30px;
  height: 50px;
  box-sizing: border-box;
}

.answer-input .remove-answer-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #f44336;
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  cursor: pointer;
  font-size: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  line-height: 1;
  padding: 0;
  box-sizing: border-box;
}

.answer-input-wrapper:hover .remove-answer-btn {
  display: flex;
}

.answer-input .remove-answer-btn:hover {
  background: #d32f2f;
}

.correct-answer-btn {
  width: 50px;
  height: 50px;
  border: 2px solid #333;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 20px;
  flex-shrink: 0;
}

.correct-answer-btn:hover {
  border-color: #4CAF50;
  background: #f0f8f0;
}

.correct-answer-btn.selected {
  background: #4CAF50;
  border-color: #4CAF50;
  color: white;
}

.correct-answer-btn .checkbox-icon {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.correct-answer-btn.selected .checkbox-icon {
  opacity: 1;
}

.preview-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 10px;
}

.preview-section h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.5em;
  border-bottom: 3px solid #667eea;
  padding-bottom: 10px;
}

.canvas-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

#quizCanvas {
  border: 2px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  z-index: 10;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

.loading-text {
  color: #666;
  font-size: 16px;
  font-weight: 500;
}

.video-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  z-index: 20;
}

.video-loading-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 300px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.video-loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #2196F3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.video-loading-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
}

.progress-container {
  margin-bottom: 20px;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: #f0f0f0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4CAF50, #45a049);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

.progress-text {
  font-size: 14px;
  color: #666;
  font-weight: bold;
}

.video-loading-message {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 15px;
  text-align: left;
}

.warning-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.warning-text {
  font-size: 13px;
  color: #856404;
  line-height: 1.4;
}

#statusMessage {
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  display: none;
}

#statusMessage.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

#statusMessage.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
  h1 {
    font-size: 2em;
    margin: 20px 0;
  }
  
  .slogan {
    font-size: 1em;
    margin: -5px 0 20px 0;
    padding: 0 10px;
  }
  
  .form-section,
  .preview-section {
    padding: 20px;
  }
  
  .canvas-wrapper {
    padding: 15px;
  }
  
  #quizCanvas {
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 9/16; /* Maintain video aspect ratio */
  }
  
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .answer-input {
    flex-direction: column;
    gap: 8px;
  }
  
  .answer-input-wrapper {
    width: 100%;
  }
  
  .correct-answer-btn {
    width: 100%;
    height: 45px;
    align-self: center;
  }
  
  .process-btn {
    font-size: 16px;
    padding: 15px 20px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .container {
    border-radius: 10px;
  }
  
  h1 {
    font-size: 1.8em;
    margin: 15px 0;
  }
  
  .slogan {
    font-size: 0.9em;
    margin: -5px 0 15px 0;
    padding: 0 5px;
  }
  
  .main-content {
    padding: 15px;
    gap: 15px;
  }
  
  .form-section,
  .preview-section {
    padding: 15px;
  }
  
  .canvas-wrapper {
    padding: 10px;
  }
  
  #quizCanvas {
    max-width: 350px;
  }
  
  .form-group {
    margin-bottom: 15px;
  }
  
  .form-group label {
    font-size: 14px;
  }
  
  .answer-input {
    margin-bottom: 8px;
  }
  
  .correct-answer-btn {
    height: 40px;
    font-size: 18px;
  }
  
  .process-btn {
    font-size: 15px;
    padding: 12px 15px;
    min-height: 48px; /* Better touch target */
  }
  
  .upload-btn {
    min-height: 48px; /* Better touch target */
  }
  
  .add-answer-btn {
    min-height: 48px; /* Better touch target */
  }
  
  .video-loading-content {
    padding: 20px;
    max-width: 280px;
  }
  
  .video-loading-title {
    font-size: 16px;
  }
}
