/* ==========================================================================
   Recipe Detail Modal & Dialog Overlay (FOODEAT style)
   ========================================================================== */

/* Hero Image Top Portion */
.recipe-modal-hero {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  background-color: var(--bg-tertiary);
}

.recipe-modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Semi-transparent dark overlay for text legibility in hero */
.recipe-modal-hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(62, 39, 35, 0.1) 0%, rgba(62, 39, 35, 0.75) 100%);
  pointer-events: none;
}

.recipe-modal-overlay-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 30px;
  color: #ffffff;
  z-index: 2;
}

.modal-recipe-category {
  background: var(--accent-primary);
  color: #ffffff;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
  margin-bottom: 10px;
}

.modal-recipe-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  margin-bottom: 8px;
}

.modal-recipe-rating-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-stars-container {
  display: flex;
  gap: 4px;
}

.modal-stars-container .star-svg-filled {
  color: #F4A261;
  /* Golden warm peach for hero stars visibility */
}

.modal-stars-container .star-svg-empty {
  color: rgba(255, 255, 255, 0.4);
}

.modal-rating-badge {
  color: #F4A261;
  font-weight: 800;
  font-size: 1.1rem;
}

/* Modal Body Content Scroll Area */
.modal-recipe-body {
  padding: 30px;
  background-color: var(--bg-secondary);
  position: relative;
}

.modal-recipe-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Metadata Stats Bar (Clock, fire, pot) */
.recipe-metadata-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 35px;
}

.meta-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.meta-stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.meta-stat-icon {
  display: inline-flex;
  align-items: center;
  color: var(--accent-primary);
}

.meta-stat-icon svg {
  width: 16px;
  height: 16px;
}

.meta-stat-label {
  color: var(--text-muted);
  font-weight: 500;
}

.meta-stat-value {
  color: var(--text-primary);
  font-weight: 700;
}

/* Servings Scaler (highly round steppers) */
.servings-scaler {
  display: flex;
  align-items: center;
  gap: 12px;
}

.servings-scaler-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.servings-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.servings-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.servings-btn svg {
  width: 14px;
  height: 14px;
}

.servings-display {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  min-width: 20px;
  text-align: center;
}

/* Details Content Layout Split columns */
.recipe-content-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.5fr;
  gap: 40px;
}

@media (max-width: 768px) {
  .recipe-content-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

.column-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

/* Ingredients Section */
.ingredients-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.btn-add-grocery {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-add-grocery.primary {
  background-color: var(--accent-primary);
  color: white;
}

.btn-add-grocery.primary:hover {
  background-color: #d65a3d;
}

.btn-add-grocery.secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(62, 39, 35, 0.05);
}

.btn-add-grocery.secondary:hover {
  background-color: #ebdcc9;
}

.btn-icon-svg {
  display: inline-flex;
  align-items: center;
}

.btn-icon-svg svg {
  width: 14px;
  height: 14px;
}

.ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 30px;
}

.ingredient-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
}

/* Custom Checkbox Alignment */
.ingredient-checkbox {
  margin-top: 5px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-primary);
}

.ingredient-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.ingredient-text strong {
  color: var(--text-primary);
}

.ingredient-matched {
  color: var(--color-success);
  text-decoration: line-through;
  opacity: 0.7;
}

.ingredient-missing {
  color: var(--text-primary);
}

