/* ==========================================
   CookClip — Scandinavian Minimalist Theme
   ========================================== */

:root {
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Premium Light Palette (iOS-Inspired) */
  --bg-page: #F2F2F7;
  --bg-card: #FFFFFF;
  --bg-subtle: #E5E5EA;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: #000000;
  
  --text-main: #000000;
  --text-muted: #8E8E93;
  --text-light: #AEAEB2;

  --accent-primary: #000000;
  --accent-primary-hover: #333333;
  --accent-secondary: #FF3B30; /* Vibrant Red-Orange */
  --accent-green: #34C759;
  --accent-green-bg: #E8F5E9;
  
  /* Ultra-soft, diffused shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.1);
  
  /* Modern Squircles */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --radius-full: 9999px;

  /* Premium Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --glass-blur: blur(24px) saturate(180%);

  --timer-bg: #FFF8E1;
  --timer-text: #F57F17;
  --timer-border: #FFE082;
}

[data-theme="dark"] {
  --bg-page: #000000;
  --bg-card: #1C1C1E;
  --bg-subtle: #2C2C2E;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #FFFFFF;

  --text-main: #FFFFFF;
  --text-muted: #8E8E93;
  --text-light: #636366;

  --accent-primary: #FFFFFF;
  --accent-primary-hover: #E5E5E5;
  --accent-secondary: #FF453A;
  --accent-green: #30D158;
  --accent-green-bg: #1B2E1C;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.9);

  --glass-bg: rgba(28, 28, 30, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(24px) saturate(180%);

  --timer-bg: #2B2100;
  --timer-text: #FFD54F;
  --timer-border: #4A3A00;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

input, button, textarea {
  font: inherit;
}

.app-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

#paste-panel .input-card-container,
#paste-panel #history-section,
#paste-panel .feed-header-visual {
  max-width: 760px;
  margin: 0 auto 24px auto;
}

#cook-panel {
  max-width: 780px;
  margin: 0 auto;
}

/* --- Header & Navigation --- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.brand:active {
  transform: scale(0.96);
  opacity: 0.75;
}

.logo-icon {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--text-main);
  color: var(--bg-card);
}

.logo-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-color);
  background-color: #FFFFFF;
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.logo-accent {
  color: var(--accent-secondary);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-pill-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-pill-button:hover {
  border-color: var(--text-main);
  transform: translateY(-1px);
}

.icon-pill-button.active {
  background: var(--text-main);
  color: var(--bg-card);
  border-color: var(--text-main);
}

/* --- Hero Section --- */
.hero-card {
  text-align: center;
  margin-bottom: 20px;
  padding: 10px 0;
}

.hero-card h1 {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

/* --- Feed & Panel Headers (Left-Aligned Minimal) --- */
.feed-header-visual {
  text-align: left;
  margin-bottom: 20px;
  padding: 12px 4px;
}

.feed-header-visual h2 {
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.feed-header-visual .lede {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin: 0;
}

/* --- App Intro Card --- */
.app-intro-card {
  background: linear-gradient(135deg, rgba(212, 101, 74, 0.05) 0%, rgba(243, 241, 241, 0.5) 100%);
  border: 1px solid rgba(212, 101, 74, 0.12);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.dark-mode .app-intro-card {
  background: linear-gradient(135deg, rgba(224, 86, 56, 0.1) 0%, rgba(30, 30, 30, 0.6) 100%);
  border-color: rgba(224, 86, 56, 0.2);
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212, 101, 74, 0.1);
  color: var(--accent-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
}

.dark-mode .intro-badge {
  background: rgba(224, 86, 56, 0.2);
  color: #FF7B54;
}

.app-intro-card h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.app-intro-card p {
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0;
}

/* --- Input Mode Switcher (Stacked Card Buttons) --- */
.input-mode-switch {
  display: flex;
  gap: 12px;
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-bottom: 20px;
}

.mode-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 72px;
}

.mode-pill i {
  font-size: 1.4rem;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.mode-pill:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
}

.mode-pill:hover i {
  color: var(--accent-primary);
  transform: translateY(-2px);
}

.mode-pill.active {
  background: var(--bg-card);
  border-color: var(--accent-primary);
  color: var(--text-main);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--accent-primary);
}

.mode-pill.active i {
  color: var(--accent-primary);
}

.input-mode-section {
  animation: fadeIn 0.25s ease;
}

/* --- Navigation Tabs --- */
.tabs {
  display: flex;
  justify-content: center;
  gap: 32px;
  background: transparent;
  padding: 0;
  border-bottom: 2px solid var(--border-color);
  border-radius: 0;
  margin-bottom: 32px;
}

.tab-button {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; /* aligns with container border */
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-button:hover {
  color: var(--accent-primary);
}

.tab-button.active {
  background: transparent;
  color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
  font-weight: 600;
}

.tab-icon {
  font-size: 1.1rem;
}

/* --- Panels --- */
.panel {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Card Base --- */
.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

/* --- Input Elements --- */
.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  margin-top: 20px;
}

.input-label:first-child {
  margin-top: 0;
}

.input-with-button {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.source-input, textarea:not(.text-edit-editorial-textarea), .title-input {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:not(.text-edit-editorial-textarea) {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.source-input:focus, textarea:not(.text-edit-editorial-textarea):focus, .title-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

/* --- Photo OCR Dragzone --- */
/* --- Photo OCR Action Cards --- */
.photo-scan-box {
  margin-bottom: 20px;
}

.photo-options-grid {
  display: flex;
  gap: 16px;
  width: 100%;
}

.photo-option-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
  min-height: 120px;
}

.photo-option-card i {
  font-size: 2.2rem;
  color: var(--accent-primary);
  margin-bottom: 10px;
  transition: transform 0.2s ease;
}

.photo-option-card strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.photo-option-card span {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.photo-option-card:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.photo-option-card:hover i {
  transform: scale(1.08);
}

.photo-help-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 14px;
  margin-bottom: 0;
  width: 100%;
}

.hidden-file-input {
  display: none;
}

.ocr-progress-bar {
  margin-top: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-full);
  height: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.ocr-progress-fill {
  height: 100%;
  background: var(--text-main);
  width: 0%;
  transition: width 0.3s ease;
}

.ocr-progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-main);
  mix-blend-mode: difference;
}
/* --- Extraction Progress Bar --- */
.extraction-progress {
  margin-top: 16px;
  animation: fadeInUp 0.3s ease;
}

.extraction-progress-bar {
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.extraction-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #e87c5f);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.extraction-progress-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Translation Toast --- */
.translation-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 16px);
  padding: 14px 20px;
  min-width: 280px;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: toastSlideUp 0.35s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.translation-toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

.translation-toast.toast-success .translation-toast-fill {
  background: linear-gradient(90deg, #34c759, #30d158) !important;
}

.translation-toast.toast-success .translation-toast-status i {
  color: #34c759;
}

.translation-toast.toast-error .translation-toast-status i {
  color: var(--danger, #e74c3c);
}

.translation-toast-bar {
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  height: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.translation-toast-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), #e87c5f);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.translation-toast-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
}

@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(30px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- Buttons --- */
.primary-button, .secondary-button, .ghost-button, .save-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: none;
}

.primary-button {
  background: var(--text-main);
  color: var(--bg-card);
}

.primary-button:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.primary-button:active, .secondary-button:active, .ghost-button:active, .save-button:active, .icon-pill-button:active {
  transform: scale(0.96) !important;
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.secondary-button {
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.secondary-button:hover {
  border-color: var(--text-main);
}

.ghost-button {
  background: transparent;
  color: var(--text-muted);
}

.ghost-button:hover {
  color: var(--text-main);
}

.save-button {
  background: var(--text-main);
  color: var(--bg-card);
}

.save-button:hover {
  opacity: 0.9;
}

.mini-btn {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.small-button {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.small-button:hover {
  border-color: var(--text-main);
}

.small-button.danger {
  color: #D32F2F;
  border-color: rgba(211, 47, 47, 0.2);
}

.small-button.danger:hover {
  background: #FFEBEE;
}

/* Edit Servings Premium Pill Control */
.edit-servings-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: var(--radius-full, 9999px);
  background: var(--bg-subtle, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.edit-servings-pill:focus-within {
  border-color: var(--text-main, #111827);
}

.edit-servings-icon {
  color: var(--text-muted, #6b7280);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.edit-servings-num {
  width: 38px;
  height: 26px;
  padding: 0 2px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  background: var(--bg-card, #ffffff);
  color: var(--text-main, #111827);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease;
}

.edit-servings-num:focus {
  border-color: var(--accent-primary, #000000);
}

.edit-servings-num::-webkit-inner-spin-button,
.edit-servings-num::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.edit-servings-num[type=number] {
  -moz-appearance: textfield;
}

.portion-type-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-main, #111827);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.portion-type-trigger:hover {
  background: rgba(0, 0, 0, 0.05);
}

.portion-type-trigger i {
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  transition: transform 0.2s ease;
}

.custom-portion-dropdown.open .portion-type-trigger i {
  transform: rotate(180deg);
}

.portion-type-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  min-width: 140px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.portion-type-option {
  background: none;
  border: none;
  padding: 7px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-main, #111827);
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.15s ease;
  width: 100%;
}

.portion-type-option:hover {
  background: var(--bg-subtle, #f3f4f6);
}

.portion-type-option i:not(.check-icon) {
  font-size: 0.95rem;
  color: var(--text-muted, #6b7280);
}

.portion-type-option .check-icon {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--accent-primary, #000);
  opacity: 0;
}

.portion-type-option.active {
  background: var(--bg-subtle, #f3f4f6);
  font-weight: 600;
}

.portion-type-option.active .check-icon {
  opacity: 1;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ==========================================
   High-End Community Social Feed (Nordic Style)
   ========================================== */
.feed-container {
  max-width: 1200px;
  margin: 0 auto;
}

.feed-header-overlay {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
  font-family: var(--font-serif);
  font-weight: 600;
}

.feed-refresh-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.feed-refresh-btn:hover {
  border-color: var(--text-main);
}

.swipe-feed-list {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  width: 100%;
}

.feed-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.feed-card {
  position: relative;
  background: transparent;
  border: none;
  overflow: visible;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.feed-card:hover {
  transform: translateY(-4px) scale(1.015);
}

.feed-image-wrap {
  position: relative;
  width: 100%;
  height: auto;
  background: var(--bg-subtle);
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.3s ease;
}

.feed-card:hover .feed-image-wrap {
  box-shadow: var(--shadow-lg);
}

.feed-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: var(--radius-md);
}

.feed-card:hover .feed-image {
  transform: scale(1.03);
}

/* Feed Info Content Box below Image */
.feed-info {
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-author-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  background: rgba(212, 101, 74, 0.06);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-primary);
  border: 1px solid rgba(212, 101, 74, 0.12);
}

.feed-author-badge.user-source {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.feed-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card Stats Row (Pill Chips Layout) */
.card-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.card-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
}

.card-stat-chip i {
  font-size: 0.85rem;
}

.card-stat-chip.ingredients-chip {
  background: rgba(30, 144, 255, 0.07);
  color: #1e70c8;
}

.card-stat-chip.steps-chip {
  background: rgba(212, 101, 74, 0.07);
  color: var(--accent-primary);
}

.card-stat-chip.time-chip {
  background: rgba(46, 139, 87, 0.07);
  color: #2e8b57;
}

/* Floating Action Controls on Card (Glassmorphism) */
.feed-floating-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 3;
}

.glass-action-btn {
  height: 32px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #1a1a1a;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.glass-action-btn:hover {
  background: #FFFFFF;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.glass-action-btn i {
  font-size: 1.05rem;
  color: #555;
  transition: color 0.25s ease, transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-action-btn:hover i {
  color: #E23E57;
  transform: scale(1.15);
}

.glass-action-btn.upvoted {
  background: #FFFFFF;
  color: #E23E57;
  border-color: rgba(226, 62, 87, 0.3);
  box-shadow: 0 4px 12px rgba(226, 62, 87, 0.15);
}

.glass-action-btn.upvoted i {
  color: #E23E57;
}

.dark-mode .glass-action-btn {
  background: rgba(26, 26, 26, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  color: #f1f1f1;
}

.dark-mode .glass-action-btn i {
  color: #ccc;
}

.dark-mode .glass-action-btn:hover {
  background: #1a1a1a;
}

.dark-mode .glass-action-btn.upvoted {
  background: #1a1a1a;
  color: #FF5A5F;
  border-color: rgba(255, 90, 95, 0.3);
}

.dark-mode .glass-action-btn.upvoted i {
  color: #FF5A5F;
}

.action-count {
  font-size: 0.8rem;
  font-weight: 700;
}

.feed-floating-actions .like-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.feed-floating-actions .like-btn:hover {
  background: transparent !important;
  transform: translateY(-2px) scale(1.15) !important;
  box-shadow: none !important;
}

.feed-floating-actions .like-btn i {
  font-size: 1.65rem !important;
  color: #ffffff !important;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.7)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)) !important;
  transition: color 0.25s ease, transform 0.2s ease !important;
}

.feed-floating-actions .like-btn:hover i {
  color: #FF5A5F !important;
  transform: scale(1.15);
}

.feed-floating-actions .like-btn.upvoted i {
  color: #E23E57 !important;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) !important;
}

.dark-mode .feed-floating-actions .like-btn.upvoted i {
  color: #FF5A5F !important;
}

.feed-floating-actions .upvotes-count {
  display: none !important;
}

.feed-cook-btn {
  background: var(--accent-primary);
  color: #FFFFFF;
  border: none;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(212, 101, 74, 0.25);
  transition: all 0.2s ease;
  width: 100%;
}

.feed-cook-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
}

/* --- Drawer Modal Overlay --- */
.recipe-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-card);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.recipe-drawer.open {
  transform: translateY(0);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.drawer-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.drawer-header h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-content {
  padding: 24px;
  overflow-y: auto;
}

.drawer-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 12px;

  display: flex;
  align-items: center;
  gap: 6px;
}

.drawer-content h4:first-child {
  margin-top: 0;
}

.drawer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.drawer-list-item {
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

/* --- Cooking Mode View --- */
.recipe-header-card {
  padding: 12px 16px;
}

.recipe-hero-container {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  position: relative;
}

.hero-image-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.recipe-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Glassmorphic Floating Buttons on Hero Image */
.image-floating-btn {
  position: absolute;
  top: 12px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 10;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-floating-btn:hover {
  background: var(--bg-card);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

/* Glassmorphic Like Button on Cover Photo */
.recipe-image-like-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  color: #18181b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.recipe-image-like-btn:hover {
  transform: translateY(-1px) scale(1.05);
  background: #ffffff;
}

.recipe-image-like-btn:active {
  transform: scale(0.95);
}

.recipe-image-like-btn.upvoted {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(244, 63, 94, 0.35);
  color: #f43f5e;
}

.recipe-image-like-btn i {
  color: #f43f5e;
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.recipe-image-like-btn.upvoted i {
  color: #f43f5e;
}

.recipe-image-like-btn:hover i {
  transform: scale(1.15);
}

/* Glassmorphic Change Cover Button - visible during Edit Mode */
.change-hero-photo-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #121212 !important;
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.change-hero-photo-btn i {
  font-size: 1.1rem;
  color: #121212 !important;
}

.change-hero-photo-btn:hover {
  background: #ffffff !important;
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.dark-mode .change-hero-photo-btn {
  background: rgba(24, 24, 27, 0.92) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.dark-mode .change-hero-photo-btn i {
  color: #ffffff !important;
}

.dark-mode .change-hero-photo-btn:hover {
  background: #ffffff !important;
  color: #121212 !important;
}

.dark-mode .change-hero-photo-btn:hover i {
  color: #121212 !important;
}

/* Visible during Edit Mode */
.is-editing-recipe .change-hero-photo-btn,
#cook-panel.is-editing-recipe .change-hero-photo-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Placeholder for No Image State */
.hero-placeholder-wrap {
  width: 100%;
  height: 100%;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 16px;
}

.hero-placeholder-wrap:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
}

.hero-placeholder-wrap i {
  font-size: 2rem;
  color: var(--accent-primary);
}

.hero-placeholder-wrap strong {
  font-size: 0.88rem;
  color: var(--text-main);
}

.hero-placeholder-wrap span {
  font-size: 0.74rem;
}

/* --- Header Top: Title + Icon Actions --- */
.recipe-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.title-meta {
  flex: 1;
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.title-row .title-input {
  flex-grow: 1;
}

#recipe-desc-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease, transform 0.2s ease;
}

#recipe-desc-btn:hover {
  color: var(--accent-primary);
  transform: scale(1.1);
}

.title-input {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  background: transparent !important;
  border: none !important;
  padding: 0 4px !important;
  margin-top: 4px;
  margin-left: -4px;
  border-bottom: 1px dashed transparent !important;
  min-height: unset !important;
  height: auto;
  resize: none !important;
  overflow: hidden !important;
  line-height: 1.3 !important;
  box-shadow: none !important;
}

.title-input[readonly] {
  cursor: default;
}
.title-input:not([readonly]) {
  cursor: text;
  border-bottom: 1px dashed var(--border-color) !important;
}
.title-input:not([readonly]):hover, .title-input:not([readonly]):focus {
  border-bottom-color: var(--text-main) !important;
  box-shadow: none !important;
}

.source-preview {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 4px;
  word-break: break-all;
  overflow-wrap: break-word;
  max-width: 100%;
}

.source-preview:hover {
  color: var(--text-main);
  text-decoration: underline;
}

.meta-links-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.meta-prep-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.header-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* --- Premium Language Picker --- */
.lang-picker {
  position: relative;
}

.lang-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.lang-picker-trigger:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(212, 101, 74, 0.12);
}

.lang-picker-caret {
  font-size: 0.7rem;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.lang-picker[data-open="true"] .lang-picker-caret {
  transform: rotate(180deg);
}

.lang-picker-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  padding: 6px;
  animation: langDropIn 0.2s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.lang-picker-dropdown.hidden {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-md, 10px);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.lang-option:hover {
  background: var(--bg-subtle);
}

.lang-option.active {
  background: rgba(212, 101, 74, 0.08);
}

.lang-option.active .lang-code {
  color: var(--accent-primary);
}

.lang-code {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 24px;
  letter-spacing: 0.04em;
}

.lang-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

@keyframes langDropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- More Options Dropdown --- */
.recipe-more-options {
  position: relative;
}

.more-options-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg, 14px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  min-width: 170px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  animation: langDropIn 0.2s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.more-options-menu.hidden {
  display: none !important;
}

.more-options-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text-main);
  text-align: left;
  width: 100%;
  border-radius: var(--radius-md, 10px);
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.more-options-menu .dropdown-item:hover {
  background: var(--bg-subtle);
}

.more-options-menu .dropdown-item i {
  font-size: 1.15rem;
  color: var(--text-muted);
}

.more-options-menu .dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 6px 0;
}

.header-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.header-icon-btn:hover {
  border-color: var(--text-main);
  color: var(--text-main);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.recipe-visibility-toggle {
  cursor: pointer;
  user-select: none;
}

.recipe-visibility-toggle.active {
  background: #059669 !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.3) !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

#save-button {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#save-button:hover {
  background: transparent !important;
  transform: translateY(-2px) scale(1.15) !important;
  box-shadow: none !important;
}

#save-button i {
  font-size: 1.65rem !important;
  color: #ffffff !important;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.7)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85)) !important;
  transition: color 0.25s ease, transform 0.2s ease !important;
}

#save-button:hover i {
  color: #FFB800 !important;
  transform: scale(1.15);
}

#save-button.saved {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

#save-button.saved i {
  color: #FFB800 !important;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7)) !important;
}

#save-button.saving {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

/* --- Unified Recipe Dashboard Card --- */
.recipe-dashboard-card {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.3s ease;
}

[data-theme="dark"] .recipe-dashboard-card {
  background: rgba(30, 30, 30, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.dashboard-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.dashboard-stats-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-item i {
  font-size: 0.95rem;
  color: var(--accent-primary);
}

.stat-divider {
  color: var(--border-color);
  font-size: 0.8rem;
  user-select: none;
}

.dashboard-stats-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
}

.mini-progress-ring {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.mini-progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--bg-subtle);
  stroke-width: 3.5;
}

.ring-fill {
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.4s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner-icon {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* --- Toolbar v2 --- */
.recipe-toolbar-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.servings-control-v2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label-v2 {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.servings-trigger-btn-v2 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 44px;
  text-align: center;
}

.servings-trigger-btn-v2:hover {
  background: var(--border-color);
  color: var(--text-main);
}

.base-servings-input {
  width: 50px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}

.base-servings-input:focus {
  border-color: var(--accent-primary);
}

.drawer-body-servings {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 10px 0;
}

.slider-container-drawer {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-subtle);
  padding: 10px 16px;
  border-radius: var(--radius-full);
}

.slider-value-drawer {
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 32px;
  text-align: center;
  color: var(--text-main);
}

.servings-slider-drawer {
  flex: 1;
  height: 6px;
  border-radius: var(--radius-full);
  outline: none;
  accent-color: var(--accent-primary);
  cursor: pointer;
  background: var(--border-color);
  -webkit-appearance: none;
}

.servings-slider-drawer::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--border-color);
  border-radius: var(--radius-full);
}

.servings-slider-drawer::-webkit-slider-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px;
}

.quick-servings-grid-drawer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quick-serving-btn-drawer {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.quick-serving-btn-drawer:hover {
  background: var(--bg-subtle);
}

.quick-serving-btn-drawer.active {
  background: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

.view-mode-toggle-v2 {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}

.toggle-mode-btn-v2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-mode-btn-v2.active {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.toggle-mode-btn-v2:hover:not(.active) {
  color: var(--text-main);
}

/* --- Unit Toggle System --- */
.unit-toggle-v2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-group-v2 {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  padding: 3px;
}

.unit-btn-v2 {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-btn-v2:hover {
  color: var(--text-main);
}

.unit-btn-v2.active {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.unit-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.unit-toggle-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-focus);
}

/* --- Progress Bar (kept for JS compat, hidden) --- */
.recipe-progress-container {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}
.recipe-progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.recipe-progress-percentage {
  font-weight: 600;
  color: var(--text-main);
}
.recipe-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.recipe-progress-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.servings-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.servo-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.servo-btn:hover {
  border-color: var(--text-main);
}

.servings-badge {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 4px;
}

.scale-preset-buttons {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.scale-pill-btn {
  border: 1px solid var(--border-color);
  background: transparent;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
}

.scale-pill-btn.active, .scale-pill-btn:hover {
  background: var(--text-main);
  color: var(--bg-card);
  border-color: var(--text-main);
}

.view-mode-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-full);
}

.toggle-mode-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-mode-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: var(--bg-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card.highlight {
  background: var(--text-main);
  color: var(--bg-card);
}

.stat-card.highlight strong, .stat-card.highlight span {
  color: var(--bg-card);
}

/* --- Checklist Items --- */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 1.45rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title h2 i {
  color: var(--accent-secondary);
}

.header-count-badge {
  font-size: 0.85rem;
  background: var(--bg-subtle);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-family: var(--font-sans);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid transparent;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.check-item:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

.check-item.completed {
  background: var(--accent-green-bg);
  border-left-color: var(--accent-green);
  opacity: 0.75;
}

.check-item.completed .editable-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.amount {
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* --- Ingredient Items (Matched with Focus Mode Warm Amber -> Herb Green) --- */
#ingredients-section-card .check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid rgba(234, 88, 12, 0.28);
  border-left: 1px solid rgba(234, 88, 12, 0.28);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.04);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
}

[data-theme="dark"] #ingredients-section-card .check-item {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(234, 88, 12, 0.35);
  color: #ffedd5;
}

#ingredients-section-card .check-item:hover {
  background: #ffedd5;
  border-color: #ea580c;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.1);
  transform: translateY(-1px);
}

[data-theme="dark"] #ingredients-section-card .check-item:hover {
  background: rgba(234, 88, 12, 0.2);
  border-color: #ea580c;
}

#ingredients-section-card .check-item:active {
  transform: scale(0.99);
}

#ingredients-section-card .check-item .amount {
  font-weight: 700;
  color: var(--accent, #ea580c);
}

#ingredients-section-card .check-item .editable-text {
  font-weight: 500;
}

/* Checked / Done State for ingredients */
#ingredients-section-card .check-item.completed {
  background: #f0fdf4 !important;
  border-color: rgba(22, 163, 74, 0.32) !important;
  box-shadow: none;
  opacity: 0.9;
  transform: none;
}

[data-theme="dark"] #ingredients-section-card .check-item.completed {
  background: rgba(22, 163, 74, 0.14) !important;
  border-color: rgba(22, 163, 74, 0.35) !important;
}

#ingredients-section-card .check-item.completed:hover {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
}

[data-theme="dark"] #ingredients-section-card .check-item.completed:hover {
  background: rgba(22, 163, 74, 0.22) !important;
}

#ingredients-section-card .check-item.completed .editable-text {
  text-decoration: line-through;
  color: #15803d;
}

[data-theme="dark"] #ingredients-section-card .check-item.completed .editable-text {
  color: #86efac;
}

#ingredients-section-card .check-item.completed .amount {
  text-decoration: line-through;
  color: #16a34a;
}

[data-theme="dark"] #ingredients-section-card .check-item.completed .amount {
  color: #4ade80;
}

.list-view-container.is-editing-recipe #ingredients-section-card .check-item {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  box-shadow: none !important;
  cursor: pointer;
}

/* --- Step layout & numbers --- */
.check-item-body.step-layout {
  display: grid !important;
  grid-template-columns: auto 1fr;
  align-items: start !important;
  gap: 12px !important;
}

.check-item-body.step-layout .editable-text {
  width: auto !important;
  line-height: 1.5;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: rgba(212, 101, 74, 0.08);
  color: var(--accent-primary);
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.2s ease;
}

.check-item.completed .step-badge {
  background: rgba(46, 139, 87, 0.1);
  color: var(--accent-green);
}

.action-icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.action-icon-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.delete-btn:hover {
  color: #D32F2F !important;
  background: rgba(211, 47, 47, 0.1) !important;
}

.edit-btn:hover {
  color: var(--text-main) !important;
  background: var(--bg-subtle) !important;
}

/* --- Seamless Pill Focus in Edit Mode --- */
.check-item {
  position: relative;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease !important;
}

.check-item.is-editing-active,
.check-item:has(.editable-text[contenteditable="true"]:focus) {
  background: var(--bg-card, #ffffff) !important;
  border-left: 3px solid var(--accent-primary) !important;
  box-shadow: 0 0 0 2px rgba(230, 92, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08) !important;
  transform: translateY(-1px);
  z-index: 5;
}

.editable-text[contenteditable="true"] {
  outline: none !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  display: inline-block;
  width: 100%;
  line-height: 1.5;
  color: var(--text-main);
  caret-color: var(--accent-primary, #e65c00);
  user-select: text;
}

.check-label {
  flex: 1;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* --- Focus Mode View --- */
.focus-view {
  text-align: center;
  padding: 40px 24px;
}

.focus-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.focus-step-badge {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.focus-exit-btn {
  border: none;
  background: var(--bg-subtle);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: all 0.2s ease;
}

.focus-exit-btn:hover {
  background: var(--border-color);
}

.focus-step-text {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  line-height: 1.4;
  margin-bottom: 32px;
}

.focus-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
}

/* --- Focus Mode: Linked Ingredients --- */
.focus-step-ingredients {
  margin: 0 0 28px 0;
}

.focus-ing-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.focus-ing-group:last-child {
  margin-bottom: 0;
}

.prior-group {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border-color);
  width: 100%;
}

.focus-step-ingredients:empty {
  display: none;
  margin: 0;
}

.focus-ing-label {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-main);
  margin-bottom: 4px;
}

.prior-group .focus-ing-label {
  color: var(--text-muted);
  opacity: 0.6;
}

.focus-check-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.new-group .focus-ing-label {
  color: #c2410c;
}

[data-theme="dark"] .new-group .focus-ing-label {
  color: #fb923c;
}

.focus-ing-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 1rem;
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: focusIngFadeIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  box-sizing: border-box;
  text-align: left;
}

.focus-ing-pill:active {
  transform: scale(0.98);
}

.focus-ing-pill .focus-ing-amount {
  font-weight: 700;
  color: var(--accent, #ea580c);
}

.focus-ing-pill .focus-ing-name {
  font-weight: 500;
  text-align: left;
}

/* Active / Add Now - Warm Amber Culinary Tone */
.focus-ing-pill--active {
  background: #fff7ed;
  border: 1px solid rgba(234, 88, 12, 0.28);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.06);
}

[data-theme="dark"] .focus-ing-pill--active {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(234, 88, 12, 0.35);
  color: #ffedd5;
}

.focus-ing-pill--active:hover {
  background: #ffedd5;
  border-color: #ea580c;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.12);
  transform: translateY(-1px);
}

[data-theme="dark"] .focus-ing-pill--active:hover {
  background: rgba(234, 88, 12, 0.2);
  border-color: #ea580c;
}

.focus-ing-pill--active .focus-check-icon {
  color: #ea580c;
}

/* Checked / Done - Fresh Herb / Mint Green */
.focus-ing-pill--checked {
  background: #f0fdf4 !important;
  border: 1px solid rgba(22, 163, 74, 0.32) !important;
  box-shadow: none;
  opacity: 0.9;
}

[data-theme="dark"] .focus-ing-pill--checked {
  background: rgba(22, 163, 74, 0.14) !important;
  border-color: rgba(22, 163, 74, 0.35) !important;
}

.focus-ing-pill--checked:hover {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
}

[data-theme="dark"] .focus-ing-pill--checked:hover {
  background: rgba(22, 163, 74, 0.22) !important;
}

.focus-ing-pill--checked .focus-check-icon {
  color: #16a34a;
}

.focus-ing-pill--checked .focus-ing-name {
  text-decoration: line-through;
  color: #15803d;
}

[data-theme="dark"] .focus-ing-pill--checked .focus-ing-name {
  color: #86efac;
}

.focus-ing-pill--checked .focus-ing-amount {
  text-decoration: line-through;
  color: #16a34a;
}

[data-theme="dark"] .focus-ing-pill--checked .focus-ing-amount {
  color: #4ade80;
}

/* Prior Steps / Already Prepared */
.focus-ing-pill--prior {
  opacity: 0.65;
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.focus-ing-pill--prior .focus-check-icon {
  color: var(--text-muted);
  opacity: 0.7;
}

.focus-ing-pill--prior .focus-ing-amount {
  color: var(--text-muted);
}

.focus-ing-pill--prior:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

@keyframes focusIngFadeIn {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Saved Recipes Grid --- */
.saved-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.saved-recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.saved-recipe-card:hover {
  transform: translateY(-3px);
  border-color: var(--text-main);
  box-shadow: var(--shadow-md);
}

.saved-card-image-wrap {
  width: 100%;
  height: 140px;
  background: var(--bg-subtle);
  overflow: hidden;
  position: relative;
}

.saved-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.saved-recipe-card:hover .saved-card-image {
  transform: scale(1.05);
}

.saved-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.saved-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8rem;
}

/* Floating Actions inside Saved Cards */
.saved-floating-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}

.delete-saved-btn {
  display: none !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: rgba(255, 255, 255, 0.9) !important;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
}

#saved-panel.is-editing-saved .delete-saved-btn {
  display: inline-flex !important;
}

