/* ==========================================================================
   DRET Tacna - Retoques de diseño (se carga después de style.css)
   ========================================================================== */
:root {
  --dret-rojo: #990000;
  --dret-rojo-oscuro: #6e0000;
  --dret-texto: #2b2b2b;
  --dret-gris: #f4f5f7;
  --dret-borde: #e3e5e8;
  --dret-sombra: 0 2px 10px rgba(0, 0, 0, .08);
  --dret-sombra-hover: 0 8px 22px rgba(0, 0, 0, .15);
}

body { color: var(--dret-texto); }

/* Foco visible para navegación con teclado (accesibilidad) */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid #f2b705;
  outline-offset: 2px;
}

/* ---------- Barra de accesos rápidos ---------- */
.accesos-rapidos {
  background: #fff;
  position: relative;
  z-index: 5;
  margin-top: -38px;
  padding-bottom: 10px;
}
.accesos-rapidos .rapidos-box {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--dret-sombra-hover);
  overflow: hidden;
  border-top: 4px solid var(--dret-rojo);
}
.accesos-rapidos a.rapido {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 18px 8px;
  color: var(--dret-texto);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  border-right: 1px solid var(--dret-borde);
  transition: background .2s, color .2s;
}
.accesos-rapidos a.rapido:last-child { border-right: 0; }
.accesos-rapidos a.rapido i { font-size: 28px; color: var(--dret-rojo); transition: color .2s; }
.accesos-rapidos a.rapido:hover,
.accesos-rapidos a.rapido:focus-visible {
  background: var(--dret-rojo);
  color: #fff;
  text-decoration: none;
}
.accesos-rapidos a.rapido:hover i,
.accesos-rapidos a.rapido:focus-visible i { color: #fff; }

/* ---------- Títulos de sección ---------- */
.title-section .left-part h1 {
  position: relative;
  padding-bottom: 12px;
  letter-spacing: .5px;
}
.title-section .left-part h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: var(--dret-rojo);
}

