/* ============================================================
   boletines.css - Modulo de Boletines Agroclimaticos
   Identidad Cenipalma: #002856 / #005587 / #00A9E0 / #FF8200
   ============================================================ */

/* -- Panel full-screen (cubre el mapa, respeta la sidebar) -- */
.panel-fullscreen {
  display: none;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: linear-gradient(160deg, #002856 0%, #00305f 60%, #005587 100%);
  z-index: 1002;
  overflow-y: auto;
  font-family: 'Inter', sans-serif;
  color: #ffffff;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Cuando el panel Clima esta abierto como secundario junto a boletines */
.panel-fullscreen.with-clima-panel {
  left: calc(var(--sidebar-width) + var(--panel-width));
}

.panel-fullscreen::-webkit-scrollbar { width: 6px; }
.panel-fullscreen::-webkit-scrollbar-track { background: transparent; }
.panel-fullscreen::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }

/* ============================================================
   VISTA HUB
   ============================================================ */

/* Grid 2x2 de categorias */
.bol-hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 28px 32px 40px;
  max-width: 880px;
  margin: 0 auto;
}

/* Tarjeta de categoria */
.bol-cat-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  overflow: hidden;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bol-cat-card:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

/* Cabecera clicable (abre listado) */
.bol-cat-header-link {
  cursor: pointer;
  transition: opacity 0.15s;
}
.bol-cat-header-link:hover {
  opacity: 0.75;
}

/* Bloque imagen+info clicable (abre visor PDF) */
.bol-hub-pdf-link {
  cursor: pointer;
  display: block;
  border-radius: 9px;
  transition: background 0.2s ease;
}
.bol-hub-pdf-link:hover .bol-thumb-wrap {
  opacity: 0.82;
  transition: opacity 0.15s;
}
.bol-hub-pdf-link:hover .bol-latest-titulo {
  color: #4ac8e8;
  transition: color 0.15s;
}

/* -- Bloque destacado en hub -- */
.bol-hub-pdf-link.destacado {
  background: rgba(255,130,0,0.06);
  border: 1px solid rgba(255,130,0,0.30);
  padding: 0 0 6px;
}

.bol-hub-pdf-link.destacado .bol-thumb-wrap::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FF8200, #FFB81C);
}

.bol-hub-pdf-link.destacado:hover {
  background: rgba(255,130,0,0.11);
}

.bol-hub-pdf-link.destacado:hover .bol-latest-titulo {
  color: #FFB81C;
}

/* Franja de color superior */
.bol-cat-accent {
  height: 4px;
  background: var(--cat-color, #00A9E0);
  flex-shrink: 0;
}

.bol-cat-card-inner {
  padding: 18px 20px 16px;
}

.bol-cat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.bol-cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--cat-color, #00A9E0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #ffffff;
  flex-shrink: 0;
}

.bol-cat-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: #ffffff;
}

/* Miniatura en la tarjeta */
.bol-thumb-wrap {
  width: 100%;
  height: 130px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(0,0,0,0.22);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.bol-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bol-thumb-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.2);
  font-size: 28px;
}

.bol-thumb-placeholder span {
  font-size: 10px;
  font-weight: 400;
  color: rgba(255,255,255,0.25);
}

/* Info del ultimo boletin */
.bol-latest-titulo {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  color: rgba(255,255,255,0.88);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  min-height: 35px;
}

.bol-latest-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10px;
  color: rgba(255,255,255,0.45);
}

.bol-latest-meta i { margin-right: 3px; }

.bol-latest-empty {
  font-size: 11px;
  color: rgba(255,255,255,0.28);
  font-style: italic;
  min-height: 35px;
  display: flex;
  align-items: center;
}

/* Footer de tarjeta */
.bol-cat-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: right;
}

.btn-ver-cat {
  background: var(--cat-color, #00A9E0) !important;
  border: none !important;
  color: #ffffff !important;
  border-radius: 7px !important;
  padding: 6px 14px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  cursor: pointer;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ver-cat:hover { opacity: 0.82; }

/* Estados de carga/error en hub */
.bol-loading,
.bol-error,
.bol-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  gap: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.38);
  text-align: center;
}

.bol-error { color: rgba(255,120,120,0.7); }
.bol-loading i, .bol-error i, .bol-empty i { font-size: 32px; }

/* ============================================================
   VISTA LISTADO
   ============================================================ */

.bol-list-header {
  padding: 24px 32px 0;
}

.bol-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn-hub {
  background: transparent !important;
  border: none !important;
  color: #00A9E0 !important;
  padding: 0 !important;
  font-size: 12px !important;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-hub:hover { text-decoration: underline; color: #3bbde8 !important; }

.bol-breadcrumb .sep {
  color: rgba(255,255,255,0.25);
  font-size: 10px;
}

.bol-breadcrumb .current {
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

/* Barra de filtros */
.bol-filters-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px 16px;
  flex-wrap: wrap;
}

.bol-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

.bol-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.35);
  font-size: 11px;
  pointer-events: none;
  z-index: 1;
}

/* Sobrescribir estilos de Shiny textInput dentro del modulo */
.bol-filters-bar .form-group { margin-bottom: 0; flex: 1; min-width: 200px; max-width: 420px; }
.bol-filters-bar .form-group label { display: none; }
.bol-filters-bar input.form-control {
  background: rgba(255,255,255,0.09) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  padding: 8px 12px 8px 32px !important;
  font-size: 12px !important;
  height: 36px !important;
  box-shadow: none !important;
  transition: border-color 0.2s;
}

