/* ===== AI QUIZ GENERATOR PREMIUM CSS ===== */
:root {
  --aiq-primary: 220, 90%, 56%;
  --aiq-secondary: 269, 100%, 66%;
  --aiq-success: 142, 76%, 36%;
  --aiq-warning: 38, 92%, 50%;
  --aiq-error: 0, 84%, 60%;
  --aiq-gradient: linear-gradient(135deg, hsl(var(--aiq-primary)), hsl(var(--aiq-secondary)));
  --aiq-gradient-light: linear-gradient(135deg, hsl(var(--aiq-primary) / 0.1), hsl(var(--aiq-secondary) / 0.1));
  --aiq-border-radius: 16px;
  --aiq-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  --aiq-shadow-hover: 0 30px 60px rgba(0, 0, 0, 0.15);
  --aiq-text-dark: 222, 47%, 11%;
  --aiq-text-light: 215, 16%, 47%;
}

/* Base Styles */
.ai-interactive-quiz-wrapper {
  max-width: 1400px;
  margin: 30px auto;
  padding: 20px;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

/* ===== HEADER STYLES ===== */
.ai-quiz-header {
  background: linear-gradient(135deg, #4F6BED 0%, #8B5CF6 50%, #EC4899 100%);
  color: white;
  padding: 20px 30px;
  border-radius: 12px;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(79, 107, 237, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* Remove overflow: hidden to allow content to display properly */
}

.ai-quiz-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.4) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.3) 0%, transparent 40%);
  z-index: 1;
  pointer-events: none;
}

.ai-quiz-header h1 {
  margin: 0 0 8px 0;
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 2;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.1;
}

.ai-quiz-header h1::before {
  content: '🧠';
  font-size: 1em;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.2));
}

