/* Fondo general */
body {
  background: linear-gradient(120deg, #f5f7fa, #c3cfe2);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
}

/* Contenedor para ambas páginas */
.container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 30px 20px;
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
}

/* Títulos */
h1, h2 {
  text-align: center;
  color: #0d47a1;
  margin-bottom: 20px;
}

/* Texto intro en formularios */
.intro {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 20px;
}

/* Formularios */
.formulario label {
  display: block;
  margin-top: 15px;
  font-weight: bold;
  color: #333;
}

.formulario input[type="text"],
.formulario input[type="email"],
.formulario input[type="number"],
.formulario select,
.formulario textarea {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
  transition: border 0.3s;
}

.formulario input:focus {
  border-color: #1976d2;
  outline: none;
}

/* Botón principal */
.formulario button,
.entregar-btn {
  margin-top: 25px;
  padding: 12px 20px;
  font-size: 16px;
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.formulario button:hover,
.entregar-btn:hover {
  background-color: #0d47a1;
}

/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 30px;
  text-align: left;
  font-size: 0.95rem;
}

thead th {
  background-color: #1565c0;
  color: white;
  padding: 10px;
  text-align: center;
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}

/* Fila marcada como entregada */
.entregado {
  background-color: #e8f5e9 !important;
  transition: background-color 0.3s ease;
}

.entregado:hover {
  background-color: #d0e9d0 !important;
}

.entregado .estado {
  color: #2e7d32;
  font-weight: bold;
}

/* Botón entregar dentro de tabla */
.entregar-btn {
  background-color: #d32f2f;
  padding: 8px 12px;
  font-size: 14px;
  margin: 5px 0;
}

.entregar-btn:disabled {
  background-color: #4caf50;
  cursor: default;
}

/* Estilos para la sección de productos */
.productos {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columnas por fila */
  gap: 20px;
  padding: 20px;
}

.producto-card {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  text-align: center;
  padding: 15px;
  transition: transform 0.2s;
  position: relative;
  overflow: hidden;
}

.producto-card:hover {
  transform: scale(1.02);
}

.producto-card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 10px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  background-color: #f5f5f5;
  transition: transform 0.3s ease;
}

.producto-card img:hover {
  transform: scale(3);
  z-index: 10;
}

.producto-card label {
  display: block;
  margin: 10px 0 5px;
  font-weight: bold;
}

.producto-card input {
  width: 80%;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* Estilos para la página de confirmación */
.confirmacion-datos {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin: 20px 0;
}

.confirmacion-datos h2, .confirmacion-datos h3 {
  color: #0d47a1;
  border-bottom: 1px solid #ddd;
  padding-bottom: 10px;
}

.estado-pedido .entregado {
  color: #4caf50;
  font-weight: bold;
}

.estado-pedido .pendiente {
  color: #ff9800;
  font-weight: bold;
}

.botones-finales {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.botones-finales button {
  padding: 12px 20px;
  font-size: 16px;
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.3s ease;
  margin-top: 10px;
}

.botones-finales button:hover {
  background-color: #0d47a1;
}

/* Estilos mejorados para ver_pedidos.php */
.table-responsive {
  overflow-x: auto;
  margin-top: 20px;
}

.table-controls {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  gap: 10px;
}

.search-box input {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  min-width: 250px;
}

.search-box button {
  padding: 8px 15px;
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.search-box button:hover {
  background-color: #0d47a1;
}

.tabla-pedidos {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.tabla-pedidos th {
  background-color: #1565c0;
  color: white;
  padding: 12px;
  text-align: left;
  position: sticky;
  top: 0;
}

.tabla-pedidos td {
  padding: 10px;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}

.tabla-pedidos tr:hover {
  background-color: #f5f5f5;
}

.tabla-pedidos .entregado {
  background-color: #e8f5e9;
}

.tabla-pedidos .entregado:hover {
  background-color: #d0e9d0;
}

.estado {
  font-weight: bold;
  text-transform: capitalize;
}

.entregar-btn {
  padding: 8px 12px;
  font-size: 14px;
  background-color: #d32f2f;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.entregar-btn:disabled {
  background-color: #4caf50;
  cursor: default;
}

.entregar-btn:hover:not(:disabled) {
  background-color: #b71c1c;
}

.error {
  color: #d32f2f;
  font-weight: bold;
  text-align: center;
  padding: 20px !important;
}

.empty {
  text-align: center;
  font-style: italic;
  color: #666;
  padding: 20px !important;
}

.alert {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 5px;
  color: white;
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.alert-success {
  background-color: #4caf50;
}

.alert-error {
  background-color: #f44336;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1200px) {
  .productos {
    grid-template-columns: repeat(3, 1fr); /* 3 columnas en pantallas medianas */
  }
}

@media (max-width: 900px) {
  .productos {
    grid-template-columns: repeat(2, 1fr); /* 2 columnas en tablets */
  }
}

@media (max-width: 768px) {
  .formulario {
    padding: 20px;
  }

  table, thead, tbody, th, td, tr {
    font-size: 0.85rem;
  }

  h1, h2 {
    font-size: 1.4rem;
  }

  .table-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .search-box {
    width: 100%;
  }
  
  .search-box input {
    width: 100%;
    min-width: auto;
  }
  
  .tabla-pedidos {
    font-size: 0.85rem;
  }
  
  .tabla-pedidos th, 
  .tabla-pedidos td {
    padding: 8px 5px;
  }
  
  .entregar-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .productos {
    grid-template-columns: 1fr; /* 1 columna en móviles */
  }
  
  .botones-finales {
    flex-direction: column;
  }
}