/* ==========================================================================
   Estilos base y variables de color
   ========================================================================== */
:root {
  --primary-color: #189aa2;
  --primary-color-hover: #14838a;
  --primary-color-subtle: rgba(24, 154, 162, 0.15);
  --error-color: #c23b3b;
  --error-color-bg: #fbeeee;
  --error-color-border: #f0cccc;
  --warning-color: #8a6d1d;
  --warning-color-bg: #fdf6e3;
  --warning-color-border: #f0e0b0;
  --success-color: #2f7d4f;
  --success-color-bg: #eaf6ee;
  --success-color-border: #cfe8d7;
}

.fila-atenuada {
  opacity: 0.45;
}

/* Acordeón de avance por competencia: color de la barra según % de notas publicadas/esperadas */
.accordion-status-red .accordion-button,
.accordion-status-red .accordion-button:not(.collapsed) {
  background-color: var(--error-color-bg);
  color: var(--error-color);
}

.accordion-status-yellow .accordion-button,
.accordion-status-yellow .accordion-button:not(.collapsed) {
  background-color: var(--warning-color-bg);
  color: var(--warning-color);
}

.accordion-status-green .accordion-button,
.accordion-status-green .accordion-button:not(.collapsed) {
  background-color: var(--success-color-bg);
  color: var(--success-color);
}

.accordion-title-text {
  flex: 1 1 auto;
}

.accordion-status-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  margin-right: 10px;
  border-radius: 999px;
  color: #ffffff;
  display: inline-block;
  width: 132px;
  text-align: center;
}

.accordion-status-red .accordion-status-badge {
  background-color: var(--error-color);
}

.accordion-status-yellow .accordion-status-badge {
  background-color: var(--warning-color);
}

.accordion-status-green .accordion-status-badge {
  background-color: var(--success-color);
}

.accordion-badge-borradores {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  margin-right: 10px;
  border-radius: 999px;
  color: #ffffff;
  background-color: #6c757d;
  display: inline-block;
  width: 132px;
  text-align: center;
}

.observacion-alert {
  padding: 0.9rem 1.1rem;
  border-radius: 0.5rem;
  background-color: var(--warning-color-bg);
  border: 1px solid var(--warning-color-border);
  color: var(--warning-color);
}

