/* BrainU Custom Styles - University/College Theme */

:root {
  --primary: #003366; /* Navy blue for academic feel */
  --primary-hover: #004080;
  --secondary: #6b8e23; /* Olive green accent */
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
}

/* Base Typography - Keep Pico defaults mostly */
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  line-height: 1.6;
  color: #212529; /* Ensure text is dark by default */
  overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

/* Ensure all containers respect viewport */
.container {
  max-width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Helvetica Neue', 'Arial', sans-serif;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ============================================
   SITE HEADER (affects all pages)
   ============================================ */
.site-header {
  background: var(--primary);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  overflow-x: auto; /* Prevent horizontal overflow */
}

.site-header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -1px;
  color: white;
}

.site-header .tagline {
  font-style: italic;
  opacity: 0.9;
  font-size: 0.9rem;
}

/* Mobile header adjustments */
@media (max-width: 768px) {
  .site-header {
    padding: 0.75rem 0;
  }

  .site-header .container {
    padding: 0 1rem;
    width: 100%;
    max-width: 100%;
  }

  .site-header nav {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    height: auto;
  }

  .site-header nav ul {
    padding: 0;
    margin: 0;
    align-items: center;
  }

  .site-header nav ul:first-child {
    flex-direction: row;
    align-items: center;
  }

  .site-header nav ul:last-child {
    flex-direction: row;
    gap: 0.75rem;
  }

  .site-header h1 {
    font-size: 1.5rem;
    margin: 0;
    line-height: 1;
  }

  /* Hide tagline on mobile */
  .site-header .tagline {
    display: none;
  }

  .site-header nav ul li {
    margin: 0;
  }

  /* Compact header links on mobile */
  .site-header nav a {
    font-size: 0.9rem;
    padding: 0.25rem 0.4rem;
    white-space: nowrap;
  }
}

/* ============================================
   HOMEPAGE CONTENT GRID
   ============================================ */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.content-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.content-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.content-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.content-card-body {
  padding: 1rem;
}

.content-card h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  color: var(--primary);
}

.content-card .description {
  color: #495057;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.content-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #6c757d;
  margin-top: 0.5rem;
}

.content-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.content-type.trivia {
  background: #e3f2fd;
  color: #1565c0;
}

.content-type.quiz {
  background: #f3e5f5;
  color: #7b1fa2;
}

.content-type.slideshow {
  background: #e8f5e9;
  color: #388e3c;
}

/* ============================================
   CONTENT PAGES (Trivia/Quiz/Slideshow)
   ============================================ */

/* Main content container wrapper */
#content-container {
  max-width: 1100px; /* Increased to properly accommodate 970px ads */
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Content container card */
.content-container {
  background: white;
  border-radius: 12px;
  padding: 1rem; /* Minimal padding to maximize ad space */
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  color: #212529; /* Ensure all text in container is dark */
}

/* Ensure all paragraphs have proper color */
.content-container p {
  color: #212529;
}

/* Start Screen Styling */
.content-start {
  text-align: center;
  padding: 2rem;
}

.content-start h1 {
  color: var(--primary);
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.content-start p {
  color: #495057;
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.content-start button {
  background: var(--primary);
  color: white;
  font-size: 1.2rem;
  padding: 1rem 2rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
}

.content-start button:hover {
  background: var(--primary-hover);
}

/* Play Screen Styling */
.content-play {
  padding: 0.5rem; /* Reduced padding to maximize available width */
  color: #212529; /* Ensure text is dark */
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #eee;
}

.content-header span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
}

.timer {
  color: #dc3545;
}

/* Question/Item Content */
.item-content {
  margin-bottom: 2rem;
}

.item-content h2 {
  font-size: 1.4rem;
  color: #212529;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.item-content img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Slide highlight and content text */
.item-content .highlight {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-left: 4px solid var(--primary);
}

.item-content .content-text {
  color: #212529;
  font-size: 1.1rem;
  line-height: 1.7;
}

/* Answer Options */
.answer-options {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.answer-option {
  padding: 1rem;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.1rem;
  color: #212529;
}

.answer-option:hover {
  background: #e9ecef;
  border-color: var(--primary);
}

.answer-option.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.answer-option.correct {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.answer-option.incorrect {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

/* Results Screen */
.content-results {
  text-align: center;
  padding: 3rem;
}

.content-results h2 {
  color: var(--primary);
  font-size: 2rem;
  margin-bottom: 1.5rem;
}

.score-display {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary);
  margin: 1rem 0;
}

.content-results p {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 2rem;
}

.content-results a {
  display: inline-block;
  margin: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s;
}

.content-results a:hover {
  background: var(--primary-hover);
}

/* ============================================
   SLIDESHOW SPECIFIC
   ============================================ */
.slideshow-container {
  max-width: 900px;
  margin: 2rem auto;
}

.slide {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.slide img {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

.slide-content {
  padding: 2rem;
}

.slide-content h1 {
  color: var(--primary);
  margin-bottom: 1rem;
}

.slide-highlight {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
}

.slide-text {
  color: #495057;
  font-size: 1.1rem;
  line-height: 1.6;
}

.slide-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid #eee;
}

.slide-counter {
  font-size: 1rem;
  color: #666;
}

/* ============================================
   BUTTONS (Global)
   ============================================ */
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: white;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: #5a6268;
  color: white;
}

/* ============================================
   CATEGORIES PAGE
   ============================================ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.category-card {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

.category-card:hover .btn-view {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.category-card h3 {
  color: var(--primary);
  margin: 0 0 1rem 0;
  font-size: 1.3rem;
}

.category-stats {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.category-stats .stat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.category-stats .stat.trivia {
  background: #e3f2fd;
  color: #1565c0;
}

.category-stats .stat.quiz {
  background: #f3e5f5;
  color: #7b1fa2;
}

.category-stats .stat.slideshow {
  background: #e8f5e9;
  color: #388e3c;
}

.category-card .total-content {
  color: #6c757d;
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
}

.category-card .btn-view {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}

/* ============================================
   LEGAL/STATIC PAGES (About, Privacy, Terms)
   ============================================ */
article h1, article h2, article h3 {
  color: var(--primary);
}

article p, article li {
  color: #212529;
  line-height: 1.7;
}

article ul {
  color: #212529;
}

article em {
  color: #495057;
  font-style: italic;
}

.about-section {
  margin-bottom: 2.5rem;
}

.about-section h2 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

/* ============================================
   SITE FOOTER
   ============================================ */
.site-footer {
  background: #f8f9fa;
  color: #6c757d;
  text-align: center;
  padding: 2rem 0;
  margin-top: 4rem;
  border-top: 1px solid #dee2e6;
}

.site-footer a {
  color: #6c757d;
  text-decoration: none;
  margin: 0 1rem;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ============================================
   ADS
   ============================================ */
.ad-container {
  text-align: center;
  margin: 20px auto;
  padding: 10px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  position: relative;
  min-height: 90px; /* Minimum height to prevent layout shift */
}

.ad-container > div[id^="ezoic-pub-ad-placeholder"] {
  margin: 0 auto;
  display: inline-block;
}

/* Hide empty ad containers */
.ad-container:empty,
.ad-container:has(> div:empty) {
  display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  #content-container {
    margin: 1rem;
    padding: 0;
  }

  .content-container {
    padding: 1rem;
    border-radius: 8px;
  }

  .content-play {
    padding: 0.5rem; /* Keep consistent padding on mobile */
  }

  .slide img {
    height: 250px;
  }

  .content-start h1 {
    font-size: 2rem;
  }

  .item-content h2 {
    font-size: 1.2rem;
  }
}