/* ─────────────────────────────────────────────
   SMARTGEN — CocinarIA
   ───────────────────────────────────────────── */

/* ── Layout base ──────────────────────────────── */

.sg {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  background: var(--color-surface);
}

/* Home: hero fijo + body hace el scroll */
.sg--home {
  flex: 1;
  min-height: 0;
}

.sg--home .sg__home-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* Builder / Results: header sticky + outlet hace el scroll */
.sg--pane {
  flex: 1;
  min-height: 0;
}

.sg--pane .sg__header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.sg--pane .sg__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 20px 24px;
}

/* Loading: full-screen dark centrado */
.sg--loading {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #1a2e22 0%, #1e3a2a 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hero (Home) ──────────────────────────────── */

.sg__hero {
  background: linear-gradient(160deg, #1a2e22 0%, #2a4030 55%, #3d5a45 100%);
  padding: 52px 24px 36px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.sg__hero-bubble {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.sg__hero-bubble--1 {
  width: 200px; height: 200px;
  top: -50px; right: -50px;
  background: rgba(255, 255, 255, .04);
}
.sg__hero-bubble--2 {
  width: 120px; height: 120px;
  bottom: -20px; left: -20px;
  background: rgba(212, 168, 48, .07);
}

.sg__hero-back {
  background: rgba(255, 255, 255, .12);
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  margin-bottom: 28px;
  position: relative;
}

.sg__hero-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .48);
  margin-bottom: 10px;
  position: relative;
}

.sg__hero-title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: #fff;
  margin: 0 0 12px;
  position: relative;
}

.sg__hero-sub {
  font-size: 15px;
  line-height: 1.65;
  color: rgba(255, 255, 255, .62);
  margin: 0;
  position: relative;
}

/* ── Home body ────────────────────────────────── */

.sg__home-body {
  padding: 24px 20px 32px;
}

.sg__section {
  margin-bottom: 28px;
}
.sg__section--last { margin-bottom: 8px; }

.sg__section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 12px;
}

/* ── Action rows (Home) ───────────────────────── */

.sg__action-rows {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.sg__action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface-raised);
  border-radius: 20px;
  padding: 18px 20px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  border: none;
  text-align: left;
  width: 100%;
}