.observacion-alert .observacion-titulo {
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

html {
  overflow-y: scroll;
}

body {
  padding-bottom: 2rem;
  background-color: #f8f9fa;
}

.body-with-fixed-nav {
  padding-top: 56px;
}

/* ==========================================================================
   Color corporativo personalizado (TBox)
   ========================================================================== */
.bg-primary-custom {
  background-color: var(--primary-color) !important;
}

.text-primary-custom {
  color: var(--primary-color) !important;
}

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

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

.btn-primary:disabled,
.btn-primary.disabled {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  opacity: 0.55;
}

/* Encabezados de tablas corporativos */
.table-primary-custom,
.table thead.table-primary-custom,
.table thead.table-primary-custom th,
thead.table-primary-custom th,
.table-dark,
.table thead.table-dark,
.table thead.table-dark th,
thead.table-dark th,
.reporte th,
.tb_crit th {
  --bs-table-bg: var(--primary-color);
  --bs-table-color: #ffffff;
  --bs-table-border-color: rgba(255, 255, 255, 0.2);
  background-color: var(--primary-color);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  vertical-align: middle;
}

/* Botón "agregar criterio" en encabezado de tabla de temas (administracion-criterios-evaluacion.php) */
.btn-agregar-criterio {
  background-color: #2e86ab;
  border-color: #2e86ab;
  color: #ffffff;
}

.btn-agregar-criterio:hover,
.btn-agregar-criterio:focus {
  background-color: #256d8a;
  border-color: #256d8a;
  color: #ffffff;
}

/* Acordeones (estadisticas.php, edicionNotas.php, frm_cali2.php): color corporativo al expandir */
.accordion-button:not(.collapsed) {
  color: #ffffff;
  background-color: var(--primary-color);
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.25rem var(--primary-color-subtle);
}

/* ==========================================================================
   Navegación superior y Login
   ========================================================================== */
.login-alert-error {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background-color: var(--error-color-bg);
  border: 1px solid var(--error-color-border);
  color: var(--error-color);
  font-size: 0.95rem;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #f8f9fa;
  background-image: linear-gradient(to top, #dbe6f9, #ffffff);
}

.login-body main {
  width: 100%;
}

.navbar .navbar-nav .nav-link {
  position: relative;
  display: inline-block;
  width: fit-content;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  padding-bottom: 0.35rem;
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s ease-in-out;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
  color: #ffffff;
}

.navbar .navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.5rem;
  width: 0;
  height: 2.5px;
  background-color: #ffffff;
  border-radius: 2px;
  transition: width 0.3s ease-in-out;
}

.navbar .navbar-nav .nav-link:hover::after,
.navbar .navbar-nav .nav-link.active::after {
  width: calc(100% - 1rem);
}

@media (max-width: 991.98px) {
  .navbar .navbar-nav {
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
  }
  .navbar .navbar-nav .nav-item {
    margin-bottom: 0.35rem;
  }
}

/* ==========================================================================
   Banner, Imágenes y Multimedia
   ========================================================================== */
.banner {
  text-align: center;
  margin-bottom: 1.5rem;
}

.layout-banner-stats {
  justify-content: center;
}

@media (min-width: 992px) {
  .layout-banner-stats .banner {
    text-align: left;
  }
}

.banner .bn {
  max-width: 500px;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.video-responsive-wrapper {
  width: auto;
  max-width: 100%;
  max-height: 90vh;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.competencia-banner-thumb {
  width: 65px;
  height: 35px;
  object-fit: cover;
}

.img-preview-thumb {
  max-height: 200px;
  max-width: 100%;
}

.img-preview-project {
  max-height: 90vh;
}

.list-icon-24 {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
}

.media-buttons-container {
  max-width: 890px;
  margin-left: auto;
  margin-right: auto;
}

.codigo-destacado {
  font-size: 24px;
}

/* ==========================================================================
   Componente de Calificación y Sliders (cali.php / frm_cali2.php)
   ========================================================================== */
.promedio {
  text-align: right;
  font-weight: bold;
  font-size: 1.1rem;
  margin-top: 10px;
}

.nota.guardado {
  color: #999;
  font-style: italic;
}

.nota.publicado {
  font-weight: bold;
}

.form-range {
  --range-thumb-color: var(--primary-color);
  --range-thumb-height: 1.6rem;
}

.form-range::-webkit-slider-thumb {
  background: var(--range-thumb-color);
  height: var(--range-thumb-height);
  width: var(--range-thumb-height);
  transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-range::-moz-range-thumb {
  background: var(--range-thumb-color);
  height: var(--range-thumb-height);
  width: var(--range-thumb-height);
  transition: background-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-range:active::-webkit-slider-thumb,
.form-range:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 0.25rem rgba(24, 154, 162, 0.25);
}

.form-range:disabled::-webkit-slider-thumb,
.form-range:disabled::-moz-range-thumb {
  background: #adb5bd;
}

.score-badge {
  background-color: var(--primary-color);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  min-width: 50px;
  text-align: center;
  border-radius: 0.375rem;
  padding: 0.3em 0.5em;
  transition: transform 0.2s ease-out, background-color 0.2s ease;
}

.rating-criterion {
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: box-shadow 0.2s ease-in-out;
}

.rating-criterion:hover {
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.rating-criterion .criterion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.rating-criterion .criterion-label {
  font-weight: 500;
  margin-bottom: 0;
}

.total-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.total-label {
  font-size: 1.25rem;
  font-weight: 700;
}

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

.accordion-button:not(.collapsed) {
  color: #ffffff;
  background-color: var(--primary-color);
  box-shadow: none;
}

.accordion-button:not(.collapsed)::after {
  filter: brightness(0) invert(1);
}

.accordion-button:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(24, 154, 162, 0.25);
}

/* ==========================================================================
   Tarjetas de Estadísticas (estadisticas.php / cali.php)
   ========================================================================== */
@media (max-width: 991.98px) {
  .stats-container {
    max-width: 500px;
    margin: 0 auto;
  }
}

.stat-card {
  background-color: #fff;
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  border: 1px solid #dee2e6;
}

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

.stat-card .stat-label {
  font-size: 0.9rem;
  color: #6c757d;
}

.stat-card.stat-card-highlight {
  border-color: var(--primary-color);
}

.stat-card-compact {
  padding: 0.7rem 0.4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card-compact .stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.stat-card-compact .stat-label {
  font-size: 0.78rem;
  line-height: 1.15;
  color: #6c757d;
  font-weight: 500;
}

/* ==========================================================================
   Tarjetas de Importación Rápida (administracion.php)
   ========================================================================== */
.hero-import-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 100%);
  border: 2px solid #14b8a6;
  border-radius: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(20, 184, 166, 0.12);
}

.hero-import-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(20, 184, 166, 0.2);
}

.btn-import-custom {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: #ffffff;
  border: none;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(13, 148, 136, 0.3);
  transition: all 0.2s ease;
}

.btn-import-custom:hover {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(13, 148, 136, 0.4);
}

.icon-import-badge {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background-color: rgba(20, 184, 166, 0.15);
  color: #0d9488;
  font-size: 1.75rem;
}

/* ==========================================================================
   Modal de Imagen a Pantalla Completa (frm_cali2.php)
   ========================================================================== */
#myImg {
  cursor: pointer;
  transition: 0.3s;
}

#myImg:hover {
  opacity: 0.7;
}