/* ---------- Tarjetas de noticias (portada) ---------- */
.popular-courses-section .course-post {
  background: #fff;
  border: 1px solid var(--dret-borde);
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  box-shadow: var(--dret-sombra);
  transition: transform .2s, box-shadow .2s;
}
.popular-courses-section .course-post:hover {
  transform: translateY(-4px);
  box-shadow: var(--dret-sombra-hover);
}
.popular-courses-section .noticia { margin-bottom: 24px; }
.popular-courses-section .noticia-thumbnail-holder img {
  width: 100%;
  height: 220px !important;
  object-fit: cover;
  display: block;
}
.popular-courses-section .noticia-titulo,
.popular-courses-section .noticia-titulo a {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.popular-courses-section .noticia-titulo a:hover { color: var(--dret-rojo); }

/* ---------- Listado de noticias ---------- */
.blog-post.list-style {
  border-radius: 8px;
  box-shadow: var(--dret-sombra);
  transition: box-shadow .2s;
}
.blog-post.list-style:hover { box-shadow: var(--dret-sombra-hover); }
.blog-post.list-style > a { overflow: hidden; }
.blog-post.list-style > a img { height: 100% !important; min-height: 260px; object-fit: cover; }
.blog-post .post-content h2 a { color: var(--dret-rojo); }
.blog-post .post-content h2 a:hover { color: var(--dret-rojo-oscuro); }

/* ---------- Programas presupuestales ---------- */
.programa-pre {
  background: #fff;
  border: 1px solid var(--dret-borde);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 24px;
  height: calc(100% - 24px);
  box-shadow: var(--dret-sombra);
  transition: transform .2s, box-shadow .2s;
}
.programa-pre:hover { transform: translateY(-3px); box-shadow: var(--dret-sombra-hover); }
.programa-pre img { max-width: 100%; height: auto; }

/* ---------- Accesos directos (columna derecha) ---------- */
.acceso-der .feature-box img.sombra {
  border-radius: 8px;
  box-shadow: var(--dret-sombra);
  transition: transform .2s, box-shadow .2s;
}
.acceso-der .feature-box a:hover img.sombra {
  transform: translateY(-3px);
  box-shadow: var(--dret-sombra-hover);
}
.acceso-der .category-widget {
  border-radius: 8px;
  border: 1px solid var(--dret-borde);
  box-shadow: var(--dret-sombra);
}
.acceso-der .category-list li a:hover { color: var(--dret-rojo); }

/* ---------- Redes y enlaces ---------- */
.redes-section iframe, .redes-section .fb-page { max-width: 100%; border-radius: 8px; }
.enlaces-logo img { transition: transform .2s; }
.enlaces-logo a:hover img { transform: scale(1.06); }

/* ---------- Pie de página ---------- */
footer .footer-widget ul.enlaces-footer { list-style: none; padding: 0; margin: 0; }
footer .footer-widget ul.enlaces-footer li { margin-bottom: 10px; }
footer .footer-widget ul.enlaces-footer a {
  color: inherit;
  opacity: .9;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
footer .footer-widget ul.enlaces-footer a:hover { opacity: 1; text-decoration: underline; }
footer .footer-widget ul.enlaces-footer i { font-size: 18px; }

/* ---------- Móvil ---------- */
@media (max-width: 991px) {
  .accesos-rapidos .rapidos-box { grid-template-columns: repeat(3, 1fr); }
  .accesos-rapidos a.rapido { border-bottom: 1px solid var(--dret-borde); }
}
@media (max-width: 575px) {
  .accesos-rapidos { margin-top: -20px; }
  .accesos-rapidos .rapidos-box { grid-template-columns: repeat(2, 1fr); }
  .accesos-rapidos a.rapido { padding: 14px 6px; font-size: 13px; }
  .accesos-rapidos a.rapido i { font-size: 24px; }
  .popular-courses-section .noticia-thumbnail-holder img { height: 190px !important; }
  .title-section .right-part { margin-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Convocatorias / tablas de datos
   ========================================================================== */
#dtb_convocatoria_wrapper .row { align-items: center; margin-bottom: 10px; }
#dtb_convocatoria_wrapper .dataTables_length label,
#dtb_convocatoria_wrapper .dataTables_filter label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
}
#dtb_convocatoria_wrapper .dataTables_length select {
  width: auto;
  display: inline-block;
  padding: 4px 28px 4px 10px;
  height: auto;
}
#dtb_convocatoria_wrapper .dataTables_filter input {
  width: 240px;
  max-width: 100%;
  border: 1px solid var(--dret-borde);
  border-radius: 6px;
  padding: 6px 12px;
}
#dtb_convocatoria_wrapper .dataTables_filter { text-align: right; }

#dtb_convocatoria { font-size: 14px !important; }
#dtb_convocatoria thead th {
  background: var(--dret-rojo);
  color: #fff;
  border: 0;
  vertical-align: middle;
  padding: 10px 8px;
}
#dtb_convocatoria tbody td { vertical-align: middle; padding: 12px 8px; white-space: normal; }
#dtb_convocatoria.table-striped tbody tr:nth-of-type(odd) { background: var(--dret-gris); }
#dtb_convocatoria tbody tr:hover { background: #fdecec; }
#dtb_convocatoria .btn-info {
  background: var(--dret-rojo);
  border-color: var(--dret-rojo);
  border-radius: 6px;
}
#dtb_convocatoria .btn-info:hover { background: var(--dret-rojo-oscuro); border-color: var(--dret-rojo-oscuro); }
#dtb_convocatoria .badge { padding: 6px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap; }

.conv-filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.conv-filtro {
  border: 1px solid var(--dret-rojo);
  background: #fff;
  color: var(--dret-rojo);
  border-radius: 20px;
  padding: 6px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.conv-filtro:hover, .conv-filtro.active { background: var(--dret-rojo); color: #fff; }

@media (max-width: 767px) {
  #dtb_convocatoria_wrapper .dataTables_filter { text-align: left; margin-top: 8px; }
  #dtb_convocatoria_wrapper .dataTables_filter input { width: 100%; }
  #dtb_convocatoria { font-size: 13px !important; }
}
#dtb_convocatoria { min-width: 860px; }

/* ==========================================================================
   Portada: reorganizacion
   ========================================================================== */

/* Barra de accesos rapidos: sin franja blanca; la mitad superior se apoya sobre el slider */
.accesos-rapidos {
  background: linear-gradient(to bottom, transparent 0, transparent 38px, #f8f9fa 38px);
  padding-bottom: 28px;
}
.noticia-seccion { padding-top: 24px; }

/* Noticias: 1 destacada + 2 secundarias (reemplaza carrusel + tarjetas repetidas) */
.noticias-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 8px;
}
.noticia-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--dret-borde);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--dret-sombra);
  display: flex;
  flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.noticia-card:hover { transform: translateY(-3px); box-shadow: var(--dret-sombra-hover); }
