/* public/style.css */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
  margin: 0;
  padding: 0;
  background: #f8f9fa;
  color: #222;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
h1 {
  color: #1a1a1a;
  text-align: center;
  margin-bottom: 25px;
  font-size: 2.2rem;
  font-weight: 700;
}

/* Caja de búsqueda */
.search-box {
  display: flex;
  gap: 12px;
  max-width: 700px;
  margin: 0 auto 30px;
  background: white;
  padding: 8px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 24px;
  font-size: 1.1rem;
  border-radius: 50px;
}

.search-box button {
  background: #e63939;
  color: white;
  border: none;
  padding: 0 32px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.search-box button:hover {
  background: #c11212;
  transform: translateY(-2px);
}

.search-box button:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Filtros */
.filters {
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 25px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.filters h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.3rem;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filter-row label {
  font-weight: 600;
  white-space: nowrap;
}

.filter-row input[type="number"] {
  width: 110px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.store-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 15px;
  cursor: pointer;
  font-weight: 500;
}

/* ==================== RESULTADOS Y PRODUCTOS ==================== */
.results {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.product-group {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-group:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.product-group h3 {
  background: #f1f3f5;
  margin: 0;
  padding: 18px 22px;
  font-size: 1.25rem;
  color: #1a1a1a;
  border-bottom: 1px solid #eee;
}

/* Botón Crear Alerta por producto */
.btn-alert {
  background: #ffffff;
  color: #1a73e8;
  border: 2px solid #1a73e8;
  padding: 10px 20px;
  margin: 0 22px 15px 22px;
  border-radius: 50px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-alert:hover {
  background: #1a73e8;
  color: white;
  transform: translateY(-2px);
}

/* Ofertas */
.offers {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.offer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #f8f9fa;
  border-radius: 12px;
  transition: background 0.2s;
}

.offer:hover {
  background: #eef1f5;
}

.source {
  font-weight: 600;
  color: #e63939;
  min-width: 110px;
}

.price {
  font-size: 1.35rem;
  font-weight: 700;
  color: #222;
}

a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
  padding: 8px 20px;
  border: 2px solid #1a73e8;
  border-radius: 50px;
  transition: all 0.2s;
}

a:hover {
  background: #1a73e8;
  color: white;
}

/* ==================== CAJA DE ALERTA (por producto) ==================== */
.alert-box {
  background: #f0f7ff;
  border: 2px solid #1a73e8;
  border-radius: 16px;
  padding: 20px;
  margin: 0 22px 22px 22px;
  box-shadow: 0 4px 15px rgba(26, 115, 232, 0.12);
}

.alert-box h3 {
  margin: 0 0 12px 0;
  color: #1a73e8;
  font-size: 1.25rem;
}

.alert-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.alert-form input {
  padding: 12px 16px;
  border: 1px solid #a0c4ff;
  border-radius: 10px;
  font-size: 1rem;
  flex: 1;
  min-width: 180px;
}

.alert-form button {
  background: #1a73e8;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.alert-form button:hover:not(:disabled) {
  background: #1557b0;
  transform: translateY(-1px);
}

.alert-form button:disabled {
  background: #888;
  cursor: not-allowed;
}

.alert-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 500;
  background: #e6f4ea;
  color: #137333;
}

.alert-status-verified {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 500;
  background-color: #d4edda;
  color: #155724;
  text-align: center;
  margin-bottom: 20px;
}

.alert-form input, .alert-form select {
  padding: 12px 16px;
  border: 1px solid #a0c4ff;
  border-radius: 10px;
  font-size: 1rem;
  flex: 1;
  min-width: 180px;
  background-color: white; /* Añadido para que el select tenga fondo blanco */
}

.help-text {
  font-size: 0.85em; 
  color: #666; 
  margin-top: 10px;
}

/* Botón limpiar filtros */
.btn-clear {
  background: #6c757d;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 0.95rem;
}

.btn-clear:hover {
  background: #5a6268;
}

/* Error general */
.error {
  background: #fee;
  color: #c11212;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  margin: 20px auto;
  max-width: 600px;
}

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 15px; }

  .search-box {
    flex-direction: column;
    border-radius: 20px;
    padding: 12px;
  }

  .search-box button { padding: 14px; }

  .alert-form {
    flex-direction: column;
    align-items: stretch;
  }

  .product-group h3 { 
    font-size: 1.15rem; 
    padding: 16px; 
  }
}

/* ==================== MODAL FLOTANTE ==================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px 32px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
  position: relative;
  direction: ltr;
  text-align: left;
}

.modal-content input {
  direction: ltr;
  text-align: left;
}

.modal-content input[type="email"],
.modal-content input[type="number"] {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: embed !important;
}

.modal-content h3 {
  margin: 0 0 16px 0;
  color: #1a73e8;
  font-size: 1.35rem;
}

.modal-close {
  margin-top: 15px;
  width: 100%;
}

/* ==================== PANEL DE GESTIÓN ==================== */
.management-panel {
  background: white;
  border-radius: 16px;
  padding: 30px;
  margin-top: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #eef1f5;
}

.management-panel h2 {
  margin-top: 0;
  color: #1a73e8;
  border-bottom: 2px solid #f8f9fa;
  padding-bottom: 10px;
}

.management-search {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.management-search input {
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  flex: 1;
}

/* Ajuste para los items dentro de la gestión */
.management-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .modal-content {
    padding: 24px 20px;
    max-width: 95%;
  }
}

.badge-count {
  float: right;
  font-size: 0.8rem;
  background: #e63939;
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
}