.delete-saved-btn i {
  font-size: 1.35rem;
}

.delete-saved-btn:hover {
  color: #ef4444 !important;
  transform: scale(1.15) !important;
  filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.35));
}

.delete-saved-btn:active {
  transform: scale(0.9) !important;
}

/* Recipe Card Shopping List & Public Badges */
.feed-card-badges-top {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 4;
  pointer-events: none;
}

.feed-card-badges-top > * {
  pointer-events: auto;
}

.feed-card-badges-top .feed-shopping-badge {
  position: static;
  top: auto;
  right: auto;
}

.feed-public-badge {
  width: 28px;
  height: 28px;
  background: rgba(5, 150, 105, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  user-select: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  flex-shrink: 0;
}

.feed-public-badge i {
  font-size: 0.92rem;
}

.feed-shopping-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(224, 49, 49, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 4px 9px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.35);
  z-index: 4;
  letter-spacing: 0.02em;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.feed-shopping-badge:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.feed-shopping-badge:active {
  transform: scale(0.95);
}

.feed-shopping-badge i {
  font-size: 0.85rem;
}

.feed-shopping-badge.complete {
  background: rgba(16, 185, 129, 0.95);
  border-color: rgba(255, 255, 255, 0.4);
}

#saved-panel.is-editing-saved .feed-card-badges-top,
#saved-panel.is-editing-saved .feed-shopping-badge,
#saved-panel.is-editing-saved .feed-public-badge {
  display: none !important;
}

