/* ============================================================
   fixes.css — Correcciones técnicas Fase 1
   NO modifica el diseño visual original: solo agrega las
   variables CSS que el HTML original usaba sin definir.
   ============================================================ */

:root {
  /* Bug 4.1 del informe técnico: --amber y --amber-tint
     se usaban en main.css pero nunca se definieron en :root,
     dejando chips e íconos de alerta sin color. */
  --amber: #C6782B;
  --amber-tint: #FEF0DB;
}

/* Indicador de estado de conexión (modo offline básico).
   No afecta el layout original; se posiciona flotante. */
.conn-status {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 9999;
  font-family: 'Urbanist', sans-serif;
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  display: none;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
}
.conn-status.offline {
  display: inline-flex;
  background: var(--amber-tint);
  color: #8A5518;
  border: 1px solid var(--amber);
}
.conn-status.syncing {
  display: inline-flex;
  background: var(--teal-tint);
  color: var(--teal-deep);
  border: 1px solid var(--teal);
}


/* ============================================================
   Galería - Estilos Fase 2
   ============================================================ */
.gallery-thumb-wrap {
  position: relative;
  display: inline-block;
}

.gallery-thumb-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.storage-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255,255,255,0.9);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.gallery-delete-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.gallery-thumb-wrap:hover .gallery-delete-btn {
  opacity: 1;
}

.gallery-delete-btn:hover {
  background: rgba(185, 28, 28, 1);
  transform: scale(1.1);
}

/* Pie legal (© ... Plataforma segura con aislamiento de datos...) del
   menú lateral: se pide que quede debajo del menú de opciones (ya
   está ahí en el HTML, después de .side-foot), pero más chico y con
   fondo rojo. Sólo aplica al menú del sistema (#app-sidebar); la
   pantalla de inicio de sesión no tiene este elemento, así que queda
   igual sin necesidad de excluirla aparte. */
#app-sidebar .side-legal {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--red, #D10000);
  color: #FFFFFF;
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
  border-radius: 6px;
}

/* ------------------------------------------------------------
   Biblioteca: mapa de estantería (letra + número, ej. H1)
   ------------------------------------------------------------ */
.biblioteca-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}
.biblioteca-fila {
  display: flex;
  align-items: center;
  gap: 8px;
}
.biblioteca-fila-letra {
  width: 22px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft, #6b6b6b);
  text-align: center;
}
.biblioteca-fila-celdas {
  display: grid;
  grid-template-columns: repeat(10, minmax(48px, 1fr));
  gap: 5px;
  flex: 1;
}
.biblioteca-celda {
  border-radius: 6px;
  padding: 5px 3px;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.25;
  border: 1px solid var(--line, #E4E3E0);
  cursor: default;
  min-height: 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.biblioteca-celda.libre {
  background: var(--green, #3C8A5A);
  color: #000;
}
.biblioteca-celda.ocupada {
  background: var(--red, #D14343);
  color: #000;
  cursor: pointer;
  font-weight: 600;
}
.biblioteca-celda-cod {
  font-weight: 700;
}
.biblioteca-celda-item {
  font-size: 9.5px;
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .biblioteca-fila-celdas { grid-template-columns: repeat(5, minmax(40px, 1fr)); }
}
