/* ================================
   Química y Educación - Main Styles
   Estilo educativo con verde, azul y blanco
   ================================ */

:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  --secondary: #1565C0;
  --secondary-dark: #0D47A1;
  --secondary-light: #42A5F5;
  --accent: #00897B;
  --background: #FFFFFF;
  --background-alt: #F5F9F5;
  --text: #212121;
  --text-light: #616161;
  --border: #E0E0E0;
  --error: #D32F2F;
  --success: #388E3C;
  --warning: #F57C00;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-md: rgba(0, 0, 0, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--background);
}

/* ================================
   Tipografía
   ================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--secondary-dark);
}

/* ================================
   Layout
   ================================ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 2rem;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 0.5rem;
  flex-wrap: wrap;
}

nav ul li a {
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.3s ease;
  font-weight: 500;
}

nav ul li a:hover,
nav ul li a.active {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-btn {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.25rem;
}

/* ================================
   Hero Section
   ================================ */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  color: white;
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.25rem;
  max-width: 700px;
  margin: 0 auto 2rem;
  opacity: 0.95;
}

.btn {
  display: inline-block;
  padding: 0.875rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  border: 2px solid white;
  color: white;
}

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

/* ================================
   Sections
   ================================ */
.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--background-alt);
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title h2 {
  position: relative;
  display: inline-block;
  padding-bottom: 1rem;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
}

/* ================================
   Cards
   ================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}

.card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-image {
  height: 180px;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-content {
  padding: 1.5rem;
}

.card-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-light);
}

.card-tag {
  background: var(--background-alt);
  color: var(--primary);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ================================
   Test Cards
   ================================ */
.test-card {
  text-align: center;
}

.test-card .card-image {
  height: 140px;
}

.test-card .difficulty {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.difficulty-easy {
  background: #E8F5E9;
  color: var(--success);
}

.difficulty-medium {
  background: #FFF3E0;
  color: var(--warning);
}

.difficulty-hard {
  background: #FFEBEE;
  color: var(--error);
}

.test-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 1rem 0;
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ================================
   Quiz Styles
   ================================ */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border);
}

.quiz-progress {
  flex: 1;
  margin-right: 2rem;
}

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 5px;
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--secondary);
}

.quiz-score {
  background: var(--background-alt);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.question-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.question-number {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 2rem;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--secondary);
  background: var(--background-alt);
}

.option-btn.selected {
  border-color: var(--secondary);
  background: #E3F2FD;
}

.option-btn.correct {
  border-color: var(--success);
  background: #E8F5E9;
}

.option-btn.incorrect {
  border-color: var(--error);
  background: #FFEBEE;
}

.option-btn:disabled {
  cursor: default;
}

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.option-btn.correct .option-letter {
  background: var(--success);
  color: white;
}

.option-btn.incorrect .option-letter {
  background: var(--error);
  color: white;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
}

.explanation {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--background-alt);
  border-radius: 12px;
  border-left: 4px solid var(--primary);
}

.explanation h4 {
  color: var(--primary);
  margin-bottom: 0.75rem;
}

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

.results-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
}

.results-score {
  font-size: 4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.results-score.excellent {
  color: var(--success);
}

.results-score.good {
  color: var(--secondary);
}

.results-score.needs-work {
  color: var(--warning);
}

.results-message {
  font-size: 1.25rem;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.results-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  color: var(--text-light);
  font-size: 0.875rem;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ================================
   Article Styles
   ================================ */
.article-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  color: var(--text-light);
  font-size: 0.875rem;
}

.article-featured-image {
  width: 100%;
  height: 400px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.article-content h2 {
  margin-top: 2rem;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
}

.article-content h3 {
  margin-top: 1.5rem;
  color: var(--secondary-dark);
}

.article-content p {
  margin-bottom: 1.25rem;
  text-align: justify;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-image {
  width: 100%;
  border-radius: 12px;
  margin: 1.5rem 0;
}

.article-highlight {
  background: var(--background-alt);
  border-left: 4px solid var(--secondary);
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 12px 12px 0;
}

.chemequation {
  background: #f5f5f5;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
  margin: 1.5rem 0;
  font-size: 1.1rem;
}

.related-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.related-articles h3 {
  margin-bottom: 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.related-card {
  padding: 1rem;
  background: var(--background-alt);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.related-card:hover {
  background: #E8F5E9;
}

/* ================================
   Forms
   ================================ */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--secondary);
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

/* ================================
   Footer
   ================================ */
footer {
  background: var(--text);
  color: white;
  padding: 3rem 0 1.5rem;
}

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

.footer-col h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  color: rgba(255, 255, 255, 0.7);
  transition: color 0.3s ease;
}

.footer-col a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.3s ease;
}

.social-links a:hover {
  background: var(--primary);
}

/* ================================
   Navigation Pages
   ================================ */
.page-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  padding: 3rem 0;
  text-align: center;
}

.page-header h1 {
  color: white;
  margin-bottom: 0.5rem;
}

.page-header p {
  opacity: 0.9;
}

.breadcrumb {
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--secondary);
}

.filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--background-alt);
  border-radius: 12px;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border);
  border-radius: 20px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.875rem;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

/* ================================
   404 Page
   ================================ */
.error-page {
  text-align: center;
  padding: 6rem 0;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--primary-light);
  line-height: 1;
}

.error-page h1 {
  margin-bottom: 1rem;
}

.error-page p {
  color: var(--text-light);
  margin-bottom: 2rem;
}

/* ================================
   Legal Pages
   ================================ */
.legal-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.legal-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.legal-content p {
  margin-bottom: 1rem;
  text-align: justify;
}

.legal-content ul {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.legal-content li {
  margin-bottom: 0.5rem;
}

.last-updated {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  nav ul {
    justify-content: center;
  }

  .mobile-menu-btn {
    display: block;
    margin: 0.5rem auto;
  }

  .hero {
    padding: 2rem 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .section {
    padding: 2rem 0;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .quiz-container {
    padding: 1rem;
  }

  .quiz-header {
    flex-direction: column;
    gap: 1rem;
  }

  .quiz-progress {
    margin-right: 0;
    width: 100%;
  }

  .question-card {
    padding: 1.5rem;
  }

  .question-text {
    font-size: 1.1rem;
  }

  .results-stats {
    flex-direction: column;
    gap: 1.5rem;
  }

  .article-featured-image {
    height: 250px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .btn {
    width: 100%;
  }

  .quiz-actions {
    flex-direction: column;
  }

  .quiz-actions .btn {
    width: 100%;
  }
}

/* ================================
   Utility Classes
   ================================ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.hidden { display: none !important; }