/* --- Timers Dock (Floating PiP overlay) --- */
.timers-dock {
  position: fixed;
  bottom: 92px; /* Default above mobile bottom nav bar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  touch-action: none;
}

.timers-dock.is-dragging {
  user-select: none;
  -webkit-user-select: none;
}

@media (min-width: 768px) {
  .timers-dock {
    bottom: 36px;
    right: 36px;
    left: auto;
    transform: none;
  }
}

.timers-container {
  display: flex;
  flex-direction: column-reverse;
  gap: 14px;
}

/* Premium Floating Circular Timer Widget */
.floating-timer-widget {
  pointer-events: auto;
  touch-action: none;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--bg-card, #ffffff);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 
    0 12px 28px -4px rgba(0, 0, 0, 0.12),
    0 4px 10px -2px rgba(0, 0, 0, 0.06),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  isolation: isolate;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  animation: timerSpringIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

[data-theme="dark"] .floating-timer-widget,
.dark-mode .floating-timer-widget {
  background: var(--bg-card, #1c1c20);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 16px 36px -4px rgba(0, 0, 0, 0.5),
    0 6px 14px -2px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.floating-timer-widget.is-dragging {
  cursor: grabbing !important;
  transform: scale(1.08) !important;
  box-shadow: 
    0 26px 52px -4px rgba(0, 0, 0, 0.28),
    0 0 0 2.5px var(--accent-primary, #ff5722) !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

@keyframes timerSpringIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
    filter: blur(8px);
  }
  70% {
    opacity: 1;
    transform: scale(1.06);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

.timer-progress-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 2.8;
}

[data-theme="dark"] .timer-ring-bg,
.dark-mode .timer-ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.timer-ring-fill {
  fill: none;
  stroke-width: 2.8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.85s cubic-bezier(0.4, 0, 0.2, 1);
}

.timer-widget-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  text-align: center;
  pointer-events: none;
  padding: 0 4px;
}

.timer-widget-sublabel {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #888);
  margin-bottom: 1px;
  line-height: 1;
}

.timer-widget-time {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.timer-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.45;
  margin-top: 1px;
  line-height: 1;
  transition: opacity 0.2s ease;
}

.floating-timer-widget:hover .timer-drag-handle {
  opacity: 0.9;
}

.timer-widget-close-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text-main, #222);
  color: var(--bg-card, #fff);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
  opacity: 0.85;
  transform: scale(0.9);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 20;
}

.floating-timer-widget:hover .timer-widget-close-btn {
  opacity: 1;
  transform: scale(1.1);
}

.timer-widget-close-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
  transform: scale(1.2) !important;
}

/* Desktop sizing & scaling */
@media (min-width: 768px) {
  .floating-timer-widget {
    width: 112px;
    height: 112px;
  }

  .timer-ring-bg,
  .timer-ring-fill {
    stroke-width: 3.2;
  }

  .timer-widget-sublabel {
    font-size: 0.72rem;
    margin-bottom: 2px;
  }

  .timer-widget-time {
    font-size: 1.55rem;
    letter-spacing: -0.025em;
  }

  .timer-drag-handle {
    font-size: 0.82rem;
    margin-top: 2px;
  }

  .timer-widget-close-btn {
    top: -5px;
    right: -5px;
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
  }
}

/* Finished / Alert state */
.floating-timer-widget.finished {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  animation: pulseGreenGlow 1.6s infinite ease-in-out;
}

[data-theme="dark"] .floating-timer-widget.finished,
.dark-mode .floating-timer-widget.finished {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
}

.floating-timer-widget.finished .timer-widget-sublabel {
  color: #10b981;
}

.floating-timer-widget.finished .timer-widget-time {
  color: #10b981;
  font-weight: 800;
}

.floating-timer-widget.finished .timer-ring-fill {
  stroke: #10b981 !important;
}

@keyframes pulseGreenGlow {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45), 0 16px 36px -4px rgba(0, 0, 0, 0.14); }
  70% { box-shadow: 0 0 0 14px rgba(16, 185, 129, 0), 0 20px 42px -4px rgba(0, 0, 0, 0.2); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0), 0 16px 36px -4px rgba(0, 0, 0, 0.14); }
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .app-wrapper {
    padding: 0 8px 90px;
  }

  .top-nav {
    padding: 16px 4px;
    margin-bottom: 12px;
  }

  .logo-text {
    font-size: 1.3rem;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
  }

  .icon-pill-button .label {
    display: none;
  }

  .icon-pill-button {
    padding: 8px;
    border-radius: var(--radius-full);
  }

  #lang-picker-trigger .ph-globe {
    display: none;
  }

  #lang-picker-trigger .label {
    display: inline-block !important;
  }

  #lang-picker-trigger {
    padding: 0 10px;
    border-radius: 18px;
    height: 36px;
  }

  .feed-header-visual {
    margin-bottom: 12px;
    padding: 8px 4px;
  }

  .feed-header-visual h2 {
    font-size: 1.25rem;
  }

  .feed-header-visual .lede {
    font-size: 0.8rem;
  }

  .app-intro-card {
    padding: 14px 16px;
    margin-bottom: 16px;
  }

  .app-intro-card h3 {
    font-size: 1.02rem;
  }

  .app-intro-card p {
    font-size: 0.8rem;
    line-height: 1.4;
  }

  .hero-card {
    margin-bottom: 20px;
    padding: 10px 4px;
  }

  .hero-card h1 {
    font-size: 1.65rem;
    line-height: 1.2;
  }

  .hero-card .lede {
    font-size: 0.92rem;
  }

  /* Horizontally scrollable pill tabs on mobile (No wrapping!) */
  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding: 4px;
    margin-bottom: 20px;
    gap: 6px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 10px 16px;
    font-size: 0.82rem;
  }

  /* Card padding on mobile */
  .card-box {
    padding: 16px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }

  #paste-panel textarea {
    min-height: 110px !important; /* Shorter textarea to keep submit button above the fold */
    padding: 10px 14px;
  }

  .input-with-button {
    flex-direction: column;
    gap: 8px;
  }

  .input-with-button button {
    width: 100%;
  }

  .actions {
    flex-direction: column;
    gap: 10px;
  }

  .primary-button, .secondary-button, .ghost-button {
    width: 100%;
  }

  /* Feed card mobile optimization */
  .feed-container {
    max-width: 100%;
  }

  .swipe-feed-list {
    display: flex;
    gap: 8px;
  }

  .feed-column {
    gap: 8px;
  }

  .feed-image-wrap {
    height: auto;
  }

  .feed-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
  }

  .feed-summary {
    font-size: 0.82rem;
    margin-bottom: 12px;
  }

  .feed-gradient-overlay {
    padding: 16px;
  }

  .glass-action-btn {
    height: 28px;
    padding: 0 10px;
    font-size: 0.85rem;
  }

  .feed-floating-actions .like-btn {
    width: 32px !important;
    height: 32px !important;
  }
  .feed-floating-actions .like-btn i {
    font-size: 1.45rem !important;
  }

  .recipe-header-card {
    padding: 12px 14px;
  }

  .recipe-hero-container {
    height: 280px; /* Taller on mobile for premium feel */
    margin: 8px -14px 16px -14px; /* Break out of side padding only */
    width: calc(100% + 28px);
    border-radius: 0;
  }
  .recipe-hero-container .hero-image-wrap {
    border-radius: 0;
  }

  .recipe-header-top {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 6px;
  }

  .title-input {
    font-size: 1.3rem;
    width: 100%;
    margin-top: 0;
    line-height: 1.4 !important;
  }

  .header-actions-row {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-top: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
  }

  .header-icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .recipe-visibility-toggle {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Dashboard Card & Stats Row */
  .recipe-dashboard-card {
    padding: 6px 12px;
    margin-bottom: 8px;
    gap: 6px;
  }

  .dashboard-stats-row {
    padding-bottom: 8px;
  }

  .stat-item {
    font-size: 0.76rem;
  }

  .mini-progress-ring {
    width: 18px;
    height: 18px;
  }

  /* Toolbar - single row, space between */
  .recipe-toolbar-v2 {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .servings-control-v2 {
    gap: 4px;
  }

  .toolbar-label-v2, .lang-picker-v2 > span {
    display: none;
  }

  .servings-trigger-btn-v2 {
    padding: 6px 12px;
    font-size: 0.78rem;
    min-width: 40px;
  }

  .unit-toggle-v2 {
    gap: 4px;
  }

  .unit-btn-v2 {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 2px;
  }

  .view-mode-toggle-v2 {
    flex-shrink: 0;
  }

  .toggle-mode-btn-v2 {
    padding: 6px 10px;
    font-size: 0.78rem;
    gap: 2px;
  }

  .toggle-mode-btn-v2 span {
    display: none;
  }

  .stats-row {
    gap: 8px;
  }

  .stat-card {
    padding: 10px 6px;
  }

  .stat-card strong {
    font-size: 1.1rem;
  }

  .stat-card span {
    font-size: 0.68rem;
  }

  /* Hide top tab bar on mobile since bottom navigation bar takes over */
  nav.tabs {
    display: none;
  }

  /* Extra bottom padding so content doesn't get covered by fixed bottom nav */
  .app-shell {
    padding-bottom: 84px;
  }

  /* Touch-friendly button sizes */
  .primary-button, .secondary-button, .ghost-button, .save-button {
    min-height: 40px;
    font-size: 0.9rem;
    padding: 8px 16px;
  }

  .mode-pill {
    min-height: 60px;
    font-size: 0.76rem;
    padding: 10px 4px;
    gap: 6px;
  }

  .mode-pill i {
    font-size: 1.25rem;
  }

  .input-mode-switch {
    margin-bottom: 12px;
  }

  .tab-instruction {
    align-items: flex-start;
    padding: 10px 12px;
    font-size: 0.8rem;
    margin-bottom: 16px;
  }

  .tab-instruction i {
    margin-top: 2px;
    font-size: 1rem;
  }

  /* Mobile Focus Mode Enhancements */
  #mode-checklist {
    display: none !important;
  }

  .view-mode-toggle-v2 {
    background: transparent !important;
    padding: 0 !important;
  }

  #mode-focus {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #e05300 100%) !important;
    color: white !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    border-radius: var(--radius-full) !important;
    font-size: 0.85rem !important;
    box-shadow: var(--shadow-sm);
  }

  #mode-focus span {
    display: inline !important;
  }

  .focus-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 2000;
    background: var(--bg-page) !important;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: hidden; /* Prevent modal body scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
    animation: slideUpFocus 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes slideUpFocus {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .focus-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Keep header fixed height */
  }

  .focus-card-body {
    flex: 1;
    overflow-y: auto; /* Only body scrolls if content is too long */
    padding-right: 0;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE / Edge */
  }

  .focus-card-body::-webkit-scrollbar,
  .focus-view::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .focus-step-text {
    font-size: 1.15rem;
    line-height: 1.5;
    margin: 12px 0 20px 0;
    text-align: left; /* Keep left-aligned for easier reading */
  }

  .focus-controls {
    display: flex;
    gap: 12px;
    flex-shrink: 0; /* Keep controls fixed at bottom */
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
  }

  .focus-controls button {
    flex: 1;
    min-height: 46px;
    font-size: 0.9rem;
  }

  .focus-ing-pill {
    padding: 12px 14px !important;
    font-size: 0.95rem !important;
  }
}