.bol-filters-bar input.form-control::placeholder { color: rgba(255,255,255,0.32); }
.bol-filters-bar input.form-control:focus {
  border-color: rgba(0,169,224,0.55) !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(0,169,224,0.15) !important;
}

/* Subcategoria select */
.bol-subcat-wrap { flex-shrink: 0; min-width: 180px; }
.bol-subcat-wrap .form-group { margin-bottom: 0; }
.bol-subcat-wrap .form-group label { display: none; }
.bol-subcat-wrap .form-control,
.bol-subcat-wrap .selectize-input {
  background: rgba(255,255,255,0.09) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  font-size: 12px !important;
  height: 36px !important;
  box-shadow: none !important;
}

/* Informacion de resultados */
.bol-results-info {
  padding: 0 32px 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.38);
}

/* Grid de tarjetas de boletines */
.bol-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 0 32px 24px;
}

/* Tarjeta de boletin individual */
.bol-item-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 11px;
  overflow: hidden;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
}

.bol-item-card:hover {
  background: rgba(255,255,255,0.11);
  transform: translateY(-2px);
}

/* -- Tarjeta destacada -- */
.bol-item-card.destacado {
  border-color: rgba(255,130,0,0.38);
  background: rgba(255,130,0,0.05);
}

.bol-item-card.destacado::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #FF8200, #FFB81C);
  border-radius: 11px 11px 0 0;
  z-index: 1;
}

.bol-item-card.destacado:hover {
  background: rgba(255,130,0,0.10);
  box-shadow: 0 6px 24px rgba(255,130,0,0.14);
}

/* Contenedor miniatura en lista (incluye badge flotante) */
.bol-thumb-wrap-item {
  position: relative;
  flex-shrink: 0;
}

/* Badge flotante "Destacado" sobre la miniatura */
.bol-thumb-badge-destacado {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,130,0,0.88);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  backdrop-filter: blur(4px);
  z-index: 2;
  pointer-events: none;
}

.bol-item-thumb {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.bol-item-thumb-placeholder {
  width: 100%;
  height: 110px;
  background: linear-gradient(135deg, rgba(0,55,110,0.7), rgba(0,30,70,0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.18);
  font-size: 26px;
}

.bol-item-body {
  padding: 13px 14px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.bol-item-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  background: rgba(0,169,224,0.18);
  color: #4ac8e8;
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 7px;
  align-self: flex-start;
}

.bol-item-badge.destacado {
  background: rgba(255,130,0,0.18);
  color: #FF9F30;
}

.bol-item-titulo {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.88);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.bol-item-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.38);
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bol-item-meta i { margin-right: 3px; }

.bol-item-actions {
  display: flex;
  gap: 7px;
}

.btn-ver-pdf {
  flex: 1;
  background: rgba(0,85,135,0.7) !important;
  border: 1px solid rgba(0,119,174,0.4) !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.btn-ver-pdf:hover {
  background: rgba(0,119,174,0.8) !important;
}

.btn-descargar-pdf {
  background: rgba(255,130,0,0.12) !important;
  border: 1px solid rgba(255,130,0,0.28) !important;
  color: #FF8200 !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-descargar-pdf:hover {
  background: rgba(255,130,0,0.22) !important;
}

/* Estado vacio en lista */
.bol-list-empty {
  text-align: center;
  padding: 50px 32px;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  grid-column: 1 / -1;
}

.bol-list-empty i {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

/* Paginacion */
.bol-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 14px 32px 40px;
  flex-wrap: wrap;
}

.bol-page-btn {
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.11) !important;
  color: rgba(255,255,255,0.7) !important;
  border-radius: 6px !important;
  padding: 5px 11px !important;
  font-size: 12px !important;
  cursor: pointer;
  min-width: 32px;
  text-align: center;
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bol-page-btn.active {
  background: #00A9E0 !important;
  border-color: #00A9E0 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
}

.bol-page-btn:hover:not(.active):not(:disabled) {
  background: rgba(255,255,255,0.15) !important;
  color: #ffffff !important;
}

.bol-page-btn:disabled {
  opacity: 0.28 !important;
  cursor: default !important;
  pointer-events: none;
}

/* ============================================================
   VISTA PDF
   ============================================================ */

.bol-pdf-header {
  padding: 24px 32px 0;
}

/* Fila titulo + boton descargar */
.bol-pdf-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 32px 14px;
}

.bol-pdf-titulo {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bol-pdf-dl-btn {
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  font-size: 11px !important;
  padding: 6px 14px !important;
  text-decoration: none !important;
  border-radius: 6px !important;
  white-space: nowrap;
}

/* Contenedor que ocupa el resto del alto disponible */
.bol-pdf-container {
  padding: 0 32px 24px;
}

/* Iframe del PDF */
.bol-pdf-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 140px);
  border: none;
  border-radius: 10px;
  background: #ffffff;
}

/* Animacion suave de entrada */
@keyframes bolFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bol-hub-grid, .bol-list-grid {
  animation: bolFadeIn 0.28s ease both;
}
