
:root {
  --primary: #23A6A6;
  --primary-dark: #1d8a8a;
  --secondary: #4ec49c;
  --success: #4caf50;
  --danger: #f44336;
  --warning: #ff9800;
  --light: #f8f9fa;
  --dark: #343a40;
  --gray: #6c757d;
  --border-radius: 16px;
  --shadow: 0 6px 20px rgba(0,0,0,0.08);
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #e0f7f4 0%, #c8f7c5 100%);
  color: #333;
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

.compras-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.titulo-principal {
  font-size: 2.2rem;
  color: var(--primary);
  margin: 0;
  font-weight: 700;
}

.subtitulo {
  color: var(--gray);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.agregar-pedido-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.form-agregar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  flex: 1;
  min-width: 300px;
}

.compras-input {
  flex: 1;
  padding: 0.9rem 1.2rem;
  font-size: 1.1rem;
  border: 2px solid #e0e0e0;
  border-radius: 50px;
  outline: none;
  transition: var(--transition);
}
.compras-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(35, 166, 166, 0.2);
}

@keyframes bounceIn {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.compras-btn-agregar {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.9rem 1.8rem;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.compras-btn-agregar:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-2px);
}
.compras-btn-agregar:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.compras-feedback {
  margin-top: 1rem;
  font-weight: 500;
  min-height: 1.5rem;
}

.pedidos-guardados {
  margin-top: 2rem;
}

.header-seccion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.titulo-seccion {
  font-size: 1.6rem;
  color: var(--dark);
  margin: 0;
}

.btn-limpiar {
  background: #ff6b6b;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.6rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-limpiar:hover {
  background: #e53935;
  transform: scale(1.03);
}

.lista-pedidos {
  display: grid;
  gap: 1.2rem;
}

.placeholder-vacio {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  text-align: center;
  color: var(--gray);
  background: linear-gradient(145deg, #f0fdfa, #e6fff8);
  border-radius: var(--border-radius);
  border: 2px dashed #a8f0e5;
  animation: pulseGlow 3s infinite;
}

@keyframes pulseGlow {
  0%, 100% { 
    box-shadow: 0 0 0 0 rgba(35, 166, 166, 0.1);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 0 8px rgba(35, 166, 166, 0.0);
    transform: scale(1.01);
  }
}
.placeholder-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.placeholder-text h3 {
  color: var(--primary);
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.placeholder-text p {
  margin: 0.5rem 0;
  max-width: 500px;
  line-height: 1.5;
}

.placeholder-text .highlight {
  background: rgba(35, 166, 166, 0.1);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  font-weight: 600;
  color: var(--primary-dark);
  margin-top: 0.8rem;
  animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes highlightUpdate {
  0% {
    box-shadow: 0 0 0 0 rgba(35, 166, 166, 0.4);
    transform: scale(1);
    background: #f0fdfa;
  }
  30% {
    box-shadow: 0 0 0 15px rgba(35, 166, 166, 0.2);
    transform: scale(1.02);
    background: #e6fff8;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(35, 166, 166, 0);
    transform: scale(1);
    background: white;
  }
}

.pedido-card.updated {
  animation: highlightUpdate 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
  position: relative;
  z-index: 10;
}

.pedido-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 1.2rem;
  align-items: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  position: relative;
}
.pedido-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.12);
}

.pedido-icono {
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-principal {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.header-pedido {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

.codigo-pedido {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
}

.tipo-entrega {
  font-weight: 500;
  color: var(--dark);
}

.fechas {
  font-size: 0.95rem;
  color: var(--gray);
}

.info-secundaria {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
}

.total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.acciones {
  display: flex;
  gap: 0.6rem;
}

.btn-detalle {
  background: var(--secondary);
  color: white;
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
}
.btn-detalle:hover {
  background: var(--primary);
  text-decoration: none;
}

.btn-eliminar {
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  font-weight: bold;
  color: #ff6b6b;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-eliminar:hover {
  background: rgba(255, 107, 107, 0.1);
  transform: scale(1.1);
}
@media (max-width: 768px) {
  .compras-container {
    padding: 0 1rem;
  }
  
  .form-agregar {
    flex-direction: column;
  }
  
  .pedido-card {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .info-secundaria {
    align-items: center;
  }
  
  .acciones {
    justify-content: center;
  }
}
@media (max-width: 480px) {
  .titulo-principal {
    font-size: 1.8rem;
  }
  
  .compras-input, .compras-btn-agregar {
    padding: 0.8rem;
    font-size: 1rem;
  }
}
.estado-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  z-index: 3;
}
.estado-entregado   { background: #4CAF50; } /* verde */
.estado-listo       { background: #FF9800; } /* naranja */
.estado-proceso     { background: #2196F3; } /* azul */
.estado-pendiente   { background: #FFEB3B; color: #7A7200; } /* amarillo oscuro */
.estado-cancelado   { background: #F44336; } /* rojo */
.estado-despachado  { background: #03A9F4; } /* azul claro */
.estado-otro        { background: #9E9E9E; }
.pedido-card {
  position: relative;
  padding-right: 85px;
}
@media (max-width: 768px) {
  .estado-tag {
    top: 8px;
    right: 8px;
    font-size: 0.75rem;
    padding: 3px 10px;
  }
  .pedido-card {
    padding-right: 60px;
  }
}
.error-servidor {
  margin-top: 2rem;
  text-align: center;
}
.error-servidor .alert {
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(244, 67, 54, 0.15);
}
.btn-outline-danger:hover {
  background: #f8d7da;
  border-color: #f5c6cb;
  color: #721c24;
}
.d-none { display: none !important; }

.badge-reciente {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background: #4CAF50;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 5;
  animation: bounceIn 0.8s ease-out;
}

@keyframes pulseBadge {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}