/* --- Mobile Bottom Navigation Bar Base (Hidden on Desktop) --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 58px;
  background: var(--bg-card); /* Solid background */
  border-top: 1px solid var(--border);
  z-index: 1500;
  box-shadow: var(--shadow-md);
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  justify-content: space-around;
  align-items: center;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
}

.mobile-bottom-nav .tab-button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  opacity: 0.7; /* Make non-active icons slightly translucent */
}

.mobile-bottom-nav .tab-button .tab-icon {
  font-size: 2.15rem; /* Make icons bigger */
}

.mobile-bottom-nav .tab-button.active {
  color: var(--accent-secondary); 
  background: transparent;
  font-weight: 700;
  opacity: 1;
}

.mobile-bottom-nav .tab-button[data-tab="paste"] {
  opacity: 1;
  transform: translateY(-2px);
}

.mobile-bottom-nav .tab-button[data-tab="paste"] .tab-icon {
  font-size: 2.6rem; /* Even larger for the primary action */
  filter: drop-shadow(0 4px 8px rgba(255, 59, 48, 0.3)); /* Subtle glow matching accent color */
}

/* --- Full-Screen Image Lightbox Modal --- */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-modal.open .lightbox-img {
  transform: scale(1);
}

.lightbox-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #FFFFFF;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3001;
  transition: all 0.2s ease;
}