.noticia-card .noticia-img { display: block; overflow: hidden; flex: 1 1 auto; min-height: 150px; }
.noticia-card .noticia-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s;
}
.noticia-card:hover .noticia-img img { transform: scale(1.04); }
.noticia-card .noticia-info { padding: 12px 16px 14px; }
.noticia-card .noticia-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 6px;
}
.noticia-card .noticia-meta i { color: var(--dret-rojo); margin-right: 4px; }
.noticia-card .noticia-titulo {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.noticia-card .noticia-titulo a { color: var(--dret-texto); }
.noticia-card .noticia-titulo a:hover { color: var(--dret-rojo); text-decoration: none; }

.noticia-card.destacada { grid-row: 1 / span 2; }
.noticia-card.destacada .noticia-img { min-height: 320px; }
.noticia-card.destacada .noticia-titulo { font-size: 22px; -webkit-line-clamp: 3; }
.noticia-card.destacada .noticia-info { padding: 16px 20px 18px; }

/* Columna derecha: accesos directos con desplazamiento y barra fija al hacer scroll */
.acceso-der { position: sticky; top: 130px; }
.acceso-der .category-list {
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--dret-rojo) #eee;
}
.acceso-der .category-list::-webkit-scrollbar { width: 6px; }
.acceso-der .category-list::-webkit-scrollbar-thumb { background: var(--dret-rojo); border-radius: 3px; }
.acceso-der .category-list::-webkit-scrollbar-track { background: #eee; }

/* Separaciones entre bloques */
.noticia-seccion hr { margin: 28px 0 8px; }
.events-section { padding-top: 8px; }

@media (max-width: 991px) {
  .acceso-der { position: static; }
  .noticias-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .noticia-card.destacada { grid-column: 1 / -1; grid-row: auto; }
  .noticia-card.destacada .noticia-img { min-height: 260px; }
}
@media (max-width: 575px) {
  .noticias-grid { grid-template-columns: 1fr; }
  .noticia-card .noticia-img { min-height: 180px; }
  .noticia-card.destacada .noticia-titulo { font-size: 18px; }
}

/* ==========================================================================
   Comunicados (tabla moderna)
   ========================================================================== */
#dtb_comunicado_wrapper .row { align-items: center; margin-bottom: 10px; }
#dtb_comunicado_wrapper .dataTables_length label,
#dtb_comunicado_wrapper .dataTables_filter label {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; white-space: nowrap;
}
#dtb_comunicado_wrapper .dataTables_length select { width: auto; display: inline-block; padding: 4px 28px 4px 10px; height: auto; }
#dtb_comunicado_wrapper .dataTables_filter { text-align: right; }
#dtb_comunicado_wrapper .dataTables_filter input {
  width: 260px; max-width: 100%; border: 1px solid var(--dret-borde); border-radius: 20px; padding: 7px 16px;
}
#dtb_comunicado_wrapper .dataTables_filter input:focus { border-color: var(--dret-rojo); outline: 0; box-shadow: 0 0 0 3px rgba(153, 0, 0, .12); }

