:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #10b981;
  --text-dark: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
}

body {
  background: #f8fafc;
  color: var(--text-dark);
  font-family: 'Inter', sans-serif;
  padding-top: 20px;
}

.container-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Search Bar */
.search-container {
  margin-bottom: 2rem;
}

.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

/* Page Header */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
}

.stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Subjects Grid */
.subject-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.subject-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.subject-card:hover,
.subject-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.subject-media {
  position: relative;
  height: 140px;
  overflow: hidden;
}

.subject-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.subject-content {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.subject-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.subject-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

.btn-subject-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: white;
  text-decoration: none;
  text-align: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  margin-top: auto;
}

.btn-subject-primary:hover,
.btn-subject-primary:focus {
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

/* Topics Grid */
.topics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.topic-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.topic-card:hover,
.topic-card:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.topic-media {
  position: relative;
  height: 120px;
  overflow: hidden;
}

.topic-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topic-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  text-align: center;
  padding: 1rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
  animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
  from {
    text-shadow: 0 2px 10px rgba(0,0,0,0.8), 0 0 20px rgba(255,255,255,0.3);
  }
  to {
    text-shadow: 0 2px 15px rgba(0,0,0,0.9), 0 0 30px rgba(255,255,255,0.5);
  }
}

.topic-content {
  padding: 1.25rem;
}

.topic-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.topic-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

.btn-topic-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: white;
  text-decoration: none;
  text-align: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: block;
  width: 100%;
}

.btn-topic-primary:hover,
.btn-topic-primary:focus {
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

/* Breadcrumb */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-dark);
}

/* No Results */
.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.no-results i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Pagination */
.pagination {
  margin-top: 2rem;
}

.page-link {
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
}

.page-link:hover {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.page-item.active .page-link {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.page-item.disabled .page-link {
  color: var(--text-light);
  pointer-events: none;
}

/* Focus styles for accessibility */
a:focus,
button:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Skip to main content for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 6px;
}

@media (min-width: 768px) {
  .subject-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }
  
  .topics-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
  
  .page-header {
    padding: 2rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .subject-card,
  .topic-card,
  .btn-subject-primary,
  .btn-topic-primary {
    transition: none;
  }
}

/* Hidden class for search filtering */
.search-hidden {
  display: none !important;
}