/* =============================================================
   CREATIVE TOOLS — Chef's Brain + Assembly Simulator
   ============================================================= */

/* ============================================================= */
/* 1. CHEF'S BRAIN — Flavor Pairing Generator                    */
/* ============================================================= */

.cb-selected-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(197, 165, 90, 0.08) 0%, rgba(60, 31, 14, 0.04) 100%);
  border: 1px solid rgba(197, 165, 90, 0.2);
  border-radius: var(--radius);
  animation: fadeUp 0.3s ease-out;
}

.cb-selected-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.1));
}

.cb-selected-card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
}

.cb-selected-price {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Pairings Grid */
.cb-pairings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.2rem;
}

.cb-pairing-card {
  position: relative;
  padding: 1rem;
  background: var(--surface);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  user-select: none;
}

.cb-pairing-card:hover {
  border-color: rgba(197, 165, 90, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(60, 31, 14, 0.08);
}

.cb-pairing-card.selected {
  border-color: var(--gold);
  background: rgba(197, 165, 90, 0.06);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.cb-pairing-card .cb-pair-icon {
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
  display: block;
  transition: transform 0.3s ease;
}

.cb-pairing-card:hover .cb-pair-icon {
  transform: scale(1.2) rotate(-5deg);
}

.cb-pairing-card .cb-pair-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  display: block;
  margin-bottom: 0.2rem;
}

.cb-pairing-card .cb-pair-price {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cb-pairing-card .cb-pair-harmony {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--success-light);
  color: var(--success);
}

.cb-pairing-card .cb-pair-harmony.medium {
  background: var(--warning-light);
  color: var(--warning);
}

.cb-pairing-card .cb-pair-harmony.bold {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}

/* Category label */
.cb-pairing-category-label {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.5rem 0 0.2rem;
  border-bottom: 1px solid var(--surface-border);
  margin-top: 0.5rem;
}

.cb-pairing-category-label:first-child {
  margin-top: 0;
}

/* Cost Panel */
.cb-cost-panel {
  margin-top: 1.5rem;
  padding: 1.2rem;
  background: linear-gradient(135deg, rgba(197, 165, 90, 0.05) 0%, rgba(39, 174, 96, 0.05) 100%);
  border: 1px solid rgba(197, 165, 90, 0.15);
  border-radius: var(--radius);
  animation: fadeUp 0.4s ease-out;
}

.cb-cost-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.cb-cost-header span {
  font-size: 1.3rem;
}

.cb-cost-header h4 {
  margin: 0;
  font-size: 1rem;
  font-family: var(--font-display);
}

.cb-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  border-bottom: 1px dashed var(--surface-border);
}

.cb-cost-row:last-child {
  border-bottom: none;
  font-weight: 800;
  font-size: 1rem;
  color: var(--gold-dark);
  padding-top: 0.8rem;
  margin-top: 0.3rem;
  border-top: 2px solid var(--gold);
}

.cb-cost-row .cb-cost-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cb-cost-row .cb-cost-value {
  font-weight: 700;
  font-family: var(--font);
}

.cb-cost-verdict {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.cb-cost-verdict.profitable {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(39, 174, 96, 0.2);
}

.cb-cost-verdict.warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(243, 156, 18, 0.2);
}

.cb-cost-verdict.danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(231, 76, 60, 0.2);
}

/* No results */
.cb-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.cb-empty-state .cb-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.5;
}

/* ============================================================= */
/* 2. ASSEMBLY SIMULATOR — Entremets Builder                     */
/* ============================================================= */

.assembly-workspace {
  display: flex;
  gap: 1.5rem;
  flex: 1;
  overflow: hidden;
}

/* Palette */
.assembly-palette {
  width: 220px;
  flex-shrink: 0;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.assembly-palette h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  color: var(--text);
}

.assembly-palette-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.assembly-palette-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-sm);
  cursor: grab;
  transition: all 0.25s ease;
  user-select: none;
  font-size: 0.85rem;
}

.assembly-palette-item:hover {
  border-color: var(--gold);
  background: rgba(197, 165, 90, 0.05);
  transform: translateX(4px);
}

.assembly-palette-item:active {
  cursor: grabbing;
  opacity: 0.7;
  transform: scale(0.95);
}

.assembly-palette-item .asm-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.assembly-palette-item .asm-info {
  flex: 1;
  min-width: 0;
}

.assembly-palette-item .asm-name {
  font-weight: 700;
  font-size: 0.8rem;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assembly-palette-item .asm-height {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Canvas area */
.assembly-canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}

.assembly-mold-selector {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.assembly-mold-selector label {
  text-transform: none;
  font-size: 0.9rem;
}

.assembly-canvas {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  min-height: 350px;
  max-height: 450px;
  background:
    radial-gradient(circle at 50% 100%, rgba(197, 165, 90, 0.04) 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(0,0,0,0.03) 19px, rgba(0,0,0,0.03) 20px),
    repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(0,0,0,0.03) 19px, rgba(0,0,0,0.03) 20px);
  border: 2px dashed var(--surface-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  overflow: hidden;
}

/* Mold shape */
.assembly-mold {
  position: relative;
  width: 260px;
  min-height: 40px;
  border: 2px solid var(--chocolate-light);
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: rgba(60, 31, 14, 0.03);
  display: flex;
  flex-direction: column-reverse;
  transition: all 0.4s ease;
  overflow: hidden;
}

.assembly-mold.mold-cercle {
  border-radius: 0 0 130px 130px;
}

.assembly-mold.mold-carre {
  border-radius: 0 0 4px 4px;
}

.assembly-mold.mold-buche {
  width: 320px;
  border-radius: 0 0 8px 8px;
}

.assembly-mold.mold-tarte {
  border-radius: 0 0 60px 60px;
  min-height: 30px;
}

.assembly-mold.mold-verrine {
  width: 120px;
  border-radius: 0 0 20px 20px;
}

/* Layers */
.assembly-layers {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
}

.assembly-layer {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  cursor: grab;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  user-select: none;
  animation: layerSlideIn 0.4s ease-out;
  overflow: hidden;
}

@keyframes layerSlideIn {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

.assembly-layer:hover {
  filter: brightness(1.1);
}

.assembly-layer .layer-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.assembly-layer .layer-remove {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.3);
  color: white;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.assembly-layer:hover .layer-remove {
  opacity: 1;
}

.assembly-layer .layer-remove:hover {
  background: var(--danger);
}

/* Height ruler */
.assembly-height-ruler {
  position: absolute;
  right: 12px;
  bottom: 1.5rem;
  width: 24px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0;
}

.ruler-mark {
  width: 100%;
  height: 20px;
  border-top: 1px solid rgba(60, 31, 14, 0.15);
  font-size: 0.55rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 2px;
  line-height: 20px;
}

/* Total */
.assembly-total {
  margin-top: 1rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* Drag over states */
.assembly-canvas.drag-over {
  border-color: var(--gold);
  background-color: rgba(197, 165, 90, 0.04);
}

.assembly-layer.dragging {
  opacity: 0.4;
}

.assembly-layer.drag-over-layer {
  border-top: 3px solid var(--gold);
}

/* Responsive */
@media (max-width: 768px) {
  .assembly-workspace {
    flex-direction: column;
  }
  .assembly-palette {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding-right: 0;
  }
  .assembly-palette-items {
    flex-direction: row;
    gap: 0.4rem;
  }
  .assembly-palette-item {
    min-width: 140px;
    flex-shrink: 0;
  }
  .cb-pairings-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