.lightbox-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.08);
}

.timer-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--timer-bg);
  border: 1px solid var(--timer-border);
  color: var(--timer-text);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  width: max-content;
  transition: all 0.2s ease;
}

.timer-trigger-btn:hover {
  opacity: 0.85;
}

/* --- Extraction History Section --- */
.history-section {
  margin-top: 24px;
  padding: 16px 20px;
}

.history-section.hidden {
  display: none !important;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.history-item:hover {
  background: var(--bg-card);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

.history-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--border-color);
  flex-shrink: 0;
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 3px 0;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.history-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0; /* Hidden by default, show on hover */
}

.history-item:hover .history-delete-btn {
  opacity: 1;
}

.history-delete-btn:hover {
  color: var(--accent-secondary);
  background: rgba(224, 86, 56, 0.08);
}

@media (max-width: 768px) {
  .history-delete-btn {
    opacity: 1; /* Always visible on mobile touch screens */
  }
}

/* --- Input Mode Instructions --- */
.tab-instruction {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: -4px;
  margin-bottom: 20px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-primary);
  font-weight: 500;
}

.tab-instruction i {
  font-size: 1.1rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}

/* --- Manual Recipe Creator Styles --- */
.manual-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  text-align: left;
}

.manual-form-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.manual-form-group label .required {
  color: var(--accent-primary);
}

