/* ============================================================
   cursos.css - Estilos unificados (sidebar + grid)
   ============================================================ */

:root {
  --banner: #1D4567;
  --btn: #3984C6;
  --ice: #F6F8FA;
  --text: #222831;
  --muted: #6b7280;
  --card-bg: #f3f6f9;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

body {
  background: var(--ice);
  font-family: 'Poppins', sans-serif;
  margin: 0;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Título */
.section-title {
  text-align: center;
  font-size: 2.3rem;
  color: var(--banner);
  margin: 20px 0 10px;
  position: relative;
  padding-bottom: 15px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: var(--btn);
  border-radius: 2px;
}

/* Intro */
.intro {
  text-align: center;
  color: var(--muted);
  max-width: 900px;
  margin: 0 auto 40px;
  font-size: 1.15rem;
  line-height: 1.6;
  padding: 0 20px;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.main-wrapper {
  display: flex;
  gap: 30px;
  margin-top: 30px;
  align-items: flex-start;
}

.sidebar {
  flex: 0 0 280px;
  background: white;
  border-radius: 12px;
  padding: 20px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 1.1rem;
  padding: 0 20px 15px;
  border-bottom: 1px solid var(--border);
  color: var(--banner);
  font-weight: 600;
  margin: 0;
}

.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.filter-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 3px solid transparent;
  font-weight: 500;
}

.filter-btn:hover {
  background: var(--ice);
  color: var(--text);
  border-left-color: var(--btn);
}

.filter-btn.active {
  background: var(--btn);
  color: white;
  font-weight: 600;
  border-left-color: var(--banner);
}

.filter-btn .count {
  background: var(--border);
  color: var(--muted);
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  transition: 0.2s;
}

.filter-btn.active .count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
}

/* ============================================================
   CONTENIDO PRINCIPAL
   ============================================================ */
.content-area {
  flex: 1;
  min-width: 0;
}

/* Controles de búsqueda */
.controls-row {
  display: flex;
  justify-content: center;
  margin-bottom: 40px;
}

.search-container {
  width: 100%;
  max-width: 600px;
  position: relative;
}

.search-container::before {
  content: '🔍';
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  z-index: 2;
  font-size: 1.2rem;
}

.search-container input {
  width: 100%;
  padding: 16px 20px 16px 55px;
  border: 2px solid #dfe6ed;
  border-radius: 30px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: white;
}

.search-container input:focus {
  outline: none;
  border-color: var(--btn);
  box-shadow: 0 0 0 4px rgba(57, 132, 198, 0.1);
}

/* ============================================================
   GRID DE CURSOS (4 columnas)
   ============================================================ */
.courses-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
  margin-top: 20px;
  width: 100%;
}

/* ============================================================
   TARJETA DE CURSO (estilo original, sin cambios de color)
   ============================================================ */
.course-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  height: 100%;
  width: 100%;
}

.course-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 30px rgba(57, 132, 198, 0.15);
  border-color: var(--btn);
}

.course-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #e9f1fa 0%, #d4e3f7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}

.course-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
}

.course-card:hover .course-image img {
  transform: scale(1.08);
}

.course-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-body h3 {
  font-size: 1.15rem;
  color: var(--banner);
  margin: 0 0 12px 0;
  line-height: 1.4;
  font-weight: 600;
  min-height: 3.2em;
}

.course-body p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 20px;
  flex: 1;
}

.download-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--btn);
  color: white !important;
  text-align: center;
  text-decoration: none !important;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: auto;
  border: none;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  flex-shrink: 0;
}

.download-btn:hover {
  background: #2a6495;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(57, 132, 198, 0.3);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .courses-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 992px) {
  .main-wrapper {
    flex-direction: column;
  }
  .sidebar {
    flex: 1 1 auto;
    position: static;
    max-height: none;
    width: 100%;
  }
  .courses-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .courses-container {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
  .section-title {
    font-size: 2rem;
  }
  .intro {
    font-size: 1.05rem;
    margin-bottom: 30px;
  }
  .search-container input {
    padding: 12px 20px 12px 45px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 20px 15px;
  }
  .section-title {
    font-size: 1.8rem;
  }
  .course-body h3 {
    min-height: auto;
  }
}

/* ============================================================
   MEJORAS VISUALES (Cabecera, badges)
   ============================================================ */

/* Cabecera más atractiva */
.page-header {
  text-align: center;
  margin-bottom: 30px;
}

.page-header .section-title {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--banner);
}

.page-header .intro {
  max-width: 700px;
  margin: 0 auto;
}

.badge {
  display: inline-block;
  background: var(--btn);
  color: white;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 4px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive para badges */
@media (max-width: 600px) {
  .badge {
    font-size: 0.75rem;
    padding: 3px 12px;
  }
  .page-header .section-title {
    font-size: 2rem;
  }
}

/* ============================================================
   BOTONES DE CATEGORÍA (para páginas individuales)
   ============================================================ */

.category-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 30px auto 40px;
  padding: 16px 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  max-width: 1100px;
  border: 1px solid var(--border);
}

.category-btn {
  padding: 10px 24px;
  border: 2px solid var(--border);
  background: white;
  color: var(--muted);
  border-radius: 50px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 0 1 auto;
}

.category-btn:hover {
  border-color: var(--btn);
  color: var(--btn);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(57, 132, 198, 0.15);
}

.category-btn.active {
  background: var(--btn);
  color: white;
  border-color: var(--btn);
  font-weight: 700;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(57, 132, 198, 0.25);
}

/* Responsive para los botones en páginas individuales */
@media (max-width: 768px) {
  .category-buttons {
    padding: 12px;
    gap: 8px;
  }
  .category-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .category-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    flex: 1 1 40%;
    text-align: center;
  }
}