.modal-image-fullscreen {
  display: none;
  position: fixed;
  z-index: 1060;
  padding-top: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
}

.modal-image-fullscreen .modal-content-image {
  margin: auto;
  display: block;
  max-width: calc(100% - 100px);
  max-height: 90vh;
}

.modal-image-fullscreen .close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}

.modal-image-fullscreen .close:hover,
.modal-image-fullscreen .close:focus {
  color: #bbb;
  text-decoration: none;
}

@media only screen and (max-width: 700px) {
  .modal-image-fullscreen .modal-content-image {
    width: 90%;
    max-width: calc(100% - 10px);
  }

  .modal-image-fullscreen {
    padding-top: 100px;
  }

  .modal-image-fullscreen .close {
    right: 15px;
  }
}

/* ==========================================================================
   Tablas Estructuradas y Responsivas
   ========================================================================== */
.table-fixed-layout {
  table-layout: fixed;
  width: 100%;
}

.table-fixed-layout td,
.table-fixed-layout th {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Columnas de control con ancho exacto */
.col-acciones,
.col-actions-3btns {
  width: 140px;
  min-width: 140px;
}

.col-acciones-2,
.col-actions-2btns {
  width: 105px;
  min-width: 105px;
}

.col-nombres-apellidos-jueces {
  width: 250px;
  min-width: 250px;
}

.col-usuario-jueces {
  width: 150px;
  min-width: 150px;
}

.col-institucion {
  width: 300px;
  min-width: 300px;
}

.col-correo {
  width: 200px;
  min-width: 200px;
}

.col-acciones-competencias {
  width: 300px;
  min-width: 300px;
}

.col-nombre-equipo {
  width: 300px;
  min-width: 300px;
}

.col-nombre-integrante,
.col-apellido-integrante {
  width: 200px;
  min-width: 200px;
}

.col-centro-educativo {
  width: 400px;
  min-width: 400px;
}

.col-acciones-equipos {
  width: 165px;
  min-width: 165px;
}

.col-banner {
  width: 90px;
  min-width: 90px;
}

.col-fecha {
  width: 120px;
  min-width: 120px;
}

.col-estado {
  width: 95px;
  min-width: 95px;
}

.col-modalidad {
  width: 140px;
  min-width: 140px;
}

.col-turno {
  width: 120px;
  min-width: 120px;
}

.col-capitan {
  width: 85px;
  min-width: 85px;
}

.col-codigo {
  width: 105px;
  min-width: 105px;
}

.col-desc-criterio {
  width: 445px;
  min-width: 445px;
}

.col-w-criterio {
  min-width: 45px;
}

.col-w-80 {
  width: 80px;
}

.col-w-100 {
  width: 100px;
}

.col-w-110 {
  width: 110px;
}

.col-w-130 {
  width: 130px;
}

.col-w-250 {
  width: 250px;
}

/* Ancho mínimo de seguridad para tablas en contenedores responsivos */
.table-eval-min-w {
  min-width: 800px;
}

.table-jueces-min-w {
  min-width: 895px;
}

.table-equipos-min-w {
  min-width: 865px;
}

.table-integrantes-min-w {
  min-width: 550px;
}

.table-competencias-min-w {
  min-width: 1000px;
}

.table-criterios-min-w {
  min-width: 550px;
}

.table-ranking-min-w {
  min-width: 600px;
}

.table-estadisticas-min-w {
  min-width: 480px;
}

/* Badges y estados de tablas */
.badge-bronze {
  background-color: #cd7f32 !important;
  color: #ffffff !important;
}

.table-first-place {
  background-color: #64ff60 !important;
}

.table-second-place {
  background-color: #63d8fe !important;
}

.table-third-place {
  background-color: #eaa228 !important;
}

.claseTabla {
  font-weight: bold;
}

/* ==========================================================================
   Select2 Responsive & Fluid Adaptation
   ========================================================================== */
.select2-container {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
  width: 100% !important;
  min-height: 38px;
  box-sizing: border-box !important;
}

.select2-container--bootstrap-5.select2-container--focus,
.select2-container--bootstrap-5.select2-container--open {
  width: 100% !important;
}

.select2-dropdown {
  max-width: 100vw !important;
  box-sizing: border-box !important;
}