/* Estilos propios de aprobaciones.php (antes en un <style> inline de la página).
   Los componentes compartidos viven en assets/css/componentes.css. */

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 16px 18px;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.pending { background: #fef3c7; color: #d97706; }
.stat-icon.approved { background: #d1fae5; color: #059669; }
.stat-icon.rejected { background: #fee2e2; color: #dc2626; }
.stat-icon.time { background: #dbeafe; color: #2563eb; }

.stat-icon i { font-size: 24px; }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
}

.stat-label {
  font-size: 13px;
  color: var(--text-light);
}

/* Filters */
.filters-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.filters-row .form-select {
  max-width: 200px;
}

/* Requests List */
.requests-container {
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-height: 300px;
}

.requests-list {
  display: flex;
  flex-direction: column;
}

.request-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.2s;
}

.request-item:hover {
  background: var(--bg-light);
}

.request-item:last-child {
  border-bottom: none;
}

.request-urgency {
  width: 4px;
  height: 48px;
  border-radius: 2px;
  margin-right: 16px;
  flex-shrink: 0;
}

.request-urgency.low { background: #94a3b8; }
.request-urgency.medium { background: #f59e0b; }
.request-urgency.high { background: #f97316; }
.request-urgency.critical { background: #dc2626; }

.request-info {
  flex: 1;
  min-width: 0;
}

.request-title {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.request-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-light);
}

.request-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.request-meta i {
  font-size: 16px;
}

.request-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 16px;
}

.request-status.pending, .request-status.approved, .request-status.escalated { background: var(--bg-light); color: var(--text-dark); }
.request-status.rejected { background: var(--bg-light); color: #b91c1c; }
.request-status.cancelled { background: var(--bg-light); color: var(--text-light); }

.comments-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #2563eb;
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.comments-badge i {
  font-size: 14px;
}

.request-actions {
  display: flex;
  gap: 8px;
  margin-left: 16px;
}

.request-actions .btn {
  padding: 8px 16px;
  font-size: 13px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state i {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--text-dark);
}

.empty-state p {
  margin: 0;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

/* Detail Modal */
.modal-large {
  max-width: 700px;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-item label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-item span {
  font-size: 14px;
  color: var(--text-dark);
}

.detail-description {
  background: var(--bg-light);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.6;
}

.decision-history {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.decision-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
}

.decision-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.decision-icon.approved { background: #d1fae5; color: #059669; }
.decision-icon.rejected { background: #fee2e2; color: #dc2626; }
.decision-icon.escalated { background: #e0e7ff; color: #4f46e5; }
.decision-icon.skipped { background: #f1f5f9; color: #64748b; }

/* «Todos, en orden»: un paso por renglón (número, quién, cómo quedó y el detalle de la decisión) */
.pasos-ayuda { margin: 0 0 10px; font-size: 13px; color: var(--text-light); line-height: 1.5; }
.pasos-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.paso-aprobacion { display: grid; grid-template-columns: 70px 1fr auto; gap: 4px 12px; padding: 10px 12px; background: var(--bg-light); border-radius: var(--radius-sm); font-size: 14px; color: var(--text-dark); }
.paso-numero { font-size: 12px; color: var(--text-light); padding-top: 2px; }
.paso-quien { overflow-wrap: anywhere; }
.paso-estado { font-size: 13px; color: var(--text-light); white-space: nowrap; }
.paso-en_curso .paso-estado { color: var(--text-dark); font-weight: 600; }
.paso-detalle { grid-column: 2 / -1; font-size: 13px; color: var(--text-light); line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 560px) { .paso-aprobacion { grid-template-columns: 1fr; } .paso-detalle { grid-column: auto; } }
.detail-footer-nota { flex: 1; font-size: 13px; color: var(--text-light); line-height: 1.5; margin-right: auto; }

.decision-content {
  flex: 1;
}

.decision-content strong {
  display: block;
  margin-bottom: 4px;
}

.decision-content small {
  color: var(--text-light);
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: 12px;
}

/* Evidencias */
.evidencias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.evidencia-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-sm);
  color: #0369a1;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.2s;
}

.evidencia-link:hover {
  background: #e0f2fe;
}

.evidencia-link i {
  font-size: 16px;
}

/* Comentarios */
.comments-history {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.comment-entry {
  padding: 12px;
  border-radius: var(--radius-sm);
  max-width: 85%;
}

.comment-entry.from-requester {
  background: #dbeafe;
  align-self: flex-start;
  border-left: 3px solid #3b82f6;
}

.comment-entry.from-approver {
  background: #dcfce7;
  align-self: flex-end;
  border-right: 3px solid #22c55e;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.comment-header strong {
  font-size: 13px;
}

.comment-header small {
  font-size: 11px;
  color: var(--text-light);
}

.comment-entry p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.comment-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 12px;
  color: #0369a1;
}

.no-comments {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  padding: 20px;
}

.add-comment-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Pie de la lista: cuántas se ven y «Ver más» */
.requests-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-light);
}

/* Renglón del detalle que ocupa las dos columnas (aprobadores) */
.detail-item-ancho {
  grid-column: 1 / -1;
}

.detail-item small {
  font-size: 12px;
  color: var(--text-light);
}

/* Quitar el adjunto elegido para un comentario */
.btn-quitar-adjunto {
  background: none;
  border: 0;
  padding: 0;
  margin-right: 8px;
  font-size: 12px;
  color: var(--text-light);
  text-decoration: underline;
  cursor: pointer;
}

/* Aviso en la confirmación de rechazar el alta automática de un proveedor */
.decision-aviso { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-light); font-size: 13px; font-weight: 600; color: var(--text-dark); }
.decision-aviso[hidden] { display: none; }

/* Buscador de las listas (título, solicitante o proveedor) */
.filtro-texto-fila { margin-bottom: 12px; }
.filtro-texto-fila .form-input { width: 100%; max-width: 420px; }

/* Cancelar y reasignar: texto de ayuda de los diálogos y botones del pie del detalle */
.modal-ayuda { margin: 0 0 14px; font-size: 13px; color: var(--text-light); line-height: 1.5; }
.modal-ayuda[hidden] { display: none; }
.detail-footer-gestion { display: flex; gap: 8px; flex-wrap: wrap; margin-right: auto; order: -1; }
#reassign-from-group[hidden] { display: none; }
