/* ── Fase 3: Órdenes, Historial y Pagos ── */

/* ══ ESTADOS (BADGES) ═════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-creada { background: #f3f4f6; color: #4b5563; }       /* Gris */
.status-en_proceso { background: #eff6ff; color: #2563eb; }   /* Azul */
.status-por_revisar { background: #f5f3ff; color: #7c3aed; }  /* Morado */
.status-aprobada { background: #f0fdf4; color: #10b981; }     /* Verde */
.status-entregada { background: #fff7ed; color: #ea580c; }    /* Naranja */
.status-cancelada { background: #fef2f2; color: #dc2626; }    /* Rojo */
.status-devuelta { background: #fffbeb; color: #d97706; }     /* Ámbar */

/* ══ TIMELINE (HISTORIAL) ══════════════════════════════════ */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: #e5e7eb;
}
.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.85rem; top: 0.2rem;
  width: 0.75rem; height: 0.75rem;
  border-radius: 50%;
  background: #3b82f6;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e5e7eb;
}
.timeline-item.creacion::before { background: #10b981; }
.timeline-item.estado::before { background: #7c3aed; }
.timeline-item.asignacion::before { background: #f59e0b; }

.timeline-time {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.2rem;
}
.timeline-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.85rem;
}
.timeline-desc {
  font-size: 0.8rem;
  color: #4b5563;
  margin-top: 0.2rem;
}
.timeline-user {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ══ DETALLE OT (GRID) ═════════════════════════════════════ */
.ot-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.ot-detail-section {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid #f3f4f6;
}

.ot-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.ot-info-row {
  display: flex;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.ot-info-label {
  width: 120px;
  color: #6b7280;
  font-weight: 500;
}
.ot-info-value {
  flex: 1;
  color: #1f2937;
  font-weight: 600;
}

.action-bar {
  display: flex;
  gap: 0.5rem;
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

/* ══ FILTROS TABLA ═════════════════════════════════════════ */
.table-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
/* Estilos movidos a style.css */

.table-responsive {
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid #f3f4f6;
}

/* ══ PAGOS ═════════════════════════════════════════════════ */
.payment-status-Pagado { color: #10b981; font-weight: 600; }
.payment-status-Parcial { color: #f59e0b; font-weight: 600; }
.payment-status-Pendiente { color: #ef4444; font-weight: 600; }

/* ══ RESPONSIVE ════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ot-detail-grid { grid-template-columns: 1fr; }
  .table-filters { flex-direction: column; }
  
  .ot-info-row { flex-direction: column; gap: 0.2rem; }
  .ot-info-label { width: 100%; font-size: 0.75rem; }
  
  .ot-detail-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }

  /* Estado de Cuenta Responsividad */
  .payment-summary-grid { 
    grid-template-columns: 1fr !important; 
    gap: 1.5rem !important; 
    padding: 1rem !important;
  }
  
  .payment-summary-grid .stat-card {
    text-align: center !important;
    padding: 1rem !important;
  }
  
  .payment-summary-grid .stat-label {
    margin-bottom: 0.25rem !important;
    font-size: 0.75rem !important;
  }

  .payment-summary-grid .stat-value {
    font-size: 1.15rem !important;
  }
  
  .payment-header-grid {
    grid-template-columns: 1fr !important;
    row-gap: 0.5rem !important;
  }
  
  .payment-header-grid div:nth-child(odd) {
    margin-top: 0.5rem;
  }
}

/* ══ PRINT MEDIA QUERY ═════════════════════════════════════ */
@media print {
  body { background: #fff !important; margin: 0; padding: 0; }
  .sidebar, .topbar, .action-bar, #toastContainer, .mobile-header, .drawer-overlay { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .ot-detail-section { box-shadow: none !important; border: 1px solid #000 !important; margin-bottom: 1rem !important; break-inside: avoid; }
  .status-badge { border: 1px solid #000; color: #000 !important; background: transparent !important; }
}
