/* ============================================================
   DAI ZONA 8 — Capa visual «repotenciada»
   Glass · Glow · Bordes degradados
   Se carga DESPUÉS de app.css: solo refuerza, no reemplaza.
   ============================================================ */

:root {
  --glow-oro: 0 0 24px rgba(212, 175, 55, 0.35);
  --glow-oro-fuerte: 0 0 40px rgba(212, 175, 55, 0.55);
  --glow-azul: 0 0 28px rgba(0, 90, 190, 0.35);
  --cristal: rgba(255, 255, 255, 0.72);
  --cristal-borde: rgba(255, 255, 255, 0.55);
  --degradado-oro: linear-gradient(135deg, #f3d56d 0%, #d4af37 45%, #a97f11 100%);
}

body.dark-mode {
  --cristal: rgba(18, 26, 40, 0.72);
  --cristal-borde: rgba(212, 175, 55, 0.18);
}

/* ---------- Fondo vivo ---------- */
body {
  background-image:
    radial-gradient(60rem 40rem at 12% -10%, rgba(0, 90, 190, 0.10), transparent 60%),
    radial-gradient(50rem 34rem at 105% 8%, rgba(212, 175, 55, 0.10), transparent 55%);
  background-attachment: fixed;
}

body.dark-mode {
  background-image:
    radial-gradient(60rem 40rem at 12% -10%, rgba(0, 90, 190, 0.22), transparent 60%),
    radial-gradient(50rem 34rem at 105% 8%, rgba(212, 175, 55, 0.16), transparent 55%);
}

/* ---------- Navbar flotante de cristal ---------- */
.header {
  position: sticky;
  top: 0;
  background: var(--cristal);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--cristal-borde);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset,
              0 10px 30px rgba(0, 18, 51, 0.10);
}

/* Línea de luz inferior del navbar */
.header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(212, 175, 55, 0.9) 22%,
    rgba(0, 110, 220, 0.9) 55%,
    rgba(212, 175, 55, 0.9) 80%,
    transparent 100%);
  opacity: 0.85;
  filter: blur(0.3px);
}

.header h1 {
  background: linear-gradient(180deg, var(--azul-primario), var(--azul-secundario));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
body.dark-mode .header h1 {
  background: linear-gradient(180deg, #fff, #9fc3ef);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn-icon {
  border: 1px solid transparent;
  transition: var(--trans), box-shadow 0.3s ease;
}
.btn-icon:hover {
  border-color: rgba(212, 175, 55, 0.45);
  box-shadow: var(--glow-oro);
}

/* ---------- Tarjetas de cristal con borde degradado ---------- */
.tarjeta,
.tabla-container,
.metrica,
.panel-solicitud,
.modal-box {
  position: relative;
  background: var(--cristal);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--cristal-borde);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset,
              0 18px 40px rgba(0, 18, 51, 0.10);
}

/* Halo degradado detrás de las tarjetas */
.tarjeta::before,
.tabla-container::before,
.modal-box::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg,
    rgba(212, 175, 55, 0.55),
    rgba(0, 110, 220, 0.35) 45%,
    rgba(212, 175, 55, 0.15) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.7;
}

.metrica {
  transition: var(--trans), box-shadow 0.35s ease, transform 0.35s ease;
}
.metrica:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(0, 18, 51, 0.14), var(--glow-oro);
}
.metrica__valor {
  background: var(--degradado-oro);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 22px rgba(212, 175, 55, 0.25);
}

/* ---------- Botones con glow ---------- */
.btn-accion.primario {
  background: var(--degradado-oro);
  color: #1a1300;
  border: 0;
  box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
  transition: var(--trans), box-shadow 0.3s ease;
}
.btn-accion.primario:hover {
  box-shadow: 0 10px 28px rgba(212, 175, 55, 0.5), var(--glow-oro-fuerte);
  transform: translateY(-2px);
}

.btn-accion.mensaje:hover { box-shadow: 0 0 22px rgba(16, 185, 129, 0.45); }
.btn-accion.eliminar:hover { box-shadow: 0 0 22px rgba(239, 68, 68, 0.40); }

/* ---------- Tabs tipo píldora con brillo ---------- */
.admin-tabs {
  background: var(--cristal);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--cristal-borde);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}
.tab-link {
  position: relative;
  transition: var(--trans), box-shadow 0.3s ease;
}
.tab-link.active {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.75));
  box-shadow: 0 6px 18px rgba(0, 18, 51, 0.12), 0 0 18px rgba(212, 175, 55, 0.25);
}
body.dark-mode .tab-link.active {
  background: linear-gradient(180deg,
    rgba(212, 175, 55, 0.22),
    rgba(212, 175, 55, 0.08));
}

