/* IA Scraping View Styles - Homologado al UX del dashboard */

.scraping-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.scraping-fecha {
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
}

.scraping-categorias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.scraping-categoria-card {
  background: var(--panel-background, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.scraping-categoria-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border-color: var(--accent-color, #4857ce);
}

.scraping-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.scraping-card-header h3 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-primary, #f1f5f9);
}

.scraping-semaforo {
  font-size: 2rem;
}

.scraping-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.scraping-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scraping-metric-label {
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
}

.scraping-metric-value {
  font-weight: 600;
  font-size: 1.1rem;
}

.scraping-metric-value.success { color: #10b981; }
.scraping-metric-value.warning { color: #f59e0b; }
.scraping-metric-value.danger { color: #ef4444; }

/* Panel de detalle */
#scrapingDetallePanel {
  position: fixed;
  top: 0;
  right: -100%;
  width: 60%;
  max-width: 800px;
  height: 100vh;
  background: var(--panel-background, #1e293b);
  box-shadow: -4px 0 12px rgba(0,0,0,0.4);
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

#scrapingDetallePanel.visible {
  right: 0;
}

.scraping-detalle-header {
  position: sticky;
  top: 0;
  background: var(--accent-color, #4857ce);
  color: white;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.scraping-detalle-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.scraping-productos-lista {
  padding: 1.5rem;
}

.scraping-producto-item {
  display: grid;
  grid-template-columns: 50px 100px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #334155);
  transition: background 0.2s;
}

.scraping-producto-item:hover {
  background: rgba(255,255,255,0.05);
}

.scraping-producto-item.es-mlg {
  background: rgba(59, 130, 246, 0.1);
}

.producto-posicion {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent-color, #4857ce);
  text-align: center;
}

.producto-imagen {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
}

.producto-info h4 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary, #f1f5f9);
  line-height: 1.3;
}

.producto-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.badge-mlg {
  background: #10b981;
  color: white;
}

.badge-competencia {
  background: #6b7280;
  color: white;
}

.badge-oferta {
  background: #f59e0b;
  color: white;
}

.producto-precio {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.precio-original {
  text-decoration: line-through;
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
}

.precio-actual {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary, #f1f5f9);
}

.precio-descuento {
  background: #ef4444;
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Botones de acciones en header */
.scraping-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.scraping-actions button {
  white-space: nowrap;
}

/* Notificación de scraping en proceso */
.scraping-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--panel-background, #1e293b);
  border: 2px solid var(--accent-color, #4857ce);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 10000;
  min-width: 320px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.scraping-notification-content {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.scraping-notification strong {
  color: var(--text-primary, #f1f5f9);
  font-size: 1rem;
  display: block;
  margin-bottom: 0.5rem;
}

.scraping-notification p {
  color: var(--text-muted, #94a3b8);
  font-size: 0.9rem;
  margin: 0.25rem 0;
}

.scraping-notification-hint {
  font-size: 0.8rem !important;
  font-style: italic;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-color, #4857ce);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Ajustar alineación de botones en header scraping */
.scraping-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 2rem;
}

.scraping-header > div:first-child {
  flex: 1;
}

.scraping-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.scraping-actions button {
  white-space: nowrap;
  min-width: auto;
  padding: 0.625rem 1rem;
}
