/* bom/style.css — Product Tree / Recipe BOM styles */

/* ── DISH CATALOG ── */
.bom-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Assistant', sans-serif;
  cursor: pointer;
  transition: all 0.14s;
}

.filter-btn:hover { border-color: var(--blue); color: var(--blue); }
.filter-btn.active { background: var(--navy); color: white; border-color: var(--navy); }

.dish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dish-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
}

.dish-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--blue);
}

.dish-image {
  height: 120px;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.dish-image img { width: 100%; height: 100%; object-fit: cover; }
.dish-image .placeholder-icon {
  font-size: 48px;
  color: var(--gray-300);
}

.dish-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }

.dish-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.dish-category-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--blue-light);
  color: #2563EB;
  width: fit-content;
}

.dish-cost-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.dish-cost { font-size: 15px; font-weight: 800; color: var(--navy); }
.dish-sale { font-size: 12px; color: var(--gray-400); }

.margin-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.margin-green  { background: var(--green-light);  color: #16A34A; }
.margin-orange { background: var(--orange-light);  color: #EA580C; }
.margin-red    { background: var(--red-light);     color: #DC2626; }

.dish-actions {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--gray-100);
  background: var(--gray-50);
}

.dish-actions .btn { flex: 1; justify-content: center; font-size: 12px; padding: 6px 8px; }

.no-dishes {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.no-dishes .material-symbols-outlined { font-size: 48px; display: block; margin-bottom: 12px; }

/* ── RECIPE BUILDER ── */
.recipe-page { display: flex; flex-direction: column; height: 100vh; width: 100%; overflow: hidden; }

.recipe-topbar {
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.recipe-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cost-display {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.recipe-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

#cy-canvas {
  flex: 1;
  height: 100%;
  background: var(--gray-50);
}

/* ── INGREDIENT SIDE PANEL ── */
.side-panel {
  width: 300px;
  min-width: 300px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  transform: translateX(300px);
  transition: transform 0.2s ease;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 10;
  overflow-y: auto;
}

.side-panel.open { transform: translateX(0); }

.side-panel-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.side-panel-title { font-size: 14px; font-weight: 800; color: var(--navy); }

.side-panel-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.side-panel-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.autocomplete-wrap { position: relative; }

.autocomplete-list {
  position: absolute;
  top: 100%;
  right: 0; left: 0;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
  z-index: 20;
  display: none;
  box-shadow: var(--shadow);
}

.autocomplete-list.open { display: block; }

.autocomplete-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.autocomplete-item:hover { background: var(--gray-50); }

.computed-cost-display {
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
}

/* ── RESPONSIVE ── */
@media (max-width: 820px) {
  .dish-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .recipe-topbar { gap: 6px; padding: 0 10px; }
  .recipe-title { font-size: 13px; }
  .side-panel {
    width: 100%;
    min-width: 0;
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    height: 65vh;
    transform: translateY(100%);
    border-right: none;
    border-top: 1px solid var(--gray-200);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .side-panel.open { transform: translateY(0); }
}

@media (max-width: 480px) {
  .dish-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