.manual-form-group input[type="text"],
.manual-form-group input[type="number"],
.manual-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.manual-form-group input:focus,
.manual-form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.1);
}

.manual-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Image Dropzone */
.manual-image-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  padding: 24px;
  text-align: center;
  position: relative;
  cursor: pointer;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  overflow: hidden;
}

.manual-image-dropzone:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
}

.manual-image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.manual-image-placeholder i {
  font-size: 2.2rem;
  color: var(--accent-primary);
}

.manual-image-placeholder strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.manual-image-placeholder span {
  font-size: 0.76rem;
}

.manual-image-preview-container {
  position: relative;
  width: 100%;
  max-height: 240px;
}

.manual-image-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.remove-manual-photo-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease;
  z-index: 5;
}

.remove-manual-photo-btn:hover {
  background: rgba(220, 53, 69, 0.9);
}

/* Row Editors */
.manual-list-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manual-row-item {
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}



.manual-row-item .step-number {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  background: rgba(212, 101, 74, 0.08);
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  flex-shrink: 0;
}

.manual-row-item textarea {
  resize: vertical;
  min-height: 38px;
  padding: 8px 12px !important;
}

.manual-row-item .remove-row-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.manual-row-item .remove-row-btn:hover {
  background: rgba(211, 47, 47, 0.1) !important;
  color: #D32F2F !important;
  border-color: rgba(211, 47, 47, 0.2);
}