.ai-quiz-header p {
  margin: 0;
  opacity: 0.9;
  font-size: 1em;
  font-weight: 500;
  position: relative;
  z-index: 2;
  max-width: 600px;
  line-height: 1.4;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ai-quiz-header p::before {
  content: '⚡';
  font-size: 0.9em;
}

/* Header badge for premium feature */
.ai-quiz-header::after {
  content: 'PREMIUM';
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.7em;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Ensure our header has proper stacking context */
.ai-interactive-quiz-wrapper {
  position: relative;
  z-index: 1;
}

/* ===== RESPONSIVE HEADER STYLES ===== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
  .ai-quiz-header {
    padding: 18px 25px;
    margin-bottom: 20px;
    min-height: 110px;
    border-radius: 10px;
  }
  
  .ai-quiz-header h1 {
    font-size: 1.7em;
    gap: 8px;
    margin-bottom: 6px;
  }
  
  .ai-quiz-header p {
    font-size: 0.95em;
    max-width: 500px;
  }
  
  .ai-quiz-header::after {
    top: 10px;
    right: 10px;
    font-size: 0.65em;
    padding: 3px 6px;
  }
}

/* Mobile Styles (481px - 767px) */
@media (max-width: 767px) {
  .ai-quiz-header {
    padding: 15px 20px;
    margin-bottom: 18px;
    min-height: 100px;
    border-radius: 8px;
  }
  
  .ai-quiz-header h1 {
    font-size: 1.4em;
    gap: 6px;
    margin-bottom: 5px;
  }
  
  .ai-quiz-header h1::before {
    font-size: 0.9em;
  }
  
  .ai-quiz-header p {
    font-size: 0.9em;
    gap: 4px;
    line-height: 1.3;
  }
  
  .ai-quiz-header p::before {
    font-size: 0.8em;
  }
  
  .ai-quiz-header::after {
    top: 8px;
    right: 8px;
    font-size: 0.6em;
    padding: 2px 5px;
  }
}

/* Small Mobile Styles (320px - 480px) */
@media (max-width: 480px) {
  .ai-quiz-header {
    padding: 12px 15px;
    margin-bottom: 15px;
    min-height: 90px;
    border-radius: 6px;
  }
  
  .ai-quiz-header h1 {
    font-size: 1.2em;
    flex-direction: row;
    gap: 4px;
    margin-bottom: 4px;
  }
  
  .ai-quiz-header h1::before {
    font-size: 0.8em;
    margin-bottom: 0;
  }
  
  .ai-quiz-header p {
    font-size: 0.8em;
    flex-direction: row;
    gap: 3px;
    line-height: 1.2;
  }
  
  .ai-quiz-header p::before {
    font-size: 0.7em;
    margin-bottom: 0;
  }
  
  .ai-quiz-header::after {
    top: 6px;
    right: 6px;
    font-size: 0.55em;
    padding: 2px 4px;
  }
}

/* Large Desktop Styles (1400px+) */
@media (min-width: 1400px) {
  .ai-quiz-header {
    padding: 22px 35px;
    margin-bottom: 25px;
    min-height: 130px;
  }
  
  .ai-quiz-header h1 {
    font-size: 2.2em;
  }
  
  .ai-quiz-header p {
    font-size: 1.1em;
  }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  .ai-quiz-header {
    border: 2px solid rgba(255, 255, 255, 0.4);
  }
  
  .ai-quiz-header::after {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.6);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .ai-quiz-header::before {
    animation: none;
  }
}

/* ===== MAIN FORM STYLES ===== */
.quiz-generator-form {
  background: white;
  padding: 40px;
  border-radius: var(--aiq-border-radius);
  box-shadow: var(--aiq-shadow);
  margin-bottom: 40px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

.quiz-generator-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--aiq-gradient);
  border-radius: var(--aiq-border-radius) var(--aiq-border-radius) 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.form-group {
  margin-bottom: 25px;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 12px;
  font-weight: 700;
  color: hsl(var(--aiq-text-dark));
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-group label::before {
  content: '✦';
  color: hsl(var(--aiq-primary));
  font-weight: 900;
}

.form-control {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: #fafbfc;
  font-weight: 500;
}

.form-control:focus {
  outline: none;
  border-color: hsl(var(--aiq-primary));
  background: white;
  box-shadow: 0 0 0 4px hsl(var(--aiq-primary) / 0.1);
  transform: translateY(-2px);
}

.textarea-control {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

/* ===== CONTENT MODE TOGGLE STYLES ===== */
.mode-toggle-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.aiq-simple-toggle {
  margin: 0 !important;
  padding: 25px !important;
  background: linear-gradient(135deg, hsl(var(--aiq-primary) / 0.08), hsl(var(--aiq-secondary) / 0.08)) !important;
  border-radius: var(--aiq-border-radius) !important;
  border-left: 4px solid hsl(var(--aiq-primary)) !important;
  transition: all 0.3s ease !important;
  position: relative !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.aiq-simple-toggle:hover {
  background: linear-gradient(135deg, hsl(var(--aiq-primary) / 0.12), hsl(var(--aiq-secondary) / 0.12)) !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.aiq-toggle-label {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  cursor: pointer !important;
  font-weight: 700 !important;
  color: hsl(var(--aiq-text-dark)) !important;
  font-size: 1.1em !important;
  margin-bottom: 10px !important;
}

.aiq-toggle-text {
  flex: 1;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.aiq-toggle-slider {
  position: relative !important;
  width: 60px !important;
  height: 30px !important;
  background: #e2e8f0 !important;
  border-radius: 34px !important;
  transition: all 0.3s ease !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1) !important;
  flex-shrink: 0 !important;
}

.aiq-toggle-slider:before {
  content: "" !important;
  position: absolute !important;
  height: 24px !important;
  width: 24px !important;
  left: 3px !important;
  bottom: 3px !important;
  background: white !important;
  border-radius: 50% !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

#current_affairs_mode:checked + .aiq-toggle-slider {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

#youtube_content_mode:checked + .aiq-toggle-slider {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

#current_affairs_mode:checked + .aiq-toggle-slider:before,
#youtube_content_mode:checked + .aiq-toggle-slider:before {
  transform: translateX(30px) !important;
}

.aiq-toggle-notice {
  margin: 10px 0 0 0 !important;
  color: hsl(var(--aiq-text-light)) !important;
  font-size: 0.9em !important;
  line-height: 1.5 !important;
  font-style: italic !important;
  padding-left: 75px !important;
}

.aiq-simple-toggle.active {
  border-left-color: #ee5a24 !important;
  background: linear-gradient(135deg, hsl(14, 86%, 52% / 0.1), hsl(14, 86%, 42% / 0.05)) !important;
}

#current_affairs_mode,
#youtube_content_mode {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

/* ===== ENHANCED CONTENT AREA ===== */
.enhanced-content-area {
  margin-bottom: 30px;
}

.enhanced-content-area label {
  font-size: 1.2em !important;
  margin-bottom: 15px !important;
  display: flex;
  align-items: center;
  gap: 10px;
  color: hsl(var(--aiq-text-dark));
}

.enhanced-content-area label::before {
  content: '📝';
  font-size: 1.1em;
}

.textarea-container {
  position: relative;
  border-radius: var(--aiq-border-radius);
  overflow: hidden;
  box-shadow: var(--aiq-shadow);
  transition: all 0.3s ease;
}

.textarea-container:focus-within {
  box-shadow: var(--aiq-shadow-hover);
  transform: translateY(-2px);
}

.enhanced-textarea {
  min-height: 200px !important;
  height: auto; /* ← CHANGED FROM 200px to auto */
  resize: vertical;
  line-height: 1.6;
  font-size: 16px;
  padding: 20px;
  border: 2px solid #e2e8f0;
  border-radius: var(--aiq-border-radius);
  background: #fafbfc;
  transition: all 0.3s ease;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--aiq-primary)) #f1f5f9;
}

.enhanced-textarea::-webkit-scrollbar {
  width: 8px;
}

.enhanced-textarea::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.enhanced-textarea::-webkit-scrollbar-thumb {
  background: hsl(var(--aiq-primary));
  border-radius: 4px;
}

.enhanced-textarea:focus {
  outline: none;
  border-color: hsl(var(--aiq-primary));
  background: white;
  box-shadow: 0 0 0 4px hsl(var(--aiq-primary) / 0.1);
}

/* ===== UPLOAD SECTION STYLES ===== */
.aiq-upload-section {
  background: var(--aiq-gradient-light);
  border: 3px dashed hsl(var(--aiq-primary) / 0.3);
  border-radius: var(--aiq-border-radius);
  padding: 40px 30px;
  margin: 25px 0;
  text-align: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.aiq-upload-section:hover {
  border-color: hsl(var(--aiq-primary));
  background: linear-gradient(135deg, hsl(var(--aiq-primary) / 0.15), hsl(var(--aiq-secondary) / 0.15));
  transform: translateY(-2px);
}

.aiq-upload-area {
  border: 3px dashed #667eea;
  border-radius: 15px;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.aiq-upload-area.dragover {
  border-color: #48bb78;
  background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
}
.upload-icon {
  font-size: 4em;
  margin-bottom: 20px;
  display: block;
  background: var(--aiq-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Add these responsive styles for the upload icon */
@media (max-width: 480px) {
  .upload-icon {
    font-size: 2em;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .upload-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
  }
}

.upload-title {
  font-size: 1.3em;
}

.upload-subtitle {
  color: hsl(var(--aiq-text-light));
  font-size: 1em;
  margin-bottom: 20px;
}

.aiq-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: var(--aiq-gradient);
  color: white;
  padding: 16px 32px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1em;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  border: none;
}

.aiq-upload-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.aiq-upload-btn input[type="file"] {
  display: none;
}

/* ===== FILE COUNTER STYLES ===== */
.file-counter {
  background: white;
  border-radius: var(--aiq-border-radius);
  padding: 25px;
  margin-top: 20px;
  box-shadow: var(--aiq-shadow);
  border-left: 6px solid hsl(var(--aiq-primary));
  position: relative;
  overflow: hidden;
}

.file-counter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--aiq-gradient);
}

.file-counter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
}

.file-count {
  font-size: 1.4em;
  font-weight: 800;
  color: hsl(var(--aiq-text-dark));
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-count::before {
  content: '📁';
  font-size: 1.2em;
}

.file-size {
  color: hsl(var(--aiq-text-light));
  font-weight: 700;
  font-size: 1.1em;
  background: var(--aiq-gradient-light);
  padding: 8px 16px;
  border-radius: 10px;
}

.file-list {
  max-height: 250px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--aiq-primary)) #f1f5f9;
}

.file-list::-webkit-scrollbar {
  width: 6px;
}

.file-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 10px;
}

.file-list::-webkit-scrollbar-thumb {
  background: var(--aiq-gradient);
  border-radius: 10px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  margin: 8px 0;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.file-item:hover {
  background: white;
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.file-name {
  flex: 1;
  font-weight: 600;
  color: hsl(var(--aiq-text-dark));
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-name::before {
  content: '📄';
  font-size: 1.1em;
}

.file-size-small {
  color: hsl(var(--aiq-text-light));
  font-weight: 600;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.9em;
}

.file-remove {
  background: none;
  border: none;
  color: hsl(var(--aiq-error));
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
  font-size: 1.2em;
}

.file-remove:hover {
  background: hsl(var(--aiq-error) / 0.1);
  transform: scale(1.2);
}

/* ===== OCR METHOD SECTION ===== */
.aiq-ocr-method-section {
  margin: 30px 0;
  padding: 30px;
  background: var(--aiq-gradient-light);
  border-radius: var(--aiq-border-radius);
  border-left: 6px solid hsl(var(--aiq-primary));
  position: relative;
  overflow: hidden;
}

.aiq-ocr-method-section::before {
  content: '🤖 AI OCR';
  position: absolute;
  top: 15px;
  right: 20px;
  background: var(--aiq-gradient);
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.aiq-form-group {
  position: relative;
}

.aiq-form-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: hsl(var(--aiq-text-dark));
  margin-bottom: 10px;
}

.aiq-input {
  width: 100%;
  padding: 15px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: #fafbfc;
  font-weight: 500;
}

.aiq-input:focus {
  outline: none;
  border-color: hsl(var(--aiq-primary));
  background: white;
  box-shadow: 0 0 0 4px hsl(var(--aiq-primary) / 0.1);
}

.aiq-type-description {
  color: hsl(var(--aiq-text-light));
  font-size: 0.875rem;
  font-style: italic;
  margin-top: 8px;
}

/* ===== OCR CONTROLS ===== */
.ocr-controls {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

/* ===== BUTTON STYLES ===== */
.btn {
  padding: 16px 32px;
  border: none;
  border-radius: 12px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-width: 140px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--aiq-gradient);
  color: white;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, hsl(var(--aiq-success)), #2dce89);
  color: white;
  box-shadow: 0 10px 30px rgba(72, 187, 120, 0.3);
}

.btn-success:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(72, 187, 120, 0.4);
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  box-shadow: 0 10px 30px rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(245, 158, 11, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, hsl(var(--aiq-error)), #dc2626);
  color: white;
  box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(239, 68, 68, 0.4);
}

.btn-info {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.btn-info:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
  box-shadow: 0 10px 30px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(107, 114, 128, 0.4);
}

.btn:active {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Clear Text Button */
.btn-clear {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: white;
  box-shadow: 0 10px 30px rgba(249, 115, 22, 0.3);
}

/* Append Mode Button */
.btn-append {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.3);
}

/* Button Groups */
.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
}

.btn-group .btn {
  flex: 1;
  min-width: 120px;
}

/* ===== ENHANCED LOADING INDICATOR ===== */
.loading {
  text-align: center;
  padding: 60px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.loading-message {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: hsl(var(--aiq-primary));
  margin-top: 25px;
  font-weight: 500;
  letter-spacing: 0.5px;
  opacity: 0.9;
}

.loading-dots {
  display: inline-flex;
  gap: 6px;
  margin-top: 15px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: hsl(var(--aiq-primary));
  opacity: 0.4;
  animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Main spinner with gradient effect */
.spinner {
  border: 5px solid rgba(243, 243, 243, 0.3);
  border-top: 5px solid hsl(var(--aiq-primary));
  border-radius: 50%;
  width: 70px;
  height: 70px;
  animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  margin: 0 auto 25px;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.spinner::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border: 8px solid transparent;
  border-top: 8px solid hsla(var(--aiq-primary), 0.4);
  border-radius: 50%;
  animation: spin 2s linear infinite;
  filter: blur(1px);
}

.spinner::after {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  right: -12px;
  bottom: -12px;
  border: 12px solid transparent;
  border-top: 12px solid hsla(var(--aiq-secondary), 0.2);
  border-radius: 50%;
  animation: spin 3s linear infinite reverse;
}

/* Optional progress ring */
.progress-ring {
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid transparent;
  border-top: 2px solid hsla(var(--aiq-secondary), 0.8);
  border-radius: 50%;
  animation: spin 0.8s ease-in-out infinite;
}

/* Optional pulse effect for the entire container */
@keyframes pulse {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

@keyframes spin {
  0% { 
    transform: rotate(0deg); 
  }
  100% { 
    transform: rotate(360deg); 
  }
}

/* Fade in animation for the loading container */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading {
  animation: fadeIn 0.5s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .loading {
    padding: 40px 20px;
    min-height: 250px;
  }
  
  .spinner {
    width: 60px;
    height: 60px;
  }
  
  .loading-message {
    font-size: 15px;
  }
}

/* ===== ALERT STYLES ===== */
.alert {
  padding: 20px 25px;
  border-radius: 12px;
  margin-bottom: 25px;
  font-weight: 600;
  border-left: 6px solid;
  position: relative;
}

.alert-success {
  background: linear-gradient(135deg, hsl(var(--aiq-success) / 0.1), hsl(142, 76%, 36% / 0.05));
  border-color: hsl(var(--aiq-success));
  color: hsl(142, 64%, 24%);
}

.alert-error {
  background: linear-gradient(135deg, hsl(var(--aiq-error) / 0.1), hsl(0, 84%, 60% / 0.05));
  border-color: hsl(var(--aiq-error));
  color: hsl(0, 74%, 42%);
}

.alert-info {
  background: linear-gradient(135deg, hsl(210, 100%, 97%), hsl(210, 100%, 94%));
  border-color: hsl(210, 100%, 70%);
  color: hsl(210, 100%, 25%);
}

.hidden {
  display: none !important;
}

/* ===== QUIZ PREVIEW STYLES ===== */
.quiz-preview {
  background: white;
  padding: 40px;
  border-radius: var(--aiq-border-radius);
  box-shadow: var(--aiq-shadow);
  margin-top: 40px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
}

.quiz-preview::before {
  content: '👁️ Preview';
  position: absolute;
  top: -15px;
  left: 30px;
  background: var(--aiq-gradient);
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-preview h3 {
  margin-bottom: 30px;
  color: hsl(var(--aiq-text-dark));
  font-size: 1.8em;
  font-weight: 800;
  text-align: center;
  background: var(--aiq-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.quiz-question {
  margin-bottom: 30px;
  padding: 25px;
  background: #f8fafc;
  border-radius: 16px;
  border-left: 6px solid hsl(var(--aiq-primary));
  transition: all 0.3s ease;
  position: relative;
}

.quiz-question:hover {
  background: white;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.quiz-question h4 {
  margin: 0 0 20px 0;
  color: hsl(var(--aiq-text-dark));
  font-size: 1.3em;
  font-weight: 700;
  line-height: 1.5;
}

.quiz-options {
  display: grid;
  gap: 12px;
}

.quiz-option {
  padding: 18px 20px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 8px;
  transition: all 0.3s ease;
  font-weight: 500;
  cursor: pointer;
}

.quiz-option:hover {
  border-color: hsl(var(--aiq-primary) / 0.5);
  transform: translateX(5px);
}

.quiz-option.correct {
  background: linear-gradient(135deg, hsl(var(--aiq-success) / 0.1), hsl(142, 76%, 36% / 0.05));
  border-color: hsl(var(--aiq-success));
  color: hsl(142, 64%, 24%);
  font-weight: 700;
}

/* ===== PROCESSING STATUS STYLES ===== */
.ocr-processing {
  background: linear-gradient(135deg, hsl(210, 100%, 97%), hsl(210, 100%, 94%));
  border: 2px solid hsl(210, 100%, 70%);
  color: hsl(210, 100%, 25%);
  padding: 25px;
  border-radius: var(--aiq-border-radius);
  text-align: center;
  margin-top: 20px;
  position: relative;
}

.processing-file {
  font-weight: 800;
  margin: 15px 0;
  font-size: 1.2em;
  color: hsl(210, 100%, 25%);
}

.progress-container {
  margin: 20px 0;
}

.progress-bar {
  height: 12px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: var(--aiq-gradient);
  border-radius: 10px;
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.ocr-success {
  background: linear-gradient(135deg, hsl(var(--aiq-success) / 0.1), hsl(142, 76%, 36% / 0.05));
  border: 2px solid hsl(var(--aiq-success));
  color: hsl(142, 64%, 24%);
  padding: 25px;
  border-radius: var(--aiq-border-radius);
  text-align: center;
  margin-top: 20px;
}

.ocr-error {
  background: linear-gradient(135deg, hsl(var(--aiq-error) / 0.1), hsl(0, 84%, 60% / 0.05));
  border: 2px solid hsl(var(--aiq-error));
  color: hsl(0, 74%, 42%);
  padding: 25px;
  border-radius: var(--aiq-border-radius);
  text-align: center;
  margin-top: 20px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
  .ai-interactive-quiz-wrapper {
    padding: 20px;
    margin: 20px auto;
  }
  
  .ai-quiz-header {
    padding: 30px 25px;
  }
  
  .ai-quiz-header h1 {
    font-size: 2.4em;
  }
  
  .quiz-generator-form {
    padding: 35px 25px;
  }
  
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
  }
  
  .mode-toggle-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Styles (481px - 767px) */
@media (max-width: 480px) {
.enhanced-textarea {
  min-height: 150px !important;
  height: auto; /* ← CHANGE from 150px to auto */
}
  
  .ai-quiz-header {
    padding: 25px 20px;
    margin-bottom: 25px;
  }
  
  .ai-quiz-header h1 {
    font-size: 2em;
    gap: 10px;
  }
  
  .ai-quiz-header p {
    font-size: 1.1em;
    gap: 8px;
  }
  
  .header-features {
    gap: 10px;
  }
  
  .feature-badge {
    padding: 6px 12px;
    font-size: 0.85em;
  }
  
  .quiz-generator-form {
    padding: 25px 20px;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-control {
    padding: 14px 16px;
  }
  
  .enhanced-textarea {
    min-height: 180px !important;
    height: 180px;
    padding: 15px;
  }
  
  .aiq-simple-toggle {
    padding: 20px !important;
  }
  
  .aiq-toggle-label {
    font-size: 1em !important;
  }
  
  .aiq-toggle-notice {
    padding-left: 0 !important;
    margin-top: 10px !important;
  }
  
  .aiq-upload-section {
    padding: 30px 20px;
  }
  
  .ocr-controls {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}
/* Additional Mobile Optimizations */
@media (max-width: 767px) {
    .aiq-upload-section {
        margin: 15px 0;
    }
    
    .ocr-controls .btn {
        font-size: 0.9em;
        padding: 12px 16px;
    }
    
    .file-item {
        padding: 12px 15px;
    }
    
    .quiz-question {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header-features .feature-badge {
        font-size: 0.8em;
        padding: 5px 10px;
    }
    
    .mode-toggle-grid {
        gap: 15px;
    }
}

/* Small Mobile Styles (320px - 480px) */
@media (max-width: 480px) {
  .ai-interactive-quiz-wrapper {
    padding: 10px;
    margin: 10px auto;
  }
  
  .ai-quiz-header {
    padding: 20px 15px;
  }
  
  .ai-quiz-header h1 {
    font-size: 1.7em;
    flex-direction: column;
  }
  
  .ai-quiz-header p {
    font-size: 1em;
    flex-direction: column;
  }
  
  .header-features {
    flex-direction: column;
    align-items: center;
  }
  
  .quiz-generator-form {
    padding: 20px 15px;
  }
  
  .enhanced-textarea {
    min-height: 150px !important;
    height: 150px;
  }
  
  .file-counter-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Large Desktop Styles (1400px+) */
@media (min-width: 1400px) {
  .ai-interactive-quiz-wrapper {
    max-width: 1400px;
  }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  .form-control {
    border-width: 2px;
  }
  
  .btn {
    border: 1px solid currentColor;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== HELP BUTTON STYLES ===== */
.btn-help {
  background: var(--aiq-gradient);
  color: white;
  padding: 16px 32px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1em;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-width: 200px;
  justify-content: center;
  margin: 20px 0;
}

.btn-help::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: 0.5s;
}

.btn-help:hover::before {
  left: 100%;
}

.btn-help:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
  color: white;
  text-decoration: none;
}

.btn-help:active {
  transform: translateY(-1px);
}

/* ===== RESPONSIVE DESIGN FOR HELP BUTTON ===== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
  .btn-help {
    padding: 14px 28px;
    font-size: 1.05em;
    min-width: 180px;
    margin: 18px 0;
  }
}

/* Mobile Styles (481px - 767px) */
@media (max-width: 767px) {
  .btn-help {
    padding: 14px 24px;
    font-size: 1em;
    min-width: 160px;
    margin: 16px 0;
    width: 100%;
    max-width: 280px;
  }
}

/* Small Mobile Styles (320px - 480px) */
@media (max-width: 480px) {
  .btn-help {
    padding: 12px 20px;
    font-size: 0.95em;
    min-width: 140px;
    margin: 15px 0;
  }
}

/* Large Desktop Styles (1400px+) */
@media (min-width: 1400px) {
  .btn-help {
    padding: 18px 36px;
    font-size: 1.15em;
    min-width: 220px;
    margin: 25px 0;
  }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
  .btn-help {
    border: 2px solid currentColor;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .btn-help::before {
    display: none;
  }
  
  .btn-help:hover {
    transform: none;
  }
  
  .btn-help:active {
    transform: none;
  }
}

/* YouTube Preview Styles */
.youtube-preview {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
}

.youtube-preview h4 {
    margin-top: 0;
    color: #ff0000;
    font-size: 1.2em;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    margin: 15px 0;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

.video-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
}

.video-metadata h5 {
    margin: 0 0 10px 0;
    color: #2d3748;
    font-size: 1.1em;
}

.video-metadata p {
    margin: 5px 0;
    font-size: 0.9em;
}

.processing-indicator {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* YouTube Help Styles */
#youtubeHelp .alert ul {
    margin: 10px 0;
    padding-left: 20px;
}

#youtubeHelp .alert li {
    margin: 5px 0;
}

#youtubeHelp .alert h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* API Status Styles */
.youtube-api-status {
    margin: 15px 0;
}

.youtube-api-status .alert {
    border-left: 4px solid;
}

.youtube-api-status .alert-success {
    border-left-color: #48bb78;
}

.youtube-api-status .alert-info {
    border-left-color: #4299e1;
}

.youtube-api-status .alert-warning {
    border-left-color: #ed8936;
}

/* ===== CUSTOM FILENAME STYLES ===== */
.custom-filename-section {
    background: linear-gradient(135deg, hsl(var(--aiq-primary) / 0.08), hsl(var(--aiq-secondary) / 0.08));
    border: 2px solid hsl(var(--aiq-primary) / 0.2);
    border-radius: var(--aiq-border-radius);
    padding: 25px;
    margin: 20px 0;
    position: relative;
}

.custom-filename-section label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2em;
    font-weight: 700;
    color: hsl(var(--aiq-text-dark));
    margin-bottom: 15px;
}

.custom-filename-section label .dashicons {
    color: hsl(var(--aiq-primary));
    font-size: 1.3em;
    width: auto;
    height: auto;
}

.filename-input-container {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filename-input-container:focus-within {
    border-color: hsl(var(--aiq-primary));
    box-shadow: 0 0 0 4px hsl(var(--aiq-primary) / 0.1);
    transform: translateY(-2px);
}

.filename-input {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    background: transparent;
    outline: none;
}

.filename-preview {
    background: hsl(var(--aiq-primary) / 0.1);
    color: hsl(var(--aiq-primary));
    padding: 16px 20px;
    font-weight: 600;
    border-left: 2px solid #e2e8f0;
    white-space: nowrap;
}

.custom-filename-section .description {
    color: hsl(var(--aiq-text-light));
    font-size: 0.9em;
    margin: 10px 0 5px 0;
    font-style: italic;
}

.filename-examples {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid hsl(var(--aiq-success));
    margin-top: 10px;
}

.filename-examples small {
    color: hsl(var(--aiq-text-light));
    font-size: 0.85em;
}

/* Filename validation states */
.filename-input.valid {
    border-color: hsl(var(--aiq-success));
}

.filename-input.invalid {
    border-color: hsl(var(--aiq-error));
}

.filename-validation {
    margin-top: 8px;
    font-size: 0.85em;
    font-weight: 600;
}

.filename-validation.valid {
    color: hsl(var(--aiq-success));
}

.filename-validation.invalid {
    color: hsl(var(--aiq-error));
}

/* ===== RESPONSIVE DESIGN FOR FILENAME SECTION ===== */

/* Tablet Styles (768px - 1024px) */
@media (max-width: 1024px) {
    .custom-filename-section {
        padding: 20px;
    }
    
    .filename-input-container {
        flex-direction: column;
        border-radius: 12px;
    }
    
    .filename-input {
        width: 100%;
        border-bottom: 2px solid #e2e8f0;
        border-radius: 12px 12px 0 0;
    }
    
    .filename-preview {
        width: 100%;
        text-align: center;
        border-left: none;
        border-top: 2px solid #e2e8f0;
        border-radius: 0 0 12px 12px;
    }
}

/* Mobile Styles (481px - 767px) */
@media (max-width: 767px) {
    .custom-filename-section {
        padding: 20px 15px;
        margin: 15px 0;
    }
    
    .custom-filename-section label {
        font-size: 1.1em;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .filename-input {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .filename-preview {
        padding: 14px 16px;
        font-size: 14px;
    }
    
    .filename-examples {
        padding: 10px 12px;
    }
}

/* Small Mobile Styles (320px - 480px) */
@media (max-width: 480px) {
    .custom-filename-section {
        padding: 15px 12px;
    }
    
    .custom-filename-section label {
        font-size: 1em;
    }
    
    .filename-input {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .filename-preview {
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .filename-examples small {
        font-size: 0.8em;
    }
}

/* Large Desktop Styles (1400px+) */
@media (min-width: 1400px) {
    .custom-filename-section {
        padding: 30px;
    }
    
    .filename-input {
        padding: 18px 22px;
        font-size: 17px;
    }
    
    .filename-preview {
        padding: 18px 22px;
        font-size: 17px;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .filename-input-container {
        border-width: 2px;
    }
    
    .filename-preview {
        border-left-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .filename-input-container {
        transition: none;
    }
    
    .filename-input-container:focus-within {
        transform: none;
    }
}
/* ===== MOBILE UPLOAD FIX ===== */
@media (max-width: 767px) {
  .aiq-upload-area .upload-icon {
    font-size: 2.5em !important;
    margin-bottom: 15px !important;
  }
  
  .aiq-upload-area .upload-title {
    font-size: 1.4em !important;
    margin-bottom: 10px !important;
  }
  
  .aiq-upload-area .upload-subtitle {
    font-size: 0.95em !important;
    margin-bottom: 20px !important;
  }
  
  .aiq-upload-btn {
    padding: 14px 24px !important;
    font-size: 1em !important;
  }
}

@media (max-width: 480px) {
  .aiq-upload-area .upload-icon {
    font-size: 2em !important;
    margin-bottom: 12px !important;
  }
  
  .aiq-upload-area .upload-title {
    font-size: 1.2em !important;
  }
}
