/* ==========================================
   EXTENSIONS.CSS — LabCel v3.0 AddOns
   Pegar al final de styles.css
   Recoloreado a paleta neon negro / rojo / amarillo
   ========================================== */

/* ===== STOCK MODAL GRANDE ===== */
.stock-modal-box {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  width: 820px;
  max-width: 95vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), var(--glow-red);
}

.stock-modal-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  overflow: hidden;
}

.stock-sidebar {
  border-right: 1px solid var(--gray-100);
  overflow-y: auto;
  padding: 12px 0;
  background: var(--surface-alt);
}

.stock-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}

.stock-cat-item:hover { background: var(--gray-100); color: var(--gray-900); }
.stock-cat-item.active { background: var(--primary-light); color: var(--accent); border-left-color: var(--primary); font-weight: 600; }

.stock-cat-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--gray-200);
  color: var(--gray-500);
}

.stock-cat-item.active .stock-cat-count {
  background: var(--primary-light);
  color: var(--accent);
}

.stock-main-area {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.stock-main-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
}

.stock-item-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.stock-item-card:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-red);
  transform: translateY(-1px);
}

.stock-item-card.critical { border-color: var(--danger); }
.stock-item-card.low { border-color: var(--warning); }

.stock-item-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.stock-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
  margin-bottom: 10px;
}

.stock-qty-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.stock-qty-num {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--gray-900);
}

.stock-qty-label { font-size: 11px; color: var(--gray-400); }

.stock-item-bar {
  height: 4px;
  background: var(--gray-100);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.stock-item-bar-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

.stock-item-actions {
  display: flex;
  gap: 4px;
}

.stock-item-actions button { flex: 1; }

/* ===== STOCK DETAIL PANEL (inside modal) ===== */
.stock-detail-panel {
  background: var(--surface-alt);
  border-top: 1px solid var(--gray-100);
  padding: 14px 16px;
  display: none;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.stock-detail-panel.open { display: flex; }

.stock-detail-stat {
  text-align: center;
  min-width: 80px;
}

.stock-detail-stat .val { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.stock-detail-stat .lbl { font-size: 10px; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; }

/* ===== TECNICO PANEL (stats for technician view) ===== */
.tec-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tec-stat-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.tec-stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.tec-stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ===== PERFIL MODAL ===== */
.profile-modal-box {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--glow-red);
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
}

.profile-avatar-lg {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--primary);
  transition: all 0.2s;
}

.profile-avatar-lg:hover { transform: scale(1.05); box-shadow: var(--glow-red); }
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  border-radius: 50%;
  font-size: 12px;
  color: #ffffff;
  font-weight: 600;
}

.profile-avatar-lg:hover .profile-avatar-overlay { opacity: 1; }

.profile-name { font-size: 18px; font-weight: 600; margin-top: 10px; color: var(--gray-900); }
.profile-role { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.profile-superadmin {
  font-size: 11px;
  color: #0a0a0c;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 6px;
}

/* ===== HISTORIAL PANEL ===== */
.historial-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.historial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px 0;
}

.historial-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  transition: all 0.15s;
}

.historial-card:hover {
  border-color: var(--primary);
  box-shadow: var(--glow-red);
  transform: translateY(-2px);
}

.historial-img-wrap {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-100);
  overflow: hidden;
  position: relative;
}

.historial-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.historial-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 32px;
}

.historial-card-body { padding: 12px 14px; }
.historial-card-title { font-size: 13px; font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.historial-card-meta { font-size: 11px; color: var(--gray-400); display: flex; gap: 8px; flex-wrap: wrap; }
.historial-card-desc { font-size: 12px; color: var(--gray-600); margin-top: 6px; line-height: 1.5; }

.historial-card-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* QR Code area — fondo blanco intencional para que el QR sea escaneable */
.qr-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--gray-400);
}

.qr-mini {
  width: 36px;
  height: 36px;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  padding: 2px;
  background: #ffffff;
}

.qr-mini:hover { border-color: var(--primary); box-shadow: var(--glow-red); }

/* Modal historial agregar */
.historial-upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  color: var(--gray-500);
}

.historial-upload-zone:hover { border-color: var(--primary); background: var(--primary-light); color: var(--gray-800); }
.historial-upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.historial-upload-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-top: 10px;
  display: none;
}

/* QR modal — mismo criterio: fondo blanco reservado para el propio QR */
.qr-modal-box {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  width: 340px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--glow-yellow);
}

.qr-canvas-wrap {
  display: inline-block;
  background: #ffffff;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  margin: 16px auto;
}

/* ===== SUPERADMIN USUARIOS ===== */
.superadmin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #0a0a0c;
  letter-spacing: .05em;
}

.users-enhanced-table th:last-child,
.users-enhanced-table td:last-child { text-align: right; }

.btn-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--surface-alt);
  cursor: pointer;
  color: var(--gray-500);
  font-size: 13px;
  transition: all 0.12s;
}
.btn-icon:hover { background: var(--gray-100); color: var(--accent); border-color: var(--primary); }
.btn-icon.danger:hover { color: var(--danger); border-color: var(--danger); }

/* ===== SIDEBAR PROFILE CLICK ===== */
.sidebar-footer .user-info {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 4px;
  margin: -4px;
  transition: background 0.12s;
}
.sidebar-footer .user-info:hover { background: var(--gray-100); }
.sidebar-footer .user-info::after {
  content: '✎';
  font-size: 12px;
  color: var(--gray-400);
  margin-left: auto;
}

/* ===== LIVE BADGE ===== */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 5px;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.4); }
}

/* ===== PANEL HISTORIAL NAV ITEM ===== */
#nav-historial { }

/* ===== RESPONSIVE extras ===== */
@media (max-width: 900px) {
  .stock-modal-box { width: 98vw; }
  .stock-modal-body { grid-template-columns: 1fr; }
  .stock-sidebar { display: none; }
  .tec-stats-grid { grid-template-columns: 1fr 1fr; }
  .historial-grid { grid-template-columns: 1fr; }
}