#dtb_comunicado { font-size: 15px; border-collapse: separate; border-spacing: 0; }
#dtb_comunicado thead th {
  background: var(--dret-rojo); color: #fff; border: 0; padding: 12px 10px; vertical-align: middle; font-weight: 600;
  white-space: nowrap;
}
#dtb_comunicado thead th:first-child { border-top-left-radius: 8px; }
#dtb_comunicado thead th:last-child { border-top-right-radius: 8px; }
#dtb_comunicado thead th.sorting:before, #dtb_comunicado thead th.sorting:after,
#dtb_comunicado thead th.sorting_asc:before, #dtb_comunicado thead th.sorting_asc:after,
#dtb_comunicado thead th.sorting_desc:before, #dtb_comunicado thead th.sorting_desc:after { color: #fff; }
#dtb_comunicado tbody td { vertical-align: middle; padding: 13px 10px; border-top: 1px solid var(--dret-borde); }
#dtb_comunicado.table-striped tbody tr:nth-of-type(odd) { background: #fff; }
#dtb_comunicado.table-striped tbody tr:nth-of-type(even) { background: var(--dret-gris); }
#dtb_comunicado tbody tr { transition: background .15s; }
#dtb_comunicado tbody tr:hover { background: #fdecec !important; }

#dtb_comunicado .com-num { color: #8a8f98; font-weight: 600; width: 48px; }
#dtb_comunicado .com-nombre { font-weight: 600; color: var(--dret-texto); line-height: 1.35; }
#dtb_comunicado .com-fecha { white-space: nowrap; color: #555; width: 130px; }
#dtb_comunicado .com-fecha i { color: var(--dret-rojo); margin-right: 4px; }
#dtb_comunicado .com-acciones { white-space: nowrap; width: 1%; }
#dtb_comunicado .com-nuevo {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 10px;
  background: #e8f5e9; color: #1b7a33; font-size: 11px; font-weight: 700; letter-spacing: .5px; vertical-align: middle;
}
#dtb_comunicado .com-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 18px;
  background: var(--dret-rojo); color: #fff !important; font-size: 13px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--dret-rojo); transition: background .2s, transform .2s;
}
#dtb_comunicado .com-btn:hover, #dtb_comunicado .com-btn:focus-visible { background: var(--dret-rojo-oscuro); transform: translateY(-1px); text-decoration: none; }
#dtb_comunicado .com-btn-sec { background: #fff; color: var(--dret-rojo) !important; margin-left: 6px; }
#dtb_comunicado .com-btn-sec:hover, #dtb_comunicado .com-btn-sec:focus-visible { background: var(--dret-rojo); color: #fff !important; }

/* Paginacion */
#dtb_comunicado_wrapper .dataTables_paginate .pagination { margin: 0; gap: 4px; }
#dtb_comunicado_wrapper .page-link { border-radius: 8px !important; border: 1px solid var(--dret-borde); color: var(--dret-rojo); padding: 6px 12px; }
#dtb_comunicado_wrapper .page-item.active .page-link { background: var(--dret-rojo); border-color: var(--dret-rojo); color: #fff; }
#dtb_comunicado_wrapper .page-item.disabled .page-link { color: #aaa; }
#dtb_comunicado_wrapper .dataTables_info { color: #666; }

@media (max-width: 767px) {
  #dtb_comunicado_wrapper .dataTables_filter { text-align: left; margin-top: 8px; }
  #dtb_comunicado_wrapper .dataTables_filter input { width: 100%; }
  #dtb_comunicado { font-size: 14px; }
  #dtb_comunicado .com-fecha { width: auto; }
  #dtb_comunicado .com-acciones { white-space: normal; }
  #dtb_comunicado .com-btn { margin: 2px 0; }
  #dtb_comunicado .com-btn-sec { margin-left: 0; }
}

/* Comunicados: columnas Imagen y PDF/Enlace separadas */
#dtb_comunicado .com-acciones { width: 150px; }
#dtb_comunicado .com-btn-sec { margin-left: 0; }
#dtb_comunicado .com-vacio { color: #c5c8cd; }
@media (max-width: 767px) { #dtb_comunicado .com-acciones { width: auto; } }

/* Convocatorias: boton de Fe de erratas bajo el PDF principal */
#dtb_convocatoria a.conv-fe {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 3px 10px;
  border: 1px solid #c40000; border-radius: 14px; background: #fff; color: #c40000 !important;
  font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap; text-decoration: none;
}
#dtb_convocatoria a.conv-fe .material-icons { font-size: 16px; }
#dtb_convocatoria a.conv-fe:hover, #dtb_convocatoria a.conv-fe:focus-visible { background: #c40000; color: #fff !important; text-decoration: none; }
#dtb_convocatoria td .conv-fe { display: flex; width: fit-content; margin-left: auto; margin-right: auto; }