.ingredient-missing-badge {
  background: var(--color-danger-glass);
  color: var(--color-danger);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Kitchen Gear Section */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.equipment-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.equipment-icon-svg {
  color: var(--accent-primary);
  background: var(--bg-secondary);
  padding: 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.equipment-icon-svg svg {
  width: 16px;
  height: 16px;
}

/* Procedures Step checklist list */
.instructions-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.instruction-step {
  display: flex;
  gap: 16px;
  transition: opacity 0.3s ease;
}

.instruction-step.completed {
  opacity: 0.55;
}

.instruction-step.completed .step-text {
  text-decoration: line-through;
}

.step-number-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 800;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.instruction-step.completed .step-number-badge {
  background-color: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.step-details {
  flex-grow: 1;
}

.step-text {
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Chef Tip Box styling */
.chef-tip-box {
  background: var(--bg-primary);
  border-left: 4px solid var(--accent-primary);
  padding: 12px 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: 10px;
}

.chef-tip-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-icon-svg {
  display: inline-flex;
  align-items: center;
}

.tip-icon-svg svg {
  width: 12px;
  height: 12px;
}

.chef-tip-box p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   Recipe Source Reference Link Styling
   ========================================================================== */
.recipe-source-reference {
  margin-top: 12px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-source-reference a {
  color: var(--accent-primary);
  font-weight: 700;
  text-decoration: underline;
  transition: color var(--transition-fast);
}

.recipe-source-reference a:hover {
  color: var(--accent-hover);
}

/* ==========================================================================
   Recipe Box Mood Boards Filter Styling
   ========================================================================== */

.mood-boards-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  width: 100%;
}

.boards-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.boards-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.boards-chips-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.board-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.board-chip:hover {
  background: rgba(231, 111, 81, 0.05);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.board-chip.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Servings Yield Slider Styling
   ========================================================================== */
.servings-slider-container {
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
}

.servings-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  outline: none;
  cursor: pointer;
}

.servings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.servings-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.servings-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
  cursor: pointer;
}

.servings-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* ==========================================================================
   Ambient Audio & Story Share Button
   ========================================================================== */
.ambient-audio-toggle {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.ambient-audio-toggle:hover {
  transform: scale(1.04);
  background: white;
  border-color: var(--accent-primary);
}

.ambient-audio-toggle.playing {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.audio-pulse-bar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.audio-pulse-bar span {
  width: 2px;
  height: 100%;
  background: currentColor;
  border-radius: 1px;
}

.ambient-audio-toggle.playing .audio-pulse-bar span {
  animation: pulse-audio-bar 1s infinite alternate;
}

.ambient-audio-toggle.playing .audio-pulse-bar span:nth-child(2) {
  animation-delay: 0.2s;
}

.ambient-audio-toggle.playing .audio-pulse-bar span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse-audio-bar {
  0% {
    height: 3px;
  }

  100% {
    height: 12px;
  }
}

.btn-story-share {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-story-share:hover {
  transform: scale(1.04);
  background: white;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* ==========================================================================
   Cook Mode Fullscreen view
   ========================================================================== */
.cook-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(35px) saturate(120%);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.cook-mode-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.cook-mode-container {
  width: 100%;
  max-width: 900px;
  height: 100%;
  max-height: 620px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 20px;
  animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cook-mode-header {
  padding: 24px 35px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cook-mode-logo-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--accent-primary);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 4px;
}

#cook-mode-recipe-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}

.cook-mode-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wake-lock-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-primary);
}

.wake-lock-status.active {
  color: var(--color-success);
  border-color: rgba(77, 124, 91, 0.2);
}

.wake-lock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #B0BEC5;
}

.wake-lock-status.active .wake-lock-dot {
  background: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
  animation: alarm-flash 1s infinite alternate;
}

.cook-mode-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.cook-mode-close-btn:hover {
  background: var(--color-danger-glass);
  color: var(--color-danger);
}

.cook-mode-content {
  flex-grow: 1;
  padding: 40px 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

.cook-mode-step-card {
  width: 100%;
  max-width: 750px;
  text-align: center;
}

.cook-mode-progress-container {
  margin-bottom: 35px;
}

.cook-mode-step-indicator {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.cook-mode-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.cook-mode-progress-bar .progress-fill {
  height: 100%;
  background: var(--accent-primary);
  width: 0%;
  transition: width 0.3s ease;
}

.cook-mode-large-text {
  font-size: 1.8rem;
  line-height: 1.5;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 500;
  margin-bottom: 30px;
  word-wrap: break-word;
}

.cook-mode-tip-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 24px;
  max-width: 600px;
  margin: 0 auto;
  text-align: left;
}

.cook-mode-tip-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 6px;
}

#cook-mode-tip-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.cook-mode-footer {
  padding: 24px 35px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}

.cook-nav-btn {
  padding: 14px 28px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.cook-nav-btn.primary-btn {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.cook-nav-btn.primary-btn:hover {
  background-color: #d65a3d;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.cook-nav-btn.secondary-btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.cook-nav-btn.secondary-btn:hover {
  background: #ebdcc9;
}

.cook-nav-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

@media (max-width: 768px) {
  .cook-mode-container {
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
  }

  .cook-mode-content {
    padding: 24px;
  }

  .cook-mode-large-text {
    font-size: 1.4rem;
  }
}

/* ==========================================================================
   Clickable Instruction Timers & Floating Timer Bar
   ========================================================================== */
.step-timer-badge {
  background: rgba(231, 111, 81, 0.08);
  border: 1.5px solid rgba(231, 111, 81, 0.2);
  color: var(--accent-primary);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
  vertical-align: middle;
  margin: 0 4px;
}

.step-timer-badge:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.timer-badge-icon {
  display: inline-flex;
  align-items: center;
}

.timer-badge-icon svg {
  width: 12px;
  height: 12px;
}

.floating-timer-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-glass);
  backdrop-filter: blur(15px);
  border: 1px solid var(--accent-primary);
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-timer-bar.hidden {
  transform: translate(-50%, 150%);
  pointer-events: none;
}

.timer-bar-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-bar-icon {
  display: inline-flex;
  align-items: center;
  color: var(--accent-primary);
}

.timer-bar-icon svg {
  width: 20px;
  height: 20px;
  animation: tick-timer 1.5s infinite linear;
}

@keyframes tick-timer {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.timer-text-group {
  display: flex;
  flex-direction: column;
  min-width: 110px;
}

.timer-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timer-bar-display {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: monospace;
}

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

.timer-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-action-btn:hover {
  background: var(--bg-primary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.timer-action-btn.danger {
  color: var(--color-danger);
}

.timer-action-btn.danger:hover {
  background: var(--color-danger-glass);
  border-color: var(--color-danger);
}

.floating-timer-bar.alarm {
  animation: alarm-pulse 0.5s infinite alternate;
  background: var(--color-danger);
  border-color: var(--color-danger);
}

.floating-timer-bar.alarm .timer-bar-display,
.floating-timer-bar.alarm .timer-bar-label,
.floating-timer-bar.alarm .timer-bar-icon {
  color: white;
}

.floating-timer-bar.alarm .timer-bar-icon svg {
  animation: alarm-shake 0.1s infinite;
}

@keyframes alarm-pulse {
  0% {
    box-shadow: 0 0 10px rgba(201, 74, 74, 0.4);
  }

  100% {
    box-shadow: 0 0 30px rgba(201, 74, 74, 0.9);
  }
}

@keyframes alarm-shake {
  0% {
    transform: translate(1px, 1px) rotate(0deg);
  }

  10% {
    transform: translate(-1px, -2px) rotate(-1deg);
  }

  20% {
    transform: translate(-3px, 0px) rotate(1deg);
  }

  30% {
    transform: translate(0px, 2px) rotate(0deg);
  }

  40% {
    transform: translate(1px, -1px) rotate(1deg);
  }

  50% {
    transform: translate(-1px, 2px) rotate(-1deg);
  }

  60% {
    transform: translate(-3px, 1px) rotate(0deg);
  }

  70% {
    transform: translate(2px, 1px) rotate(-1deg);
  }

  80% {
    transform: translate(-1px, -1px) rotate(1deg);
  }

  90% {
    transform: translate(2px, 2px) rotate(0deg);
  }

  100% {
    transform: translate(1px, -2px) rotate(-1deg);
  }
}

/* ==========================================================================
   Ingredient Substitutions Popover Styling
   ========================================================================== */
.ingredient-sub-trigger {
  border-bottom: 1.5px dotted var(--accent-primary);
  cursor: help;
  transition: color var(--transition-fast);
  position: relative;
}

.ingredient-sub-trigger:hover {
  color: var(--accent-primary);
}

.substitute-popover {
  position: absolute;
  background: var(--bg-secondary);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-md);
  z-index: 1050;
  width: 250px;
  pointer-events: all;
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.popover-header {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.popover-body {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.45;
}

@keyframes popoverFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(4px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   Recipe Edit Mode Styles
   ========================================================================== */
.btn-recipe-edit {
  position: absolute;
  top: 20px;
  right: 65px;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-recipe-edit:hover {
  transform: scale(1.04);
  background: white;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-recipe-planner {
  position: absolute;
  top: 20px;
  right: 110px;
  background: var(--bg-glass);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-recipe-planner:hover {
  transform: scale(1.04);
  background: white;
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.edit-mode-hero {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #d95d39 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  height: auto;
  min-height: 120px;
}

.edit-hero-overlay {
  text-align: center;
  width: 100%;
}

.edit-section-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.edit-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
  margin-top: 0;
  margin-bottom: 20px;
}

.edit-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.btn-edit-add-more {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-edit-add-more:hover {
  background: var(--accent-primary);
  color: white;
}

.edit-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.edit-field input,
.edit-field select,
.edit-field textarea,
.edit-ing-row input,
.edit-ing-row select,
.edit-gear-row input,
.edit-gear-row select,
.edit-step-row textarea,
.edit-step-row input {
  font-family: inherit;
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  background: #FCF9F5;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus,
.edit-ing-row input:focus,
.edit-ing-row select:focus,
.edit-gear-row input:focus,
.edit-gear-row select:focus,
.edit-step-row textarea:focus,
.edit-step-row input:focus {
  border-color: var(--accent-primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(231, 111, 81, 0.1);
}

.edit-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edit-ing-row,
.edit-gear-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-remove-edit-ing,
.btn-remove-edit-gear,
.btn-remove-edit-step {
  background: transparent;
  border: none;
  color: #d95d39;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

.btn-remove-edit-ing:hover,
.btn-remove-edit-gear:hover,
.btn-remove-edit-step:hover {
  background: rgba(217, 93, 57, 0.1);
  color: #c0392b;
}

.edit-step-row {
  border: 1px dashed var(--border-color);
  padding: 16px;
  border-radius: 12px;
  background: #FCFBF9;
  margin-bottom: 8px;
}

.edit-step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.edit-step-number {
  font-weight: 700;
  color: var(--accent-primary);
}

.edit-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 32px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.btn-edit-primary {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 12px 28px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn-edit-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: #d95d39;
}

.btn-edit-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  padding: 12px 28px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-edit-secondary:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: var(--text-primary);
}

/* ==========================================================================
   Recipe Detail Chatbot Panel (Chef AI Assistant)
   ========================================================================== */
.recipe-chatbot-container {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  font-family: var(--font-sans);
}

.recipe-chat-toggle-btn {
  background: var(--accent-primary);
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(231, 111, 81, 0.3);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.recipe-chat-toggle-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 18px rgba(231, 111, 81, 0.4);
}

.recipe-chat-toggle-btn svg {
  width: 16px;
  height: 16px;
}

/* Chat Drawer Panel */
.recipe-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 30px;
  width: 360px;
  height: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  animation: chatPanelSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: var(--glass-blur);
}

@keyframes chatPanelSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.recipe-chat-header {
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recipe-chat-chef-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.recipe-chat-avatar {
  font-size: 1.6rem;
}

.recipe-chat-chef-profile h4 {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.recipe-chat-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

.recipe-chat-close-btn {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

.recipe-chat-close-btn:hover {
  color: var(--accent-primary);
}

.recipe-chat-messages {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-chat-msg {
  display: flex;
  width: 100%;
}

.recipe-chat-msg.chef {
  justify-content: flex-start;
}

.recipe-chat-msg.user {
  justify-content: flex-end;
}

.recipe-chat-msg .msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.recipe-chat-msg.chef .msg-bubble {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 4px 16px 16px 16px;
}

.recipe-chat-msg.user .msg-bubble {
  background: var(--accent-primary);
  color: white;
  border-radius: 16px 16px 4px 16px;
}

.recipe-chat-suggestions {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  overflow-x: auto;
  white-space: nowrap;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
  scrollbar-width: none;
}

.recipe-chat-suggestions::-webkit-scrollbar {
  display: none;
}

.chat-suggestion-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-suggestion-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(231, 111, 81, 0.04);
}

.recipe-chat-form {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 8px;
  background: var(--bg-secondary);
}

#recipe-chat-input {
  flex-grow: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

#recipe-chat-input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-secondary);
}

#btn-recipe-chat-send {
  background: var(--accent-primary);
  color: white;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

#btn-recipe-chat-send:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

#btn-recipe-chat-send svg {
  width: 14px;
  height: 14px;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
  align-items: center;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Make sure container handles placement on small screens */
@media (max-width: 480px) {
  .recipe-chat-panel {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
}