/* Units View Styles */
.units-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header Section */
.units-view .header {
  margin-bottom: 30px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  font-size: 14px;
  color: #666;
}

.breadcrumb a {
  color: #2563eb;
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

.breadcrumb .separator {
  margin: 0 8px;
  color: #ccc;
}

.breadcrumb .current {
  color: #333;
  font-weight: 500;
}

.subject-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.subject-header .subject-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: bold;
  flex-shrink: 0;
}

.subject-header .subject-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.subject-header .subject-icon .icon-text {
  font-size: 36px;
  font-weight: 700;
}

.subject-header .subject-info h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: #1e293b;
}

.subject-header .subject-info p {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #64748b;
  line-height: 1.5;
}

.grade-info {
  display: inline-block;
  background: #2563eb;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Content Section */
#units-content {
  min-height: 200px;
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading p {
  color: #64748b;
  font-size: 16px;
  margin: 0;
}

/* Error State */
.error {
  text-align: center;
  padding: 60px 20px;
}

.error h3 {
  color: #dc2626;
  font-size: 24px;
  margin: 0 0 12px 0;
}

.error p {
  color: #64748b;
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.retry-btn, .back-btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin: 0 8px;
  text-decoration: none;
  display: inline-block;
}

.retry-btn:hover, .back-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.back-btn {
  background: #6b7280;
}

.back-btn:hover {
  background: #4b5563;
}

/* No Units State */
.no-units {
  text-align: center;
  padding: 60px 20px;
}

.no-units h3 {
  color: #374151;
  font-size: 24px;
  margin: 0 0 12px 0;
}

.no-units p {
  color: #64748b;
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

/* Units Grid */
.units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.unit-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.unit-card:hover {
  border-color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
}

.unit-number {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.unit-content {
  flex: 1;
}

.unit-content h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.3;
}

.unit-content p {
  margin: 0 0 16px 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.unit-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 12px;
}

.unit-meta .duration {
  color: #059669;
  font-weight: 500;
}

.unit-meta .grade-level {
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.unit-arrow {
  color: #cbd5e1;
  font-size: 20px;
  font-weight: bold;
  transition: all 0.2s;
  align-self: center;
}

.unit-card:hover .unit-arrow {
  color: #2563eb;
  transform: translateX(4px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .units-view {
    padding: 16px;
  }
  
  .subject-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  
  .subject-header .subject-icon {
    width: 60px;
    height: 60px;
  }
  
  .subject-header .subject-info h1 {
    font-size: 24px;
  }
  
  .units-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .unit-card {
    padding: 20px;
  }
  
  .breadcrumb {
    font-size: 12px;
  }
}