/* ===== CONTENEDOR PRINCIPAL (noticias) ===== */
.news-wrapper {
  width: 100%;
  max-width: 1100px;     /* galeta amplia en escritorio */
  margin: 2px auto;
  padding: 12px 16px;
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  box-sizing: border-box;
}

/* ===== SECCIÓN TARJETAS ===== */
.cards-section {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: center;
}

.card {
  width: 15.3%;
  min-width: 160px;
  max-width: 220px;
  margin-bottom: 22px;
  background: #f6f8fc;
  border-radius: 18px;
  box-shadow: 0 1px 8px #185ccf12;
  padding: 0 0 14px 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: box-shadow 0.18s, background 0.18s;
  overflow: hidden;
}
.card:hover { box-shadow: 0 2px 16px #185ccf20; background: #eaf1fc; }

.card img {
  width: 100%;
  height: 210px;              /* altura fija en desktop/tablet */
  object-fit: cover;
  display: block;
}

.card-content { padding: 12px 12px 0 12px; }

.card-title {
  font-size: 1.02em;
  font-weight: bold;
  margin-bottom: 6px;
  line-height: 1.25;
  color: #1f2d4d;
}
.card-desc { min-height: 46px; font-size: 0.96em; margin-bottom: 8px; color: #333; }
.card-meta { color: #657287; font-size: 0.88em; margin: 0 12px 10px 12px; }

.card-link {
  align-self: flex-start;
  margin: 0 12px;
  font-size: 0.95em;
  color: #185ccf;
  font-weight: bold;
  text-decoration: none;
}
.card-link:hover { text-decoration: underline; }

/* ===== FORMULARIO DE FILTROS ===== */
.filtros-form {
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;   /* centrado horizontal */
}
.filtros-form input,
.filtros-form select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #aec4e2;
}
.filtros-form .cta-btn {
  padding: 8px 18px;
  border: none;
  background-color: #185ccf;
  color: #fff;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}
.filtros-form .cta-btn:hover { background-color: #1449a0; }

/* ===== MODAL ===== */
#modalOverlay { display: none; position: fixed; z-index: 999; inset: 0; background: rgba(0,0,0,0.6); }
#modalNoticia {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 90%; max-width: 900px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 0 30px rgba(0,0,0,0.2);
  padding: 20px; overflow-y: auto; max-height: 90vh; border-radius: 14px;
}
#modalClose { float: right; cursor: pointer; font-size: 22px; color: #888; }
#modalClose:hover { color: #000; }

/* ===== SUSCRIPCIÓN (debajo de tarjetas) ===== */
.suscripcion-wrapper{
  display:flex;
  justify-content:center;
  margin: 14px 0 12px;
  width: 100%;
}
.suscrip-inline-form{
  display:inline-flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
}
.suscrip-input{
  padding:8px 10px;
  border-radius:8px;
  border:1px solid #aec4e2;
  min-width:240px;
}
.suscrip-btn{
  border:none;
  border-radius:8px;
  padding:8px 12px;
  font-weight:600;
  cursor:pointer;
  white-space: nowrap;
}
.suscrip-btn-ok{ background:#1b8f2b; color:#fff; }
.suscrip-btn-ok:hover{ background:#157224; }
.suscrip-btn-baja{ background:#c53030; color:#fff; }
.suscrip-btn-baja:hover{ background:#9b2424; }
.suscrip-msg{ font-size:.9em; color:#333; }

/* ===== BARRA INFERIOR (viendo + paginación) ===== */
.barra-inferior{
  display:flex;
  justify-content: center;  /* “Viendo…” izq, selector dcha */
  align-items:center;
  flex-wrap: wrap;                  /* en móvil se apilan */
  gap: 8px;
  text-align:left;
}
.barra-inferior .contador-articulos{
  font-size: 0.95em;
  color: #333;
}
.barra-inferior .paginacion-form{
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== RESPONSIVE ===== */

/* <= 700px: 2 por fila + imágenes cuadradas */
@media (max-width: 700px) {
  .news-wrapper { max-width: 100%; margin: 0; padding: 0; }
  .cards-section { gap: 10px; }
  .card { width: 50%; max-width: none; }
  .card img { height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
  .card-desc { min-height: 0; }

  /* Suscripción: input ancho completo si hace falta */
  .suscrip-input{ min-width: 0; width: 100%; max-width: 320px; }
}

/* <= 480px: 1 por fila */
@media (max-width: 480px) {
  .news-wrapper { max-width: 100%; margin: 0; padding: 0; }
  .cards-section { gap: 8px; }
  .card { width: 100%; }
  .card-title { font-size: 1.05em; }
  .card-meta { font-size: 0.9em; }
  .filtros-form { gap: 8px; }
}

/* =================================================================== */
/*   MODO “UNA SOLA LÍNEA” (sólo en la página news.php)                */
/* =================================================================== */
.noticias-linea .news-wrapper { max-width: 100%; }
.noticias-linea .cards-section {
  display: flex;
  flex-wrap: nowrap;
  gap: 22px;
  overflow-x: auto;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.noticias-linea .cards-section::-webkit-scrollbar { height: 8px; }
.noticias-linea .cards-section::-webkit-scrollbar-thumb { background: #cfcfcf; border-radius: 4px; }
.noticias-linea .card { flex: 0 0 auto; }

@media (max-width: 700px) { .noticias-linea .cards-section { gap: 10px; } }
@media (max-width: 480px) { .noticias-linea .cards-section { gap: 8px; } }
  grid-template-columns:repeat(5, minmax(0,1fr));
  gap:16px !important;
  overflow:visible !important;
  padding-inline:8px;
}
.noticias-linea .card{ flex:initial !important; }
  min-width:240px;
}
.suscrip-btn{
  border:none;
  border-radius:8px;
  padding:8px 12px;
  font-weight:600;
  cursor:pointer;
  white-space: nowrap;
}
.suscrip-btn-ok{ background:#1b8f2b; color:#fff; }
.suscrip-btn-ok:hover{ background:#157224; }
.suscrip-btn-baja{ background:#c53030; color:#fff; }
.suscrip-btn-baja:hover{ background:#9b2424; }
.suscrip-msg{ font-size:.9em; color:#333; }

/* ===== RESPONSIVE ===== */

/* <= 1100px: 4 columnas */
@media (max-width: 1100px) {
  .cards-section { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* <= 850px: 3 columnas */
@media (max-width: 850px) {
  .cards-section { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* <= 700px: 2 columnas + imágenes cuadradas */
@media (max-width: 700px) {
  .news-wrapper { max-width: 100%; margin: 0; padding: 0; }
  .cards-section { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card img { height: auto; aspect-ratio: 1 / 1; object-fit: cover; }
  .card-desc { min-height: 0; }

  .suscrip-input{ min-width: 0; width: 100%; max-width: 320px; }
}

/* <= 480px: 1 columna */
@media (max-width: 480px) {
  .news-wrapper { max-width: 100%; margin: 0; padding: 0; }
  .cards-section { grid-template-columns: 1fr; gap: 8px; }
  .card-title { font-size: 1.05em; }
  .card-meta { font-size: 0.9em; }
  .filtros-form { gap: 8px; }
}
