/* ==================== */
/* PANEL DE ADMINISTRACIÓN */
/* ==================== */


/* Reset básico */
* {
  box-sizing: border-box;
}

/* Botones base */
.btn {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: #1a252f;
  transform: scale(1.02);
}

.btn-edit {
  background: #f39c12;
  color: white;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.btn-edit:hover {
  background: #e67e22;
}

.btn-danger {
  background: var(--accent);
  color: white;
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-block {
  width: 100%;
  margin-top: 1rem;
  font-size: 1rem;
  padding: 0.8rem;
  font-weight: 600;
}

/* Formularios */
.form-control {
  width: 100%;
  padding: 0.8rem;
  margin: 0.5rem 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Formulario de Admin */
.admin-form .form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-form .form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-form .form-group label {
  font-size: 0.9rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Contenedor de filtro */
.filter-container {
  margin-bottom: 1.5rem;
}

.filter-container select {
  width: 100%;
  max-width: 300px;
  padding: 0.6rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  color: var(--dark);
}

/* Lista de productos */
.product-list {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.product-item:hover {
  transform: translateX(4px);
}

.product-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.product-info img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
}

.product-info h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--primary);
}

.product-info p {
  margin: 0;
  color: var(--secondary);
  font-weight: 500;
}

.product-info small {
  color: #666;
  font-size: 0.9rem;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.stock-input {
  width: 80px;
  padding: 0.4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.stock-input:focus {
  border-color: var(--secondary);
  outline: none;
}

/* Alerta de stock bajo */
.alert-stock {
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: #856404;
}

.alert-stock h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.alert-stock ul {
  margin: 0;
  padding-left: 1.2rem;
}

.alert-stock li {
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

/* Gráfico */
.chart-container {
  margin: 1.5rem 0;
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 300px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 300px;
  max-height: 300px;
}

/* Modales (compartidos) */
.modal,
.modal-edit {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal[style*="flex"],
.modal-edit[style*="flex"] {
  display: flex;
}

/* Contenido del modal */
.modal-content,
.modal-content-edit {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn 0.4s forwards;
}

@keyframes slideIn {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Cerrar */
.close,
.close-edit {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: #aaa;
}

.close:hover,
.close-edit:hover {
  color: #000;
}

/* Títulos en modales */
.modal-content h3,
.modal-content-edit h3 {
  margin-bottom: 1.5rem;
  color: var(--primary);
  font-size: 1.4rem;
}

/* Previsualización de imagen */
#edit-image-preview img,
#preview-image,
.image-item img {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-form .form-row {
    flex-direction: column;
  }

  .product-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .product-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .stock-input {
    width: 100px;
  }

  .filter-container select {
    width: 100%;
  }

  .modal-content,
  .modal-content-edit {
    width: 95%;
    padding: 1.5rem;
    max-width: 480px;
  }
}