/* --- Action Sheet Overlay & Modal Card --- */
.action-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.action-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.action-sheet-card {
  width: 100%;
  max-width: 480px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  padding: 20px 20px 30px 20px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
}

.action-sheet-overlay.active .action-sheet-card {
  transform: translateY(0);
}

/* Dark mode Action Sheet styling */
.dark-mode .action-sheet-card {
  background: rgba(30, 30, 30, 0.85);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
}

.action-sheet-header {
  text-align: center;
  margin-bottom: 8px;
}

.action-sheet-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.action-sheet-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.action-sheet-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.action-sheet-btn:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.action-sheet-btn i {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.action-sheet-btn.cancel {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

.action-sheet-btn.cancel i {
  color: var(--text-muted);
}

/* On Desktop: show centered dialog instead of bottom sheet */
@media (min-width: 600px) {
  .action-sheet-overlay {
    align-items: center;
  }
  
  .action-sheet-card {
    border-radius: 20px;
    padding: 24px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .action-sheet-overlay.active .action-sheet-card {
    transform: scale(1) translateY(0);
  }
}

/* ==========================================
   Studio Editorial Full-Screen Edit View (Apple Notes / Craft Style)
   ========================================== */
.text-edit-fullscreen-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 10000;
  display: flex;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.text-edit-fullscreen-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.text-edit-fullscreen-card {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.text-edit-fullscreen-overlay.active .text-edit-fullscreen-card {
  transform: translateY(0);
}

/* Premium Top Bar (All actions on top) */
.text-edit-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top, 14px)) 16px 14px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 10;
}

.text-edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
}

.text-edit-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Icon Buttons */
.text-edit-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  padding: 0;
  box-sizing: border-box;
}

.text-edit-icon-btn:active {
  transform: scale(0.92);
}

.text-edit-cancel-btn {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.text-edit-cancel-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.08);
}

.dark-mode .text-edit-cancel-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.text-edit-delete-btn {
  background: rgba(255, 59, 48, 0.09);
  color: #ff3b30;
}

.text-edit-delete-btn:hover,
.text-edit-delete-btn:active {
  background: rgba(255, 59, 48, 0.18);
  color: #ff3b30;
}

.text-edit-done-btn {
  background: var(--text-main, #000000);
  color: var(--bg-card, #ffffff);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.text-edit-done-btn:hover {
  opacity: 0.88;
}

/* Editorial Canvas Surface */
.text-edit-canvas {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-card);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.text-edit-canvas::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.text-edit-canvas-inner {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 22px max(40px, env(safe-area-inset-bottom, 40px)) 22px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.text-edit-editorial-textarea,
.text-edit-editorial-textarea:focus,
.text-edit-editorial-textarea:active,
.text-edit-editorial-textarea:hover {
  width: 100% !important;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 1.25rem !important;
  line-height: 1.75 !important;
  font-family: var(--font-body) !important;
  color: var(--text-main) !important;
  resize: none !important;
  overflow: hidden !important;
  min-height: 200px !important;
  caret-color: var(--accent-secondary, #ff3b30) !important;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.text-edit-editorial-textarea::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Desktop Modal Adaptation */
@media (min-width: 601px) {
  .text-edit-fullscreen-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .text-edit-fullscreen-card {
    width: 100%;
    max-width: 580px;
    height: 520px;
    max-height: 85vh;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    box-shadow: 0 28px 75px -15px rgba(0, 0, 0, 0.28);
    transform: scale(0.95) translateY(12px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  }

  .text-edit-fullscreen-overlay.active .text-edit-fullscreen-card {
    transform: scale(1) translateY(0);
  }

  .text-edit-top-bar {
    padding: 16px 22px;
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
  }

  .text-edit-canvas-inner {
    padding: 24px 26px 36px 26px;
  }
}

/* Active Cooking Mode Edit controls toggle */
.list-view-container #add-ingredient,
.list-view-container #add-step,
.list-view-container .item-actions {
  display: none !important;
}

.list-view-container.is-editing-recipe #add-ingredient,
.list-view-container.is-editing-recipe #add-step {
  display: inline-flex !important;
}

.list-view-container.is-editing-recipe .item-actions {
  display: flex !important;
}

/* Make editable check-item interactive and smooth during edit mode */
.list-view-container.is-editing-recipe .check-item {
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.list-view-container.is-editing-recipe .check-item:hover {
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color);
}

.list-view-container.is-editing-recipe .editable-text {
  cursor: pointer;
  border-bottom: none !important;
}

/* Save space: hide drag handles */
.list-view-container .drag-handle,
.list-view-container.is-editing-recipe .drag-handle {
  display: none !important;
}

/* Premium SortableJS Reordering Mechanics */
.sortable-ghost {
  opacity: 0.3 !important;
  background: rgba(212, 101, 74, 0.08) !important;
  border: 2px dashed var(--accent-secondary, #d4654a) !important;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  border-radius: var(--radius-md) !important;
}

.sortable-chosen {
  background: var(--bg-card) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16), 0 4px 10px rgba(0, 0, 0, 0.08) !important;
  border-color: var(--accent-secondary, #d4654a) !important;
  border-left: 4px solid var(--accent-secondary, #d4654a) !important;
  transform: scale(1.02);
  z-index: 9999 !important;
}

.sortable-drag {
  opacity: 1 !important;
  background: var(--bg-card) !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25), 0 6px 16px rgba(0, 0, 0, 0.1) !important;
  cursor: grabbing !important;
  transform: scale(1.03) !important;
}

/* Premium Add buttons formatting */
.list-view-container #add-ingredient,
.list-view-container #add-step {
  height: 36px !important;
  padding: 0 16px !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  background: var(--bg-subtle) !important;
  border: none !important;
  color: var(--text-main) !important;
  border-radius: var(--radius-full) !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.list-view-container #add-ingredient:hover,
.list-view-container #add-step:hover {
  background: var(--border-color) !important;
}

.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 50px) scale(0.95);
  background: rgba(24, 24, 27, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90vw;
  width: 320px;
}

.toast-notification.show {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.toast-notification.simple-toast {
  padding: 6px 14px;
  background: rgba(15, 15, 15, 0.95);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 40px;
  width: auto;
  min-width: 80px;
  white-space: nowrap;
}

.toast-notification.simple-toast .toast-text-box {
  display: block;
}

.toast-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #eab308;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-text-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.toast-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
}

.toast-message {
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
  line-height: 1.3;
}

[data-theme="light"] .toast-notification {
  background: rgba(30, 30, 30, 0.95);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* --- Premium Search Bar --- */
.search-bar-container {
  padding: 0 16px;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 12px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(212, 101, 74, 0.15);
  background: var(--bg-card);
}

.search-icon {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-right: 8px;
}

#recipe-search,
#global-search {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 0.92rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
}

#recipe-search::placeholder,
#global-search::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

/* --- Centered Header & Spotlight Search --- */
.header-search-container {
  flex: 1;
  max-width: 380px;
  margin: 0 16px;
  position: relative;
  box-sizing: border-box;
}

.spotlight-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 320px;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spotlight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@media (max-width: 640px) {
  .header-search-container {
    display: none !important;
  }
}

/* --- Recommended Search Tags --- */
.recommended-searches {
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

.recommend-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-align: left;
}

.tag-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  color: var(--text-main);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.tag-chip:hover {
  background: var(--bg-subtle);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.tag-chip i {
  font-size: 0.95rem;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.tag-chip:hover i {
  color: var(--accent-primary);
}

.tag-chip.active,
.filter-chip.active {
  background: var(--accent-primary) !important;
  color: #ffffff !important;
  border-color: var(--accent-primary) !important;
  box-shadow: 0 4px 12px rgba(212, 101, 74, 0.35) !important;
  transform: translateY(-1px);
}

.tag-chip.active i,
.filter-chip.active i {
  color: #ffffff !important;
}

.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(212, 101, 74, 0.12);
  border: 1px solid rgba(212, 101, 74, 0.25);
  color: var(--accent-primary);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
}

.active-filter-pill .remove-filter-btn {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent-primary);
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
}

.feed-prep-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Styling for panel-search-input */
#panel-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 1.05rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
}

#panel-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.recipe-nutrition-container {
  width: 100%;
}

.nutrition-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(230, 92, 0, 0.08) 0%, rgba(255, 140, 0, 0.08) 100%);
  border: 1px dashed var(--accent-secondary);
  color: var(--accent-secondary);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nutrition-btn:hover {
  background: linear-gradient(135deg, rgba(230, 92, 0, 0.15) 0%, rgba(255, 140, 0, 0.15) 100%);
  transform: translateY(-1px);
}

.nutrition-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 14px;
}