.sg__action-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sg__action-icon--camera   { background: #fdf3ee; color: #c96f4a; }
.sg__action-icon--pantry   { background: var(--color-brand-primary-soft, #e8f0e8); color: #3d5a40; }
.sg__action-icon--describe { background: var(--color-bg-muted, #f0ece4); color: #6b6157; }

.sg__action-text { flex: 1; min-width: 0; }

.sg__action-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.sg__action-desc {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-secondary);
}

.sg__action-arrow { color: #d4ccc2; flex-shrink: 0; }

/* ── Quick chips (Acceso rápido) ──────────────── */

.sg__chips-scroll {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sg__quick-chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.sg__quick-chip--green {
  background: var(--color-brand-primary-soft, #e8f0e8);
  color: var(--color-brand-primary, #3d5a40);
}
.sg__quick-chip--orange {
  background: #fdf3ee;
  color: var(--color-accent-terracotta, #c96f4a);
}
.sg__quick-chip--neutral {
  background: #f0ece4;
  color: #6b6157;
}

/* ── AI Insights card ─────────────────────────── */

.sg__ai-insights {
  background: linear-gradient(135deg, #fffbec, #fff8dc);
  border: 1.5px solid rgba(212, 168, 48, .22);
  border-radius: 20px;
  padding: 20px;
}

.sg__ai-insights-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sg__ai-insights-icon-wrap {
  width: 32px;
  height: 32px;
  background: rgba(212, 168, 48, .2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sg__ai-insights-title {
  font-size: 13px;
  font-weight: 600;
  color: #7a5a0a;
}

.sg__ai-insights-body p {
  font-size: 13px;
  line-height: 1.6;
  color: #6b4e0a;
  margin-bottom: 7px;
}
.sg__ai-insights-body p:last-child { margin-bottom: 0; }

/* ── Explore row ──────────────────────────────── */

.sg__explore-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 1.5px solid #e8e0d5;
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-top: 14px;
}

.sg__explore-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sg__explore-icon-wrap {
  width: 38px;
  height: 38px;
  background: var(--color-brand-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sg__explore-text { }
.sg__explore-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.sg__explore-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 1px;
}

/* ── Header (Builder / Results) ───────────────── */

.sg__header {
  background: var(--color-surface-raised);
  padding: 48px 20px 16px;
  border-bottom: 1px solid #f0ece4;
  flex-shrink: 0;
}

.sg__header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.sg__header-back {
  background: var(--color-bg-muted, #f0ece4);
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.sg__header-titles { flex: 1; }

.sg__header-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

.sg__header-subtitle {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.sg__header-badge {
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 14px;
  flex-shrink: 0;
}

.sg__header-action-btn {
  padding: 9px 14px;
  background: var(--color-bg-muted, #f0ece4);
  border: none;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-brand-primary);
  cursor: pointer;
}

/* ── Search bar (Builder — inside header) ─────── */

.sg__search-bar {
  position: relative;
}

.sg__search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-secondary);
  pointer-events: none;
}

.sg__search-input {
  width: 100%;
  background: var(--color-bg-muted, #f0ece4);
  border: none;
  border-radius: 12px;
  padding: 11px 46px 11px 40px;
  font-size: 14px;
  color: var(--color-text-primary);
  outline: none;
  box-sizing: border-box;
}

.sg__search-input::placeholder { color: var(--color-text-secondary); }

.sg__search-mic {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--color-brand-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

/* ── Confidence card ──────────────────────────── */

.sg__conf-card {
  background: var(--color-surface-raised);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .05);
}

.sg__conf-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.sg__conf-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.sg__conf-pct {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--color-brand-primary);
}

.sg__conf-bar {
  height: 6px;
  background: #f0ece4;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.sg__conf-fill {
  height: 100%;
  background: linear-gradient(90deg, #3d5a40, #6a8a6a);
  border-radius: 999px;
  transition: width .4s ease;
}

.sg__conf-caption {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

/* ── Chips genéricos ──────────────────────────── */

.sg__chips-section {
  margin-bottom: 20px;
}

.sg__chips-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.sg__chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sg__chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s;
}

.sg__chip--pantry {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.sg__chip--recent {
  background: #f0ece4;
  color: #6b6157;
}

.sg__chip--selected {
  background: var(--color-brand-primary);
  color: #fff;
}

.sg__chips-empty {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ── Category tabs ────────────────────────────── */

.sg__cat-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex-shrink: 0;
  margin-bottom: 20px;
}
.sg__cat-scroll::-webkit-scrollbar { display: none; }

.sg__cat-tab {
  flex-shrink: 0;
  background: #f0ece4;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 500;
  color: #6b6157;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.sg__cat-tab--active {
  background: var(--color-brand-primary);
  color: #fff;
}

/* ── CTA Bar (Builder) ────────────────────────── */

.sg__cta-bar {
  padding: 12px 20px 16px;
  background: var(--color-surface);
  border-top: 1px solid #f0ece4;
  flex-shrink: 0;
}

.sg__cta-btn {
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: none;
  background: var(--color-brand-primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(61, 90, 64, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.sg__cta-btn--disabled {
  background: #f0ece4;
  color: var(--color-text-secondary);
  cursor: default;
  box-shadow: none;
}

/* ── Loading screen ───────────────────────────── */

.sg__loading-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: sg-blob-float 4s ease-in-out infinite;
}

.sg__loading-blob--1 { width: 160px; height: 160px; background: rgba(61,90,64,.3);   top:8%;    left:8%;   animation-duration:4s;   animation-delay:0s; }
.sg__loading-blob--2 { width: 100px; height: 100px; background: rgba(201,111,74,.18); top:28%;   right:4%;  animation-duration:5s;   animation-delay:.7s; }
.sg__loading-blob--3 { width: 80px;  height: 80px;  background: rgba(212,168,48,.15); bottom:18%;left:12%;  animation-duration:3.5s; animation-delay:1.2s; }
.sg__loading-blob--4 { width: 120px; height: 120px; background: rgba(138,167,133,.18);bottom:8%; right:18%; animation-duration:4.5s; animation-delay:.4s; }

@keyframes sg-blob-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-16px) scale(1.05); }
}

.sg__loading-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 32px;
  text-align: center;
  width: 100%;
  max-width: 380px;
}

.sg__loading-icon-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212,168,48,.4), rgba(61,90,64,.55));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 36px;
  animation: sg-icon-pulse 2.2s ease-in-out infinite;
}

@keyframes sg-icon-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.07); }
}

.sg__loading-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
  color: #f5f0e8;
  margin-bottom: 10px;
}

.sg__loading-sub {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(245, 240, 232, .58);
  margin-bottom: 36px;
}

.sg__loading-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 44px;
}

.sg__loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: sg-dot-pulse 1.5s ease-in-out infinite;
}
.sg__loading-dot:nth-child(1) { background: rgba(255,255,255,.75); animation-delay: 0s; }
.sg__loading-dot:nth-child(2) { background: rgba(255,255,255,.32); animation-delay: .25s; }
.sg__loading-dot:nth-child(3) { background: rgba(255,255,255,.32); animation-delay: .5s; }

@keyframes sg-dot-pulse {
  0%, 80%, 100% { transform: scale(1); opacity: 1; }
  40%            { transform: scale(1.4); opacity: .8; }
}

.sg__loading-bullets-card {
  background: rgba(255, 255, 255, .06);
  border-radius: 18px;
  padding: 18px 20px;
  width: 100%;
  margin-bottom: 32px;
}

.sg__loading-bullet {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sg__loading-bullet:last-child { margin-bottom: 0; }

.sg__loading-bullet-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sg__loading-bullet-text {
  font-size: 13px;
  color: rgba(245, 240, 232, .68);
}

.sg__loading-skip {
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .15);
  padding: 14px 32px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ── Results ──────────────────────────────────── */

/* Featured card */
.sg__featured {
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
}

.sg__featured-dark {
  background: linear-gradient(145deg, #2a4a1a, #1a3015);
  padding: 36px 24px 28px;
  position: relative;
}

.sg__featured-match-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(212, 168, 48, .92);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #1a1000;
}

.sg__featured-tag {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, .48);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sg__featured-name {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0 0 10px;
}

.sg__featured-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, .62);
}

.sg__featured-meta-sep {
  color: rgba(255, 255, 255, .3);
  font-weight: 400;
}

.sg__featured-light {
  background: var(--color-surface-raised);
  padding: 16px 20px;
}

.sg__featured-reason {
  background: var(--color-ai-golden-soft, #fffbec);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #6b4e0a;
}

.sg__featured-actions {
  display: flex;
  gap: 8px;
}

.sg__featured-btn {
  border-radius: 14px;
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.sg__featured-btn--primary {
  flex: 2;
  background: var(--color-brand-primary);
  color: #fff;
}

.sg__featured-btn--ghost {
  flex: 1;
  background: var(--color-bg-muted, #f0ece4);
  color: var(--color-brand-primary);
}

/* Section headers */
.sg__section-header {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
  margin-bottom: 14px;
}

/* Horizontal scroll cards */
.sg__horiz-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 28px;
  scrollbar-width: none;
}
.sg__horiz-scroll::-webkit-scrollbar { display: none; }

.sg__horiz-card {
  flex-shrink: 0;
  width: 190px;
  background: var(--color-surface-raised);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
  cursor: pointer;
}

.sg__horiz-card-img {
  height: 100px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 0 12px 10px;
}

.sg__horiz-card-match {
  background: rgba(212, 168, 48, .88);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #1a1000;
}

.sg__horiz-card-body {
  padding: 12px 14px 14px;
}

.sg__horiz-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sg__horiz-card-meta {
  display: flex;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Waste list */
.sg__waste-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--color-surface-raised);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .05);
}

.sg__waste-thumb {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(135deg, #d4f0d0, #b8e0c0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 26px;
}

.sg__waste-info { flex: 1; min-width: 0; }

.sg__waste-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 3px;
}

.sg__waste-meta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.sg__waste-match {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-brand-primary);
  flex-shrink: 0;
}

/* Cook loading state */
.sg__featured-btn--loading {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.sg__cook-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: sg-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes sg-spin {
  to { transform: rotate(360deg); }
}
