* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  background: #f6f7f9;
  color: #1a1a1a;
}
header {
  background: #16213e;
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { margin: 0; font-size: 20px; }
header button {
  background: #0f9d58;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
header button:hover { background: #0c7a45; }

#addForm, #productsSection {
  max-width: 1000px;
  margin: 20px auto;
  padding: 16px 24px;
}
#addForm h2, #productsSection h2 { font-size: 16px; margin-bottom: 12px; }

#productForm {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: white;
  padding: 16px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
#productForm input {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  flex: 1 1 180px;
}
#productForm button {
  background: #16213e;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
}
#formStatus { font-size: 13px; color: #666; margin-top: 8px; }

#productsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.product-card {
  background: white;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: transform 0.1s;
}
.product-card:hover { transform: translateY(-2px); }
.product-card h3 {
  font-size: 14px;
  margin: 0 0 8px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card .price {
  font-size: 22px;
  font-weight: 700;
  color: #0f9d58;
}
.product-card .meta {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
}
.promo-badge {
  display: inline-block;
  background: #e11d48;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}
.original-price {
  font-size: 13px;
  color: #999;
  text-decoration: line-through;
  vertical-align: middle;
}
.product-card .error {
  font-size: 12px;
  color: #c0392b;
  margin-top: 6px;
}
.product-card .delete-btn {
  float: right;
  background: none;
  border: none;
  color: #c0392b;
  cursor: pointer;
  font-size: 12px;
}
.product-card .edit-btn {
  float: right;
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 12px;
  margin-right: 8px;
}
#cancelEditBtn {
  background: #999;
}
.hidden { display: none !important; }

#modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal.hidden { display: none; }
.modal-content {
  background: white;
  border-radius: 10px;
  padding: 20px;
  width: 90%;
  max-width: 700px;
  position: relative;
}
#closeModal {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
}