.nutrition-compact-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.8rem;
  width: 100%;
  color: var(--text-muted);
}

.nutrition-compact-label {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-right: 0px;
}

.nutrition-compact-val {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-main);
  font-weight: 500;
}

.nutrition-compact-val strong {
  font-weight: 700;
}

.nutrition-separator {
  color: var(--border-color);
  user-select: none;
}

/* Macro specific accents */
.macro-calories { color: #2ecc71; }
.macro-protein { color: #e67e22; }
.macro-carbs { color: #3498db; }
.macro-fat { color: #e74c3c; }




/* Floating Actions Sidebar */
.floating-actions-sidebar {
  position: fixed;
  bottom: 72px;
  right: max(10px, calc(50% - 436px));
  left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 100;
}

.floating-focus-btn {
  position: static !important;
  background: var(--text-main);
  color: var(--bg-card);
  border: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.2s ease;
}

.floating-focus-btn i {
  font-size: 1.25rem;
}

.floating-focus-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}

.focus-text {
  display: none;
}

.sidebar-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e4e4e7);
  color: var(--text-main, #18181b);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sidebar-action-btn:hover {
  color: var(--text-main);
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-action-btn i {
  font-size: 1.15rem;
  color: inherit;
}

[data-theme="dark"] .sidebar-action-btn,
.dark-mode .sidebar-action-btn {
  background: #27272a !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
  color: #f4f4f5 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .sidebar-action-btn i,
.dark-mode .sidebar-action-btn i {
  color: #f4f4f5 !important;
}

/* Shopping Cart Badge */
.shopping-cart-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: #ef4444 !important;
  color: #ffffff !important;
  border-radius: 12px;
  font-size: 0.65rem;
  font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
  padding: 2px 6px;
  font-weight: 800;
  display: none;
  border: 2px solid #ffffff;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 5;
  white-space: nowrap;
}

[data-theme="dark"] .shopping-cart-badge,
.dark-mode .shopping-cart-badge {
  background: #ef4444 !important;
  color: #ffffff !important;
  border-color: #27272a !important;
}

.shopping-cart-badge.complete,
[data-theme="dark"] .shopping-cart-badge.complete,
.dark-mode .shopping-cart-badge.complete {
  background: #10b981 !important;
}

.sidebar-action-btn.active {
  background: var(--text-main);
  color: var(--bg-card);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.sidebar-action-btn:active, .image-floating-btn:active {
  transform: scale(0.93);
}

@keyframes icon-pop {
  0% { transform: scale(0.85); opacity: 0.5; }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

.icon-pop {
  animation: icon-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@media (min-width: 1024px) {
  .floating-actions-sidebar {
    bottom: auto;
    top: 240px;
    left: auto;
    right: max(10px, calc(50% - 436px));
    gap: 8px;
  }

  .floating-focus-btn {
    width: 38px;
    height: auto;
    padding: 14px 6px;
    border-radius: 20px;
    flex-direction: column;
    gap: 12px;
  }
  
  .floating-focus-btn .focus-text {
    display: block;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
  }
  
  .sidebar-action-btn {
    width: 34px;
    height: 34px;
  }
}

.floating-focus-btn:active {
  transform: scale(0.95);
}

/* Responsive Utilities */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .desktop-only-action {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .mobile-only-action {
    display: none !important;
  }
}

/* Unit Suggestion Popover - Ultra Minimal */
.unit-suggestion-popover {
  position: absolute;
  z-index: 10000;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e4e4e7);
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  flex-wrap: nowrap;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.unit-suggestion-chip {
  padding: 5px 11px;
  border-radius: 12px;
  background: var(--bg-subtle, #f4f4f5);
  color: var(--text-main, #18181b);
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  border: none;
  transition: all 0.15s ease;
}

.unit-suggestion-chip:hover, .unit-suggestion-chip:active {
  background: var(--text-main, #18181b);
  color: #ffffff;
}

.unit-chip-abbr {
  font-weight: 700;
  font-size: 0.78rem;
}

.unit-chip-name {
  font-weight: 400;
  font-size: 0.74rem;
  opacity: 0.65;
}

.unit-suggestion-chip:hover .unit-chip-name {
  opacity: 0.85;
  color: #ffffff;
}

/* ==================== TikTok Video Preview ==================== */
.tiktok-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  height: 26px;
  background: #09090b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  margin-left: 2px;
}

.tiktok-preview-btn:hover {
  background: #000000;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
}

.tiktok-preview-btn:active {
  transform: translateY(0) scale(0.96);
}

.tiktok-btn-icon {
  flex-shrink: 0;
  color: #ffffff;
}

.tiktok-play-icon {
  font-size: 0.72rem;
  color: #ffffff;
  display: flex;
  align-items: center;
}

body.dark-theme .tiktok-preview-btn {
  background: #18181b;
  color: #f4f4f5;
  border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .tiktok-preview-btn:hover {
  background: #27272a;
}

/* TikTok Preview Modal */
#tiktok-preview-modal {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tiktok-modal-card {
  width: 100%;
  max-width: 380px;
  max-height: 92vh;
  margin: auto;
  background: #09090b;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

#tiktok-preview-modal.active .tiktok-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.tiktok-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #18181b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  z-index: 2;
}

.tiktok-modal-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.tiktok-header-icon {
  flex-shrink: 0;
  color: #ffffff;
}

.tiktok-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tiktok-external-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.15s ease;
}

.tiktok-external-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.tiktok-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.tiktok-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.tiktok-player-wrapper {
  position: relative;
  width: 100%;
  height: min(580px, calc(86vh - 56px));
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tiktok-player-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  pointer-events: none;
  z-index: 1;
}

.tiktok-iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: relative;
  z-index: 2;
  background: #000000;
}




