/* Recipes — aligned with shopping / AIA patterns */

#recipes_masterbox.recipes-master {
  --recipes-accent: var(--color-active, var(--accent, #ffa23a));
  --recipes-surface: var(--color-primary, #222f45);
  --recipes-field: var(--textfield-background, #172030);
  --recipes-text: var(--textfield-textcolor, #fff);
  --recipes-border: rgba(255, 255, 255, 0.12);
  --recipes-radius: 22px;

  flex-direction: column;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

#recipes_masterbox.recipes-master[style*='block'] {
  display: flex !important;
}

.recipes-toolbar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.9rem 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--recipes-accent) 9%, transparent);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.14), transparent);
  z-index: 2;
}

.recipes-toolbar-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.recipes-search-wrap {
  flex: 1 1 160px;
  min-width: 140px;
}

.recipes-list-picker {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

.recipes-input,
.recipes-select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--recipes-border);
  border-radius: 12px;
  background: var(--recipes-field);
  color: var(--recipes-text);
  padding: 0.55rem 0.7rem;
  font: inherit;
}

.recipes-icon-btn,
.recipes-btn {
  border: 1px solid var(--recipes-border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--recipes-accent) 16%, transparent);
  color: var(--recipes-text);
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.recipes-icon-btn {
  min-width: 2.2rem;
  padding: 0.4rem 0.55rem;
}

.recipes-btn-sm {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}

.recipes-btn-ghost {
  background: transparent;
}

.recipes-btn-danger {
  background: rgba(220, 70, 70, 0.2);
  border-color: rgba(220, 70, 70, 0.35);
}

.recipes-status {
  font-size: 0.88rem;
  opacity: 0.9;
}

.recipes-status-error {
  color: #ffb4b4;
}

.recipes-week {
  flex: none;
  padding: 0.55rem 0.75rem 0.35rem;
  border-bottom: 1px solid var(--recipes-border);
}

.recipes-week-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.recipes-week-title {
  font-weight: 600;
  margin-right: auto;
}

.recipes-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.recipes-week-day {
  min-height: 4.2rem;
  border-radius: 12px;
  border: 1px solid var(--recipes-border);
  background: rgba(0, 0, 0, 0.16);
  padding: 0.3rem;
}

.recipes-week-day.has-meals {
  border-color: color-mix(in srgb, var(--recipes-accent) 40%, transparent);
}

.recipes-week-day-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.recipes-week-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--recipes-accent) 22%, transparent);
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.25rem 1.1rem 0.25rem 0.35rem;
  margin-bottom: 0;
  cursor: pointer;
}

.recipes-week-chip-wrap {
  position: relative;
  margin-bottom: 0.2rem;
  padding-top: 0.15rem;
}

.recipes-unplan-btn-chip {
  position: absolute;
  top: -0.15rem;
  right: -0.1rem;
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2;
  padding: 0;
}

.recipes-week-hint {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  opacity: 0.7;
}

#recipes-week.is-drop-active .recipes-week-day {
  outline: 1px dashed color-mix(in srgb, var(--recipes-accent) 45%, transparent);
}

.recipes-week-day.is-drop-target {
  background: color-mix(in srgb, var(--recipes-accent) 24%, transparent) !important;
  border-color: color-mix(in srgb, var(--recipes-accent) 70%, transparent);
  transform: scale(1.02);
  transition: background 0.12s ease, transform 0.12s ease;
}

.recipes-draggable {
  cursor: grab;
}

.recipes-draggable.is-dragging,
.recipes-tile.is-dragging,
.recipes-week-chip.is-dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.recipes-tile-hint {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.55;
}

.recipes-week-day.is-today {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--recipes-accent) 55%, transparent);
}

.recipes-week-day.is-planned-flash {
  animation: recipes-day-flash 2.2s ease;
}

@keyframes recipes-day-flash {
  0%,
  100% {
    background: rgba(0, 0, 0, 0.16);
  }
  20%,
  55% {
    background: color-mix(in srgb, var(--recipes-accent) 28%, transparent);
  }
}

.recipes-week-empty {
  opacity: 0.35;
  font-size: 0.8rem;
}

.recipes-plan-row-primary {
  margin: 0.85rem 0 0.35rem;
  padding: 0.7rem;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--recipes-accent) 28%, transparent);
  background: color-mix(in srgb, var(--recipes-accent) 10%, transparent);
}

