/* Custom styles for Math Worksheets page */

/* Worksheet cards */
.worksheet-card {
  background-color: #ffffff;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  transition: all 0.3s ease;
  cursor: pointer;
}

.worksheet-card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-0.25rem);
}

.worksheet-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.worksheet-card p {
  color: #4b5563;
  margin-bottom: 1rem;
}

.worksheet-card:hover h3 {
  color: #2563eb;
}

/* Difficulty badges */
.difficulty-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.difficulty-easy {
  background-color: #dcfce7;
  color: #166534;
}

.difficulty-medium {
  background-color: #fef9c3;
  color: #854d0e;
}

.difficulty-hard {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Grade level indicators */
.grade-indicator {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.grade-4-6 {
  background-color: #dbeafe;
  color: #1e40af;
}

.grade-7-9 {
  background-color: #dcfce7;
  color: #166534;
}

.grade-10-12 {
  background-color: #c7b8ea;
  color: #7a46dd;
}

/* Worksheet preview styles */
.worksheet-preview {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 2rem;
  min-height: 500px;
}

.worksheet-header {
  text-align: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid #1f2937;
  padding-bottom: 1rem;
}

.worksheet-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.worksheet-header .details {
  color: #4b5563;
}

.worksheet-header .details > * + * {
  margin-top: 0.25rem;
}

.problem-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.problem-grid.grid-2 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .problem-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.problem-grid.grid-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .problem-grid.grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .problem-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.problem-grid.grid-4 {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .problem-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .problem-grid.grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.problem {
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
}

.problem-number {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  display: block;
}

.problem-content {
  font-size: 1.125rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  margin-bottom: 0.75rem;
}

.answer-line {
  border-bottom: 2px solid #1f2937;
  display: inline-block;
  min-width: 60px;
  margin-left: 0.5rem;
  vertical-align: middle;
  height: 1.5rem;
}

/* Math expression styling */
.math-expression {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.fraction {
  display: inline-block;
  text-align: center;
  vertical-align: middle;
  margin: 0 0.25rem;
}

.fraction .numerator {
  display: block;
  border-bottom: 1px solid #1f2937;
  padding-bottom: 0.25rem;
}

.fraction .denominator {
  display: block;
  padding-top: 0.25rem;
}

/* Animation for content switching */
#worksheets-container {
  opacity: 1;
  transition: opacity 0.3s ease-in-out;
}

#worksheets-container.fade-out {
  opacity: 0;
}

/* Animation for worksheet card appearance */
.worksheet-card {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Category cards */
.category-card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  min-width: 140px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #e5e7eb;
}

.category-card.active {
  background-color: #6D28D9;
  color: white;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-color: #2563eb;
}

.category-card:hover:not(.active) {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: #d1d5db;
}

.category-icon {
  font-size: 1.5rem;
  line-height: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}

.category-name {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.category-card.active .category-icon,
.category-card.active .category-name {
  color: white;
}

/* NEW STYLES FOR ENHANCED FEATURES */

/* Simple Control Panel */
.control-group {
  display: flex;
  flex-direction: column;
}

/* Generate Button Specific Styles */
#generateBtn {
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#generateBtn:hover:not(:disabled) {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

#generateBtn:disabled {
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

/* Generated Worksheets Section */
#generatedWorksheetsSection {
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
}

#mainWorksheetDisplay {
  max-height: 600px;
  overflow-y: auto;
}

/* Worksheet Navigation */
#worksheetsNavigation {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
}

/* Main Generation Status */
#mainGenerationStatus {
  border-left: 4px solid #3b82f6;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Custom Range Slider - Simple Design */
.range-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
  outline: none;
  transition: background 0.3s ease;
}

.range-slider:hover {
  background: #d1d5db;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  transition: background 0.3s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  background: #2563eb;
}

.range-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3b82f6;
  cursor: pointer;
  border: none;
  transition: background 0.3s ease;
}

.range-slider::-moz-range-thumb:hover {
  background: #2563eb;
}

/* Loading Spinner - Simple */
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Generation Status */
#generationStatus {
  border-left: 4px solid #3b82f6;
}

/* Navigation Buttons for Multiple Worksheets */
.worksheet-nav {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.worksheet-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Enhanced Button Styles - Simple */
button {
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

/* Focus styles for accessibility */
button:focus,
.category-card:focus,
.range-slider:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  .worksheet-preview {
    box-shadow: none;
    border: none;
  }

  body {
    background: white;
  }

  .problem-grid {
    break-inside: avoid;
  }

  .problem {
    background: white;
    border: 1px solid #000;
    break-inside: avoid;
  }

  /* Hide navigation and controls when printing */
  .worksheet-nav,
  #generationStatus {
    display: none !important;
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .problem-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  .problem {
    padding: 0.75rem;
  }

  .worksheet-preview {
    padding: 1rem;
  }

  .category-card {
    padding: 1rem;
    min-width: 120px;
  }

  /* Stack control panels on mobile */
  .control-group {
    margin-bottom: 1rem;
  }
}

/* Smooth transitions for all interactive elements */
* {
  transition: all 0.2s ease;
}

/* Custom scrollbar - Simple */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}