/* ---------- Tabla ---------- */
.tabla-pne thead th {
  background: linear-gradient(180deg,
    rgba(0, 40, 85, 0.06),
    rgba(0, 40, 85, 0.02));
  backdrop-filter: blur(6px);
}
.tabla-pne tbody tr {
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.tabla-pne tbody tr:hover td {
  background: rgba(212, 175, 55, 0.07);
}

/* ---------- Columna de selección ---------- */
.col-check {
  width: 42px;
  text-align: center;
  padding-inline: 10px !important;
}
.col-check input,
.chk-usuario {
  width: 17px;
  height: 17px;
  accent-color: var(--oro-institucional);
  cursor: pointer;
}

tr.fila-seleccionada td {
  background: rgba(212, 175, 55, 0.14) !important;
}
tr.fila-seleccionada td:first-child {
  box-shadow: inset 3px 0 0 var(--oro-institucional);
}

/* ---------- Barra de operaciones en lote (ARRIBA, fija al hacer scroll) ---------- */
.barra-lote {
  position: sticky;
  top: 0;
  z-index: 60;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #001233 0%, #002855 60%, #003a75 100%);
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow: 0 18px 45px rgba(0, 18, 51, 0.45), var(--glow-oro);
  animation: bajarLote 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bajarLote {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lote-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 13px;
}
.lote-info .material-symbols-outlined { color: var(--oro-institucional); }
.lote-info strong {
  color: var(--oro-institucional);
  font-size: 15px;
}

.lote-acciones { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-lote {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans), box-shadow 0.3s ease;
}
.btn-lote:hover {
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--oro-institucional);
  box-shadow: var(--glow-oro);
  transform: translateY(-1px);
}
.btn-lote .material-symbols-outlined { font-size: 17px; }
.btn-lote.cerrar {
  border-color: rgba(255, 255, 255, 0.18);
  padding-inline: 10px;
}
.btn-lote.cerrar:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* ---------- Selector de íconos ---------- */
.selector-icono {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-icono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.10);
  color: var(--oro-institucional);
  font-size: 24px;
  box-shadow: inset 0 0 14px rgba(212, 175, 55, 0.15);
}

.grilla-iconos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 4px;
}

.item-icono {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 6px;
  border-radius: 12px;
  border: 1px solid var(--borde-suave);
  background: var(--bg-main);
  color: var(--texto-oscuro);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: var(--trans), box-shadow 0.3s ease;
}
.item-icono:hover {
  border-color: var(--oro-institucional);
  box-shadow: var(--glow-oro);
  transform: translateY(-2px);
}
.item-icono.elegido {
  border-color: var(--oro-institucional);
  background: rgba(212, 175, 55, 0.14);
  box-shadow: var(--glow-oro);
}
.item-icono .material-symbols-outlined { font-size: 26px; }
.item-icono__nombre {
  font-size: 10px;
  line-height: 1.25;
  text-align: center;
  color: var(--texto-claro);
  word-break: break-word;
}

/* ============================================================
   ALINEACIÓN DE LISTADOS Y CAJAS DE SELECCIÓN
   ============================================================ */

/* --- Casillas: un solo estilo en toda la app --- */
input[type="checkbox"] {
  accent-color: var(--oro-institucional);
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  cursor: pointer;
}

/* --- Columnas de selección de la tabla --- */
.col-check input[type="checkbox"] {
  display: block;
  margin: 0 auto;
}

/* --- Vectores por usuario: rejilla simétrica --- */
.vectores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  grid-auto-rows: 1fr;
  gap: 5px;
  align-items: stretch;
  min-width: 132px;
}

/* La columna de vectores no debe crecer sin límite */
#tablaUsuarios td:nth-child(4) { max-width: 560px; }

.switch-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 5px 8px;
  min-height: 32px;
  border-radius: 8px;
  border: 1px solid var(--borde-suave);
  background: var(--bg-main);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.switch-container:hover {
  border-color: rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.06);
}

.switch-container .switch-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icono-vector {
  flex: 0 0 auto;
  font-size: 16px !important;
  color: var(--texto-claro);
}

/* --- Modal de ambientes en lote --- */
.lote-amb-cabecera {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.campo-lote {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campo-lote label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--texto-claro);
}

.campo-lote select,
.campo-lote input {
  width: 100%;
  min-width: 0;
}

.lote-amb-controles {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 2px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--borde-suave);
}

.btn-accion.boton--mini {
  padding: 5px 11px;
  font-size: 11px;
}

.lote-amb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding: 2px;
}

.amb-item {
  display: grid;
  grid-template-columns: 18px 24px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  min-height: 54px;
  border-radius: 10px;
  border: 1px solid var(--borde-suave);
  background: var(--bg-main);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.amb-item:hover {
  border-color: rgba(212, 175, 55, 0.55);
  box-shadow: var(--glow-oro);
}

.amb-item:has(input:checked) {
  border-color: var(--oro-institucional);
  background: rgba(212, 175, 55, 0.13);
}

.amb-item > .material-symbols-outlined {
  font-size: 20px;
  color: var(--oro-institucional);
  text-align: center;
}

.amb-item__texto {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.amb-item__texto strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--texto-oscuro);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amb-item__texto small {
  font-size: 10.5px;
  color: var(--texto-claro);
  font-family: ui-monospace, Consolas, monospace;
}

/* --- Pestaña Ambientes: tabla alineada --- */
#tablaAmbientes td:first-child,
#tablaAmbientes th:first-child { width: 96px; white-space: nowrap; }
#tablaAmbientes td:nth-child(3) { width: 70px; text-align: center; }
#tablaAmbientes td:nth-child(4) { width: 110px; }

@media (max-width: 700px) {
  .vectores-grid { grid-template-columns: 1fr; }
  .lote-amb-grid { grid-template-columns: 1fr; }
}

/* ---------- Detalles de pulido ---------- */
.input-busqueda:focus {
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}
.select-rol:focus { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }

.contador-badge {
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.6);
  animation: pulsoBadge 2.4s ease-in-out infinite;
}
@keyframes pulsoBadge {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.45); }
  50%      { box-shadow: 0 0 20px rgba(239, 68, 68, 0.85); }
}

/* Scrollbar dorada */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.75), rgba(169, 127, 17, 0.75));
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
}

/* Respeta a quien pide menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .barra-lote { animation: none; }
  .contador-badge { animation: none; }
  .metrica:hover,
  .btn-lote:hover,
  .item-icono:hover { transform: none; }
}

@media (max-width: 700px) {
  .barra-lote { border-radius: 14px; padding: 10px 12px; }
  .lote-acciones { width: 100%; }
  .btn-lote { flex: 1; justify-content: center; }
  .grilla-iconos { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}