.recipes-detail-planned {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: color-mix(in srgb, var(--recipes-accent) 85%, #fff);
}

.recipes-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.recipes-empty {
  padding: 0.85rem 1rem;
  opacity: 0.65;
  font-size: 0.92rem;
}

.recipes-tile {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.35rem;
  width: calc(100% - 1.2rem);
  margin: 0.35rem 0.6rem;
  text-align: left;
  border: 1px solid var(--recipes-border);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.18));
  color: inherit;
  padding: 0.55rem 0.55rem 0.55rem 0.85rem;
  font: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.recipes-tile-main {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0.2rem 0;
  cursor: pointer;
  font: inherit;
  width: 100%;
}

.recipes-unplan-btn {
  border: 0;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.75;
}

.recipes-unplan-btn:hover,
.recipes-unplan-btn:focus-visible {
  opacity: 1;
  background: rgba(220, 70, 70, 0.28);
  outline: none;
}

.recipes-unplan-drop {
  position: absolute;
  left: 50%;
  bottom: 5.6rem;
  transform: translateX(-50%);
  z-index: 8;
  min-width: min(420px, 88%);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(220, 70, 70, 0.55);
  background: rgba(80, 20, 20, 0.88);
  text-align: center;
  font-size: 0.92rem;
}

.recipes-unplan-drop.is-drop-target {
  background: rgba(140, 35, 35, 0.95);
  border-style: solid;
}

.recipes-detail-plan-list {
  margin: 0.65rem 0;
}

.recipes-detail-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--recipes-border);
}

.recipes-tile:hover,
.recipes-tile:focus-visible {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--recipes-accent) 45%, transparent);
  outline: none;
}

.recipes-tile-title {
  font-weight: 650;
  margin-bottom: 0.2rem;
}

.recipes-tile-meta,
.recipes-tile-date {
  font-size: 0.82rem;
  opacity: 0.75;
}

.recipes-composer-wrap.aia-composer-wrap {
  flex: none;
  width: min(760px, 92%);
  margin: 0 auto;
  padding: 8px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  z-index: 3;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.22) 35%);
}

.recipes-composer-hint {
  font-size: 0.78rem;
  opacity: 0.65;
  padding: 0.2rem 0.4rem 0;
}

.recipes-fab {
  position: absolute;
  right: 1rem;
  bottom: 5.2rem;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 999px;
  border: 0;
  background: var(--recipes-accent);
  color: #1a1a1a;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 4;
}

.recipes-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
}

.recipes-modal[hidden] {
  display: none !important;
}

.recipes-modal-card {
  width: min(720px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  border-radius: var(--recipes-radius) var(--recipes-radius) 16px 16px;
  background: var(--recipes-surface);
  border: 1px solid var(--recipes-border);
  padding: 1rem 1rem 1.25rem;
  position: relative;
  animation: recipes-sheet-in 0.22s ease;
}

@keyframes recipes-sheet-in {
  from {
    transform: translateY(18px);
    opacity: 0.4;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.recipes-modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
}

.recipes-detail-title {
  margin: 0 1.5rem 0.25rem 0;
  font-size: 1.35rem;
}

.recipes-detail-sub,
.recipes-detail-meta,
.recipes-detail-desc {
  margin: 0.2rem 0;
  opacity: 0.85;
}

.recipes-feedback {
  margin: 0.35rem 0 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--recipes-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--recipes-accent) 35%, transparent);
  font-size: 0.9rem;
}

.recipes-feedback-error {
  background: rgba(220, 70, 70, 0.18);
  border-color: rgba(220, 70, 70, 0.4);
  color: #ffb4b4;
}

.recipes-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.85rem 0;
}

.recipes-plan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.75rem;
}

.recipes-ing-list,
.recipes-steps,
.recipes-sources {
  margin: 0.35rem 0 0.9rem;
  padding-left: 1.1rem;
}

.recipes-form label {
  display: block;
  margin: 0.55rem 0;
  font-size: 0.9rem;
}

.recipes-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.recipes-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.recipes-editor-row {
  display: grid;
  grid-template-columns: 5rem 6rem 1fr;
  gap: 0.35rem;
  position: relative;
}

.recipes-editor-step {
  grid-template-columns: 1fr;
}

.recipes-suggest {
  position: absolute;
  left: calc(5rem + 6rem + 0.7rem);
  right: 0;
  top: 100%;
  z-index: 5;
  background: var(--recipes-field);
  border: 1px solid var(--recipes-border);
  border-radius: 10px;
  overflow: hidden;
}

.recipes-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font: inherit;
}

.recipes-suggest button:hover {
  background: color-mix(in srgb, var(--recipes-accent) 18%, transparent);
}

@media (max-width: 720px) {
  .recipes-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recipes-editor-row {
    grid-template-columns: 1fr 1fr;
  }

  .recipes-editor-row .re-item {
    grid-column: 1 / -1;
  }

  .recipes-fab {
    bottom: 6.2rem;
  }
}
