/* ==========================================================================
   ESTILOS CORPORATIVOS AVÍCOLA SAN MARTÍN (VINOTINTO Y NEGRO)
   ========================================================================== */
.text-naranja { color: #97271C !important; }
.bg-naranja { background-color: #97271C !important; color: #ffffff !important; }

.btn-naranja {
  background-color: #97271C;
  color: #ffffff;
  border: none;
  transition: background-color 0.2s ease;
}
.btn-naranja:hover {
  background-color: #7a1f16; /* Tono vinotinto más oscuro al pasar el mouse */
  color: #ffffff;
}

/* ==========================================================================
   ESTILOS GENERALES Y TABLAS (DIARIO Y SEMANAL)
   ========================================================================== */
.lote-info-table th { 
  width: 220px; 
  background: #f8f9fa; 
  font-weight: 600; 
}

.tabla-scroll {
  max-height: 600px;
  overflow: auto;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  /* Evita que los bordes colapsados den problemas con el sticky */
  border-collapse: separate; 
  border-spacing: 0;
}

.table-fixed { 
  table-layout: fixed; 
  width: auto; 
  min-width: 100%; 
  border-collapse: separate; 
  border-spacing: 0; 
}

.table-fixed th,
.table-fixed td {
  padding: .22rem .25rem;
  vertical-align: middle;
  text-align: center;
  white-space: nowrap;
  /* Añadimos un borde base muy fino */
  border: 0.5px solid #dee2e6;
}

/* ==========================================================================
   CABECERA DOBLE PEGAJOSA Y COLORES
   ========================================================================== */

/* Clases base de color */
.th-black {
  background-color: #212529 !important; 
  color: #ffffff !important;
  font-weight: bold;
}
.th-orange {
  background-color: #97271C !important; /* Ahora es Vinotinto */
  color: #ffffff !important;
  font-weight: bold;
}

/* FILA 1 (Pegajosa arriba del todo) */
.tabla-scroll thead tr:first-child th {
  position: sticky; 
  top: 0; 
  z-index: 11;
  border-bottom: none !important;
}

/* Sombra proyectada hacia abajo para tapar hueco, según su color */
.tabla-scroll thead tr:first-child th.th-black {
  box-shadow: inset 0 -1px 0 #212529, 0 1px 0 #212529;
}
.tabla-scroll thead tr:first-child th.th-orange {
  box-shadow: inset 0 -1px 0 #97271C, 0 1px 0 #97271C; /* Sombra Vinotinto */
}

/* FILA 2 (Pegajosa justo debajo de la Fila 1) */
.tabla-scroll thead tr:nth-child(2) th {
  position: sticky; 
  /* Si ves un huequito entre la fila 1 y 2 al bajar, ajusta este 32px a 34px o 36px */
  top: 32px; 
  z-index: 10;
  border-top: none !important;
}

/* Sombra proyectada hacia arriba para fusionarse con la Fila 1 */
.tabla-scroll thead tr:nth-child(2) th.th-black {
  box-shadow: inset 0 1px 0 #212529;
}

/* ==========================================================================
   ESTILOS EXTRA E INPUTS
   ========================================================================== */
.table-fixed input {
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  height: 100%;
  min-height: 28px;
  text-align: center;
  font-size: .80rem;
  border-radius: 3px;
}

.table-fixed input:hover  { border-color: #adb5bd; background: #f9f9f9; }
/* Resalte al escribir: Fondo amarillito con borde vinotinto corporativo */
.table-fixed input:focus  { 
  outline: none; 
  background: #fff3cd !important; 
  border-color: #97271C; 
  box-shadow: 0 0 0 2px rgba(151, 39, 28, 0.2); /* Transparencia Vinotinto */
}
.table-fixed input.saved  { background: #d1e7dd !important; transition: background 0.3s; }
.table-fixed input.error  { background: #f8d7da !important; transition: background 0.3s; }

.filtro-bar { 
  display: flex; 
  align-items: center; 
  gap: .5rem; 
  margin-bottom: .75rem; 
  justify-content: flex-end; 
}

/* Triángulo rojo estilo comentario de Excel */
.indicador-excel {
  position: relative;
}
.indicador-excel::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 8px solid red;
  border-left: 8px solid transparent;
  pointer-events: none; /* Para no estorbar al hacer clic en el input */
}

/* Ocultar las flechas en los inputs de números para ganar espacio de lectura */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none; /* Propiedad estándar */
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield; /* Propiedad estándar */
}

/* =========================================
   OVERLAY DRAG & DROP (CARGA DE DATOS)
   ========================================= */
.drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
}

.drag-overlay.d-none {
    display: none !important;
}

.drag-content {
    text-align: center;
    border: 3px dashed #0d6efd;
    border-radius: 20px;
    padding: 60px 120px;
    background-color: rgba(13, 110, 253, 0.1);
    pointer-events: none;
}

.drag-icon {
    font-size: 100px;
    color: #0d6efd;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Ocultar el nombre de la empresa solo en móvil (< 992px) */
@media (max-width: 991.98px) {
  nav.navbar .navbar-brand span {
    display: none !important;
  }
}

/* Navbar compacto en todas las vistas (sin zoom: no rompe tooltips Plotly) */
nav.navbar { padding-top: 0.25rem; padding-bottom: 0.25rem; }
nav.navbar .navbar-brand img { height: 28px !important; }
nav.navbar .navbar-brand span { font-size: 0.8rem !important; }
nav.navbar .nav-link { font-size: 0.85rem; padding-top: 0.25rem; padding-bottom: 0.25rem; }

/* ==========================================================================
   TABLAS DE PRODUCCIÓN (1era semana, levante, diario, semanal, clasificación)
   Versión compacta: encabezados y datos más pequeños para ver más contenido.
   ========================================================================== */
.table-fixed { font-size: 0.72rem; }
.table-fixed th,
.table-fixed td { padding: 0.12rem 0.2rem; }
.table-fixed thead th { font-size: 0.6rem !important; line-height: 1.1; }
.table-fixed thead th.th-sub { font-size: 0.55rem !important; }
.table-fixed thead th[colspan] { font-size: 0.64rem !important; }
.table-fixed input {
  min-height: 22px;
  font-size: 0.72rem !important;
  padding: 0 0.2rem;
}

/* ==========================================================================
   GRÁFICOS DE PRODUCCIÓN
   Ficha del lote colapsable y pantalla completa (con la ficha visible)
   ========================================================================== */
.ps-toggle-franja {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text-secondary, #495057);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 0.16rem 0.5rem;
  cursor: pointer;
  white-space: nowrap;
}
.ps-toggle-franja:hover { background: var(--surface, #ffffff); border-color: #b9c6d6; }
.ps-toggle-franja i { font-size: 0.9rem; transition: transform 0.25s ease; }
.ps-toggle-franja.collapsed i { transform: rotate(-90deg); }

.card-grafico:fullscreen,
.card-grafico:-webkit-full-screen,
.card-grafico.pantalla-fs-fallback {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 0.7rem 1rem;
  background: var(--surface, #ffffff);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.card-grafico.pantalla-fs-fallback {
  position: fixed;
  inset: 0;
  z-index: 9990;
}
body.grafico-fs-abierta { overflow: hidden; }

.card-grafico:fullscreen .ps-grafico-titulo,
.card-grafico:-webkit-full-screen .ps-grafico-titulo,
.card-grafico.pantalla-fs-fallback .ps-grafico-titulo { flex: 0 0 auto; }

.card-grafico:fullscreen .ps-franja-fs,
.card-grafico:-webkit-full-screen .ps-franja-fs,
.card-grafico.pantalla-fs-fallback .ps-franja-fs {
  flex: 0 0 auto;
  margin-bottom: 0.55rem;
}

.card-grafico:fullscreen .card-body,
.card-grafico:-webkit-full-screen .card-body,
.card-grafico.pantalla-fs-fallback .card-body { flex: 1 1 auto; min-height: 0; }

.card-grafico:fullscreen #graficoPlotly,
.card-grafico:-webkit-full-screen #graficoPlotly,
.card-grafico.pantalla-fs-fallback #graficoPlotly {
  height: 100% !important;
  width: 100% !important;
}

.card-grafico:fullscreen .ps-toggle-franja,
.card-grafico:-webkit-full-screen .ps-toggle-franja,
.card-grafico.pantalla-fs-fallback .ps-toggle-franja { display: none; }

.grafico-fs-salir {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 10000;
  display: none;
  align-items: center;
  gap: 0.35rem;
  background: #97271C;
  color: #ffffff;
  border: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.grafico-fs-salir:hover,
.grafico-fs-salir:focus { background: #7a1f16; color: #ffffff; }
.card-grafico:fullscreen .grafico-fs-salir,
.card-grafico:-webkit-full-screen .grafico-fs-salir,
.card-grafico.pantalla-fs-fallback .grafico-fs-salir { display: inline-flex; }

/* Pantalla completa de las tablas de Producción */
.tabla-scroll:fullscreen,
.tabla-scroll:-webkit-full-screen,
.tabla-scroll.tabla-fs-fallback {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  padding: 0;
  background: var(--surface, #ffffff);
  border: 0 !important;
  border-radius: 0;
  box-shadow: none;
}
.tabla-scroll.tabla-fs-fallback {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
body.tabla-fs-abierta { overflow: hidden; }

.tabla-fs-salir {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 10000;
  display: none;
  align-items: center;
  gap: 0.35rem;
  background: #97271C;
  color: #ffffff;
  border: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
}
.tabla-fs-salir:hover,
.tabla-fs-salir:focus {
  background: #7a1f16;
  color: #ffffff;
}
.tabla-scroll:fullscreen .tabla-fs-salir,
.tabla-scroll:-webkit-full-screen .tabla-fs-salir,
.tabla-scroll.tabla-fs-fallback .tabla-fs-salir { display: inline-flex; }

/* ============================================================
   Pantalla completa de tablas y selector de lote
   ============================================================ */
/* Botonera de pantalla completa sobre cada tabla */
.cons-tabla-barra { display: flex; justify-content: flex-end; margin: 0.7rem 0 0.35rem; }
.cons-fs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #dfe3e8;
  background: #ffffff;
  color: #495057;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.34rem 0.6rem;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.cons-fs:hover { background: #f7f8fa; border-color: #cbd2da; color: #1d232a; }
.cons-fs:focus-visible { outline: 2px solid #97271c; outline-offset: 2px; }
.cons-fs i { font-size: 0.9rem; }

/* Pantalla completa de las tablas de consolidados */
.contenedor-matriz:fullscreen,
.contenedor-matriz:-webkit-full-screen,
.contenedor-matriz.tabla-fs-fallback {
  width: 100vw;
  height: 100vh;
  max-height: 100vh !important;
  border: 0 !important;
  border-radius: 0;
  background: #ffffff;
  padding: 0;
}
.contenedor-matriz.tabla-fs-fallback { position: fixed; inset: 0; z-index: 9999; }
.contenedor-matriz:fullscreen .tabla-fs-salir,
.contenedor-matriz:-webkit-full-screen .tabla-fs-salir,
.contenedor-matriz.tabla-fs-fallback .tabla-fs-salir { display: inline-flex; }

/* ============================================================
   Selector de lote propio (submenus por abreviatura)
   ============================================================ */
.lp { position: relative; }
.lp .lp-native { display: none; }

.lp-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 240px;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  background: #ffffff;
  color: #212529;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lp-trigger:hover { border-color: #cbd2da; }
.lp-trigger:focus-visible {
  outline: 0;
  border-color: #97271c;
  box-shadow: 0 0 0 3px rgba(151, 39, 28, 0.12);
}
.lp-valor {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.lp-valor.lp-placeholder { color: #8b96a2; font-weight: 400; }
.lp-chevron { font-size: 1.05rem; color: #6b7683; transition: transform 0.18s ease; }
.lp-trigger[aria-expanded="true"] .lp-chevron { transform: rotate(180deg); }

.lp-popover {
  position: fixed;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid #e4e7ec;
  border-radius: 14px;
  box-shadow: 0 24px 48px -20px rgba(16, 24, 40, 0.45), 0 2px 8px rgba(16, 24, 40, 0.06);
}
.lp-popover[hidden] { display: none; }

.lp-tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid #edf0f3; margin-bottom: 0.6rem; }
.lp-tab {
  flex: 1 1 50%;
  border: 0;
  background: transparent;
  color: #7b8794;
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.2rem 0.55rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.lp-tab.activo { color: #97271c; border-bottom-color: #97271c; }
.lp-cuenta {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b7683;
  background: #f1f3f5;
  border-radius: 999px;
  padding: 0.02rem 0.38rem;
  font-variant-numeric: tabular-nums;
}
.lp-tab.activo .lp-cuenta { background: #fbeae8; color: #97271c; }

.lp-buscar { position: relative; margin-bottom: 0.5rem; }
.lp-buscar i {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: #98a2b3;
  pointer-events: none;
}
.lp-buscar input {
  width: 100%;
  border: 1px solid #dfe3e8;
  background: #fbfcfd;
  border-radius: 9px;
  font-size: 0.76rem;
  padding: 0.42rem 0.55rem 0.42rem 1.85rem;
  color: #212529;
}
.lp-buscar input::placeholder { color: #9aa5b1; }
.lp-buscar input:focus {
  outline: 0;
  border-color: #97271c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(151, 39, 28, 0.1);
}

.lp-lista {
  flex: 1 1 auto;
  overflow-y: auto;
  border: 1px solid #edf0f3;
  border-radius: 10px;
  background: #fcfcfd;
  padding: 0.3rem;
  min-height: 90px;
  scrollbar-width: thin;
}
.lp-grupo + .lp-grupo { margin-top: 0.1rem; }
.lp-grupo-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.38rem 0.45rem;
  border-radius: 7px;
  cursor: pointer;
}
.lp-grupo-toggle:hover { background: #f3f5f7; }
.lp-grupo-toggle:focus-visible { outline: 2px solid #f2b8b0; outline-offset: 2px; }
.lp-grupo-nombre {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #495057;
}
.lp-grupo-cuenta {
  margin-left: auto;
  font-size: 0.7rem;
  color: #9aa5b1;
  font-variant-numeric: tabular-nums;
}
.lp-grupo-flecha { font-size: 0.95rem; color: #98a2b3; transition: transform 0.15s ease; }
.lp-grupo-toggle[aria-expanded="false"] .lp-grupo-flecha { transform: rotate(-90deg); }
.lp-grupo-body { padding-left: 0.5rem; }
.lp-grupo-body.oculto { display: none; }

.lp-opcion {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0.36rem 0.45rem;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
}
.lp-opcion:hover { background: #f3f5f7; }
.lp-opcion:focus-visible { outline: 2px solid #f2b8b0; outline-offset: 2px; }
.lp-opcion-nombre { font-size: 0.78rem; font-weight: 600; color: #212529; }
.lp-opcion-fecha {
  margin-left: auto;
  font-size: 0.7rem;
  color: #8b96a2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lp-check { font-size: 0.95rem; color: #97271c; opacity: 0; }
.lp-opcion.seleccionada { background: #fbeae8; }
.lp-opcion.seleccionada .lp-opcion-nombre { color: #97271c; }
.lp-opcion.seleccionada .lp-check { opacity: 1; }
.lp-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.lp-dot-trigger { width: 8px; height: 8px; }
.lp-dot-hyline { background: #4472c4; }
.lp-dot-lohmann { background: #ed7d31; }
.lp-dot-otro { background: #adb5bd; }
.lp-vacio { padding: 1rem; text-align: center; font-size: 0.74rem; color: #8b96a2; }

.lote-picker ~ button[type="submit"] {
  background: #212529;
  border-color: #212529;
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
}
.lote-picker ~ button[type="submit"]:hover,
.lote-picker ~ button[type="submit"]:focus {
  background: #97271c;
  border-color: #97271c;
}

/* Barra del filtro de lote */
.lot-filter-bar {
  background: #f8f9fb;
  border: 1px solid #edf0f3;
  border-radius: 12px;
  padding: 0.45rem 0.55rem;
}
.lot-filter-bar .form-label-design {
  margin: 0 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7b8794;
}

/* ==========================================================================
   RELLENO TIPO EXCEL (asa de arrastre en tablas editables)
   ========================================================================== */
.tabla-relleno-asa {
  position: fixed;
  width: 10px;
  height: 10px;
  display: none;
  background-color: #ffffff;
  border: 1.5px solid #1a202c;
  border-radius: 1px;
  transform: translate(-50%, -50%);
  cursor: crosshair;
  touch-action: none;
  z-index: 2000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.65);
}
.tabla-relleno-asa::after {
  content: "";
  position: absolute;
  inset: -9px; /* área táctil más amplia para tablet */
}
.tabla-scroll tbody td.celda-arrastre {
  outline: 2px solid #97271c !important;
  outline-offset: -2px;
}
html[data-bs-theme="dark"] .tabla-relleno-asa {
  background-color: #1e242b;
  border-color: #e8edf3;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}
html[data-bs-theme="dark"] .tabla-scroll tbody td.celda-arrastre {
  outline-color: #ff9d92 !important;
}
