body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f5f5f5;
}

header {
  background: #222;
  color: #fff;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header a {
  color: #fff;
  text-decoration: none;
  margin-left: 12px;
}

.grid-productos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 16px;
}

.producto-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
}

.producto-imagen {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
}

.producto-imagen img {
  max-width: 100%;
  max-height: 100%;
}

.placeholder-img {
  color: #666;
  font-size: 14px;
}

.precio {
  font-weight: bold;
  margin-top: 4px;
  margin-bottom: 8px;
}

button {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: #007bff;
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: #0056b3;
}

/* Carrito */
.carrito-main {
  padding: 16px;
}

.tabla-carrito {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.tabla-carrito th,
.tabla-carrito td {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
}

.tabla-carrito th {
  background: #f0f0f0;
}

.carrito-total {
  margin-top: 16px;
  text-align: right;
}

.form-inline {
  display: flex;
  gap: 4px;
}

.form-inline input[type="number"] {
  width: 60px;
}
/* Botones tipo link en el header */
.btn-link {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  margin-left: 8px;
  text-decoration: underline;
  font-size: 0.95rem;
}

.btn-link:hover {
  text-decoration: none;
}

/* Badge de usuario */
.user-badge {
  margin-left: 12px;
  font-weight: bold;
}

/* ---------- Modales ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 8px;
  max-width: 400px;
  width: 100%;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.form-modal label {
  display: block;
  margin-bottom: 8px;
}

.form-modal input {
  width: 100%;
  padding: 6px;
  margin-top: 4px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.form-modal button {
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  border: none;
  background: #28a745;
  color: #fff;
  cursor: pointer;
}

.form-modal button:hover {
  background: #218838;
}
.error-msg {
  background: #f8d7da;
  color: #842029;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  border: 1px solid #f5c2c7;
}

.btn-primary {
  display: inline-block;
  padding: 8px 14px;
  background: #28a745;
  color: #fff;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary:hover {
  background: #218838;
}

.btn-secondary {
  display: inline-block;
  padding: 8px 14px;
  background: #6c757d;
  color: #fff;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #5a6268;
}

.success-msg {
  background: #d1e7dd;
  color: #0f5132;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid #badbcc;
}

.info-msg {
  background: #cff4fc;
  color: #055160;
  padding: 8px;
  border-radius: 6px;
  margin-top: 8px;
}

.orden-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  margin-bottom: 16px;
}
