/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/*= require mobile */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background-color: #f7f7f8;
  color: #202123;
  line-height: 1.6;
  padding-top: 60px; /* Space for fixed nav */
}

/* Top Navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  height: 60px;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.nav-left .nav-logo {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: white;
}

.nav-logo-link {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.nav-logo-link:hover {
  opacity: 0.8;
}

.nav-logo-link:visited {
  color: white;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-meal-plan-indicator {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.2;
  padding: 0.25rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  text-decoration: none;
  max-width: 240px;
  transition: background 0.2s ease;
}

.nav-meal-plan-indicator:hover {
  background: rgba(255, 255, 255, 0.25);
}

.nav-meal-plan-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.nav-meal-plan-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* User Dropdown */
.user-selector {
  position: relative;
}

.user-dropdown-button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.user-dropdown-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.user-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  margin-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1001;
}

.user-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  color: #202123;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.user-dropdown-item:hover {
  background-color: #f7f7f8;
}

.user-dropdown-item:last-child {
  border-bottom: none;
}

/* Organization Dropdown */
.organization-selector {
  position: relative;
}

.org-dropdown-button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.org-dropdown-button:hover {
  background: rgba(255, 255, 255, 0.25);
}

.dropdown-arrow {
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.org-dropdown-button[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.org-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  margin-top: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.org-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.org-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  color: #202123;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.org-dropdown-item:hover {
  background-color: #f7f7f8;
}

.org-dropdown-item.active {
  background-color: #e8f5e8;
  color: #10a37f;
}

.org-dropdown-item:last-child {
  border-bottom: none;
}

.org-dropdown-separator {
  height: 1px;
  background: #e5e5e5;
  margin: 0.5rem 0;
}

.check-mark {
  color: #10a37f;
  font-weight: bold;
}



/* Main Content */
.main-content {
  min-height: calc(100vh - 60px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* User Settings Page */
.ai-model-form {
  max-width: 600px;
}

.ai-model-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.model-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid #e5e5e5;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.model-option:hover {
  border-color: #d1d5db;
  background-color: #f9fafb;
}

.model-option:has(.model-radio:checked) {
  border-color: #10a37f;
  background-color: #e8f5e8;
}

.model-radio {
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.model-label {
  cursor: pointer;
  flex: 1;
  margin: 0;
}

.model-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.model-name {
  font-weight: 600;
  color: #202123;
  font-size: 1rem;
}

.model-description {
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Page header (shared across settings, organizations, and detail pages) */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e5e5;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 8px 0;
}

/* Page-level action row (back links, etc.) */
.page-actions {
  margin-top: 32px;
  display: flex;
  gap: 12px;
}

/* Mobile responsiveness for user settings */
@media (max-width: 768px) {
  .ai-model-form {
    max-width: 100%;
  }
  
  .model-option {
    padding: 0.75rem;
  }
  
  .model-name {
    font-size: 0.95rem;
  }
  
  .model-description {
    font-size: 0.85rem;
  }
  
  .page-header h1 {
    font-size: 1.5rem;
  }
  
  .page-subtitle {
    font-size: 0.9rem;
  }
  
  .settings-section-header h2 {
    font-size: 1.1rem;
  }
  
  .settings-section-description {
    font-size: 0.85rem;
  }
}

/* Chat Layout with Three Columns */
.chat-layout {
  display: flex;
  height: calc(100vh - 100px);
  gap: 20px;
}

/* Left Sidebar */
.chat-sidebar {
  width: 300px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* Right Sidebar - Ingredients */
.ingredients-sidebar {
  width: 280px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #e5e5e5;
  min-height: 200px;
  max-height: 50vh;
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 #f7fafc;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Webkit scrollbar styling for sidebar lists */
.sidebar-list::-webkit-scrollbar {
  width: 6px;
}

.sidebar-list::-webkit-scrollbar-track {
  background: #f7fafc;
  border-radius: 3px;
}

.sidebar-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.sidebar-list::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

.sidebar-item {
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s;
}

.sidebar-item:hover {
  background: #f8f9fa;
}

.sidebar-item.active {
  background: #e6f3ff;
  border-left: 3px solid #0084ff;
}

.sidebar-link {
  display: block;
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
}

.sidebar-item-content {
  width: 100%;
}

.sidebar-item-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0 0 4px 0;
  color: #374151;
  line-height: 1.3;
}

.sidebar-item-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 8px 0;
}

.sidebar-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.status-badge, .meal-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.status-badge.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.status-completed {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.status-archived {
  background: #f3f4f6;
  color: #6b7280;
}

.meal-type-badge {
  background: #fef3c7;
  color: #92400e;
}

.conversation-count, .message-count {
  font-size: 11px;
  color: #9ca3af;
}

.timestamp {
  font-size: 10px;
  color: #9ca3af;
}

.sidebar-empty {
  padding: 24px 16px;
  text-align: center;
  color: #6b7280;
}

.sidebar-empty p {
  margin: 0 0 12px 0;
  font-size: 14px;
}

/* Main Chat Area - Flexible between sidebars */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent flex item from overflowing */
}

.chat-welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  text-align: center;
  padding: 40px;
}

/* Ingredients Sidebar Content */
.ingredients-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ingredients-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

/* Dropdown Divider */
.dropdown-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 4px 0;
}

/* Ingredient Recipe Sources */
.ingredient-recipe-sources {
  padding: 4px 0 0 24px;
  margin-top: 4px;
}

.recipe-sources-text {
  color: #6b7280;
  font-size: 11px;
  line-height: 1.3;
  font-style: italic;
}

/* Notification styles (for copy feedback) */
.notification {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ingredients-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.ingredients-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ingredient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-name {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.ingredient-amount {
  font-size: 13px;
  color: #6b7280;
  font-weight: 400;
}

.ingredients-empty {
  text-align: center;
  padding: 40px 16px;
  color: #6b7280;
}

.ingredients-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.ingredients-empty h4 {
  font-size: 16px;
  margin: 0 0 8px 0;
  color: #374151;
}

.ingredients-empty p {
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* Responsive Design for Ingredients Sidebar */
@media (max-width: 1200px) {
  .ingredients-sidebar {
    width: 240px;
  }
  
  .chat-sidebar {
    width: 260px;
  }
}

@media (max-width: 968px) {
  .chat-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 100px);
  }
  
  .chat-sidebar {
    width: 100%;
    min-height: 400px;
    max-height: 60vh;
    order: 1;
    overflow-y: auto;
  }
  
  .ingredients-sidebar {
    width: 100%;
    max-height: 300px;
    order: 3;
  }
  
  .chat-main {
    order: 2;
    min-height: 400px;
  }
}

@media (max-width: 640px) {
  .chat-layout {
    gap: 10px;
    padding: 0 10px;
  }
  
  .chat-sidebar {
    min-height: 350px;
    max-height: 50vh;
  }
  
  .sidebar-section {
    flex: none;
    min-height: 150px;
    max-height: 200px;
  }
  
  .ingredients-content {
    padding: 12px;
  }
  
  .ingredient-item {
    padding: 6px 0;
  }
}

/* Meal Plan Ingredients View */
.meal-plan-ingredients-view {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.meal-plan-header {
  margin-bottom: 8px;
  border-bottom: 2px solid #e5e5e5;
}

.meal-plan-title h2 {
  font-size: 28px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.meal-plan-subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 20px 0;
}

.meal-plan-stats {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}

.stat-item {
  text-align: center;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 8px;
  flex: 1;
}

.stat-number {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ingredients-grid {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.ingredients-section h3,
.ingredients-category-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 0px;
}

.ingredients-category-section {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

.ingredients-category-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.ingredients-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.ingredient-card {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 12px;
  transition: all 0.2s ease;
  position: relative;
}

.ingredient-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ingredient-card.checked {
  background: #f0f9ff;
  border-color: #0ea5e9;
  opacity: 0.8;
}

.ingredient-card.checked .ingredient-name {
  text-decoration: line-through;
  color: #6b7280;
}

.ingredient-card.checked .ingredient-amount {
  opacity: 0.7;
}

.ingredient-checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}

.ingredient-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-top: 2px;
  accent-color: #0ea5e9;
}

.ingredient-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}

.ingredient-name {
  font-size: 15px;
  font-weight: 500;
  color: #374151;
}

.ingredient-amount {
  font-size: 13px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  padding: 3px 6px;
  border-radius: 3px;
}

.ingredient-sources {
  margin-top: 4px;
}

.sources-list {
  font-size: 11px;
  color: #6b7280;
  line-height: 1.3;
}

.empty-ingredients {
  text-align: center;
  padding: 80px 40px;
  color: #6b7280;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.empty-ingredients h3 {
  font-size: 24px;
  margin: 0 0 12px 0;
  color: #374151;
}

.empty-ingredients p {
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

/* Responsive design for meal plan view */
@media (max-width: 1024px) {
  .meal-plan-stats {
    flex-direction: column;
    gap: 12px;
  }
  
  .stat-item {
    padding: 12px;
  }
  
  .ingredients-list-grid {
    grid-template-columns: 1fr;
  }
  
  .analytics-dashboard {
    padding: 16px;
  }
  
  .analytics-header h2 {
    font-size: 24px;
  }
  
  .analytics-placeholder {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .meal-plan-ingredients-view {
    padding: 16px;
  }
  
  .meal-plan-title h2 {
    font-size: 24px;
  }
  
  .stat-number {
    font-size: 20px;
  }
  
  .analytics-dashboard {
    padding: 12px;
  }
  
  .analytics-header h2 {
    font-size: 20px;
  }
  
  .analytics-placeholder {
    padding: 16px;
  }
  
  .placeholder-icon {
    font-size: 48px;
  }
  
  .compact-ingredients-stats {
    padding: 8px;
    margin-bottom: 12px;
  }
  
  .compact-ingredient-row {
    padding: 6px 8px;
  }
  
  .meal-planning-calendar {
    padding: 12px;
  }
  
  .calendar-header h2 {
    font-size: 20px;
  }
  
  .calendar-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .recipe-drag-handle {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  
  .sidebar-link.with-drag-handle {
    padding-left: 28px;
  }
}

/* Ingredient Categories Management */
.categories-management {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.categories-section {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #374151;
  margin: 0;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.category-item:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.category-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-delete-btn {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.category-delete-btn:hover {
  background: #fee2e2;
  transform: scale(1.1);
}

.category-default-badge {
  color: #059669;
  font-size: 14px;
  padding: 2px;
}

.categories-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.add-category-section {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  height: fit-content;
}

.add-category-section h3 {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 16px 0;
}

.category-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-form .form-group {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.category-form .form-input {
  flex: 1;
}

.form-help {
  margin-top: 8px;
}

.form-help small {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}

/* Responsive design for categories */
@media (max-width: 1024px) {
  .categories-management {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

@media (max-width: 640px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .categories-grid {
    grid-template-columns: 1fr;
  }
  
  .category-form .form-group {
    flex-direction: column;
  }
}

.chat-welcome h2 {
  font-size: 24px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px 0;
}

.chat-welcome p {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

/* Form Styles */
.form-container {
  max-width: 500px;
  margin: 2rem auto;
  padding: 2rem;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.form-header {
  text-align: center;
  margin-bottom: 2rem;
}

.form-header h1 {
  color: #202123;
  margin-bottom: 0.5rem;
}

.form-header p {
  color: #666;
  font-size: 0.9rem;
}

.organization-form {
  width: 100%;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #202123;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #10a37f;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: #10a37f;
  color: white;
}

.btn-primary:hover {
  background-color: #0d8c6c;
}

.btn-secondary {
  background-color: #f7f7f8;
  color: #666;
  border: 1px solid #e5e5e5;
}

.btn-secondary:hover {
  background-color: #e5e5e5;
}

.btn-danger {
  background-color: #dc2626;
  color: white;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

.btn.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* Input disabled states */
.chat-input-disabled {
  position: relative;
}

.chat-input.disabled,
.chat-send-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-help-text {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  margin-top: 8px;
}

/* Message boxes for warnings/errors */
.message-box {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 16px;
  border-left: 4px solid;
}

.message-box.warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

/* Modal styles */
.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  max-width: 500px;
  margin: 40px auto;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e5e5;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #374151;
}

.modal-body {
  padding: 20px 24px;
}

/* Form row for side-by-side inputs */
.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Conversation actions */
.conversation-item {
  display: flex;
  align-items: center;
  width: 100%;
  position: relative;
}

.sidebar-link {
  flex: 1;
  min-width: 0; /* Allow flex item to shrink */
}

.conversation-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 0 8px;
}

.sidebar-item:hover .conversation-actions {
  opacity: 1;
}

.action-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.edit-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.favorite-btn:hover {
  background-color: rgba(255, 193, 7, 0.1);
}

.favorite-btn.favorited {
  color: #ffc107;
}

.favorite-btn.favorited:hover {
  background-color: rgba(255, 193, 7, 0.2);
}

/* Inline edit form */
.inline-edit-form {
  padding: 12px 16px;
  background: #f8f9fa;
  border-top: 1px solid #e5e5e5;
}

.edit-form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edit-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.edit-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.edit-input.error {
  border-color: #ef4444;
}

.edit-input.error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

.edit-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .conversation-actions {
    opacity: 1; /* Always visible on mobile */
  }
  
  .action-btn {
    min-width: 28px;
    min-height: 28px;
    font-size: 14px;
  }
}

.error-messages {
  background-color: #fee;
  border: 1px solid #fcc;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-messages h3 {
  color: #c33;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.error-messages ul {
  color: #c33;
  margin: 0;
  padding-left: 1.5rem;
}

.error-messages li {
  margin-bottom: 0.25rem;
}

/* Chat container */
.chat-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Messages container */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background-color: #ffffff;
  scroll-behavior: auto; /* Disable smooth scrolling for instant positioning */
}

/* Ensure messages container starts at bottom when empty */
.chat-messages:empty::after {
  content: '';
  display: block;
  height: 1px;
}

/* Individual message styling */
.message {
  display: flex;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease-in;
}

.user-message {
  justify-content: flex-end;
}

.assistant-message {
  justify-content: flex-start;
}

.message-avatar {
  flex-shrink: 0;
  margin: 0 0.75rem;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.user-avatar {
  background-color: #10a37f;
  color: white;
  order: 2;
}

.assistant-avatar {
  background-color: #ab68ff;
  color: white;
}

.message-content {
  max-width: 70%;
  min-width: 100px;
  position: relative;
}

.user-message .message-content {
  order: 1;
}

/* Per-message delete control (also removes it from the LLM history) */
.message-delete-form {
  position: absolute;
  top: -8px;
  right: -8px;
  margin: 0;
  z-index: 2;
}

.message-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.message:hover .message-delete-btn,
.message-delete-btn:focus-visible {
  opacity: 1;
}

.message-delete-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* On touch devices there's no hover, so keep it lightly visible */
.mobile-layout .message-delete-btn {
  opacity: 0.5;
}

.message-text {
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.user-message .message-text {
  background-color: #10a37f;
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.assistant-message .message-text {
  background-color: #f7f7f8;
  color: #202123;
  border: 1px solid #e5e5e5;
  border-bottom-left-radius: 0.25rem;
}

/* Rendered markdown inside assistant messages */
.message-text > *:first-child { margin-top: 0; }
.message-text > *:last-child { margin-bottom: 0; }
.message-text p { margin: 0 0 0.6em; }
.message-text ul,
.message-text ol { margin: 0 0 0.6em; padding-left: 1.4em; }
.message-text li { margin: 0.15em 0; }
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4 { margin: 0.8em 0 0.4em; line-height: 1.25; font-weight: 600; }
.message-text h1 { font-size: 1.4em; }
.message-text h2 { font-size: 1.25em; }
.message-text h3 { font-size: 1.1em; }
.message-text h4 { font-size: 1em; }
.message-text a { color: #0ea5e9; text-decoration: underline; }
.message-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.message-text pre {
  background: #1e1e1e;
  color: #f8f8f2;
  padding: 0.8em 1em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 0.6em;
}
.message-text pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: 0.85em;
}
.message-text blockquote {
  margin: 0 0 0.6em;
  padding-left: 0.8em;
  border-left: 3px solid #d1d5db;
  color: #4b5563;
}
.message-text table {
  border-collapse: collapse;
  margin: 0 0 0.6em;
  display: block;
  overflow-x: auto;
}
.message-text th,
.message-text td {
  border: 1px solid #d1d5db;
  padding: 0.35em 0.6em;
  text-align: left;
}
.message-text th { background: rgba(0, 0, 0, 0.04); font-weight: 600; }
/* Code inside user (green) bubbles needs a lighter chip */
.user-message .message-text code { background: rgba(255, 255, 255, 0.2); }

.message-timestamp {
  font-size: 0.75rem;
  color: #8e8ea0;
  text-align: center;
  margin-top: 0.25rem;
}

/* Streaming message */
.streaming-message .message-text {
  background-color: #f0f0f0;
  border: 1px dashed #ccc;
}

.typing-indicator {
  animation: pulse 1.5s infinite;
  color: #666;
}

/* Chat input */
.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.chat-input {
  flex: 1;
  min-height: 44px;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-action-btn {
  background: #f8f9fa;
  color: #495057;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
}

.chat-action-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-action-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.image-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
  flex-shrink: 0;
}

.image-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
  border: none;
  color: white;
}

.image-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.chat-send-button {
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 44px;
  height: 44px;
  min-width: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-send-button svg {
  width: 20px;
  height: 20px;
}

.chat-send-button:hover {
  background: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chat-send-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Error message styling */
.error-message {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 0.5rem;
  padding: 0.5rem;
  margin: 0.5rem 0;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .chat-container {
    height: 100vh;
    max-width: 100%;
    border-radius: 0;
  }
  
  .message-content {
    max-width: 85%;
  }
  
  .chat-input-wrapper {
    border-radius: 0.75rem;
  }
  
  .chat-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Analytics Dashboard Styles */
.analytics-dashboard {
  padding: 24px;
  height: 100%;
  overflow-y: auto;
}

.analytics-header {
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e5e5;
}

.analytics-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.analytics-subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

.analytics-content {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.analytics-placeholder {
  text-align: center;
  max-width: 500px;
  padding: 40px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 2px dashed #e5e5e5;
}

.placeholder-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.analytics-placeholder h3 {
  font-size: 24px;
  margin: 0 0 16px 0;
  color: #374151;
}

.analytics-placeholder p {
  font-size: 16px;
  color: #6b7280;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.feature-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 8px 0;
  font-size: 14px;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Compact Ingredients Styles */
.compact-ingredients-stats {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 16px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.stat-row:not(:last-child) {
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.stat-value {
  font-size: 12px;
  color: #374151;
  font-weight: 600;
}

.ingredients-note {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.note-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.ingredients-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: #92400e;
}

.compact-ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compact-category-section {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
}

.compact-category-title {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  padding: 8px 12px;
  background: #f8f9fa;
  border-bottom: 1px solid #e5e5e5;
}

.compact-ingredients {
  display: flex;
  flex-direction: column;
}

.compact-ingredient-item {
  border-bottom: 1px solid #f0f0f0;
  transition: all 0.2s ease;
}

.compact-ingredient-item:last-child {
  border-bottom: none;
}

.compact-ingredient-item:hover {
  background: #f8f9fa;
}

.compact-ingredient-item.checked {
  background: #f0f9ff;
  opacity: 0.8;
}

.compact-ingredient-item.checked .compact-ingredient-name {
  text-decoration: line-through;
  color: #6b7280;
}

.compact-ingredient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}

.compact-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0ea5e9;
  flex-shrink: 0;
}

.compact-ingredient-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.compact-ingredient-name {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-ingredient-amount {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-left: 8px;
}

.compact-empty-ingredients {
  text-align: center;
  padding: 40px 16px;
  color: #6b7280;
}

.compact-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.compact-empty-ingredients h4 {
  font-size: 16px;
  margin: 0 0 8px 0;
  color: #374151;
}

.compact-empty-ingredients p {
  font-size: 14px;
  margin: 0 0 16px 0;
  line-height: 1.5;
}

/* Meal Planning Calendar Styles */
.meal-planning-calendar {
  padding: 16px;
  height: 100%;
  overflow-y: auto;
}

.calendar-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e5e5;
}

.calendar-header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.calendar-title-section {
  flex: 1;
}

.calendar-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 6px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Calendar Actions Dropdown */
.calendar-actions {
  display: flex;
  align-items: center;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.dropdown-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.dropdown-toggle:active {
  background: #e2e8f0;
}

.dropdown-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
}

.dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: none;
  text-align: left;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.dropdown-item:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.dropdown-item:not(:last-child) {
  border-bottom: 1px solid #f0f0f0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.calendar-day {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.day-header {
  background: #f8f9fa;
  padding: 8px 12px;
  border-bottom: 1px solid #e5e5e5;
  text-align: center;
}

.day-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 2px 0;
}

.day-date {
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.meal-slots {
  display: flex;
  flex-direction: column;
}

.meal-slot {
  border-bottom: 1px solid #f0f0f0;
  min-height: 60px;
  transition: all 0.3s ease;
}

.meal-slot:last-child {
  border-bottom: none;
}

.meal-slot.drag-over {
  background: #e0f2fe;
  border-color: #0ea5e9;
}

.meal-slot-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #fafafa;
  border-bottom: 1px solid #f0f0f0;
}

.meal-type-icon {
  font-size: 14px;
}

.meal-slot-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  text-transform: capitalize;
}

.meal-slot-content {
  padding: 6px;
  min-height: 40px;
}

.assigned-meal {
  background: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 4px;
  cursor: move;
  position: relative;
  transition: all 0.2s ease;
}

.assigned-meal:last-child {
  margin-bottom: 0;
}

.assigned-meal:hover {
  box-shadow: 0 1px 6px rgba(14, 165, 233, 0.3);
  transform: translateY(-1px);
}

.assigned-meal.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.meal-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 2px;
  line-height: 1.3;
}

.meal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ingredient-count {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
}

.remove-meal-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.assigned-meal:hover .remove-meal-btn {
  display: flex;
}

.remove-meal-btn:hover {
  background: #dc2626;
}

/* Placeholder Meal Styles */
.placeholder-meal {
  background: #e0f2fe;
  border: 2px dotted #0ea5e9;
  border-radius: 4px;
  padding: 6px 8px;
  margin-bottom: 4px;
  cursor: move;
  position: relative;
  transition: all 0.2s ease;
}

.placeholder-meal:last-child {
  margin-bottom: 0;
}

.placeholder-meal:hover {
  background: #b3e5fc;
  box-shadow: 0 1px 6px rgba(14, 165, 233, 0.3);
  transform: translateY(-1px);
}

.placeholder-meal.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
}

.placeholder-icon {
  position: absolute;
  top: 4px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0ea5e9;
  font-size: 0; /* Hide the emoji */
}

.placeholder-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
}

.placeholder-title {
  font-size: 12px;
  font-weight: 500;
  color: #0f172a;
  margin-bottom: 2px;
  padding-left: 16px; /* Space for icon */
  line-height: 1.3;
  cursor: pointer;
  border-radius: 2px;
  padding: 1px 2px 1px 16px;
  transition: background-color 0.2s ease;
}

.placeholder-title:hover {
  background-color: rgba(14, 165, 233, 0.1);
}

.placeholder-title.editing {
  background-color: white;
  border: 1px solid #0ea5e9;
  outline: none;
  cursor: text;
}

.placeholder-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding-left: 16px; /* Space for icon */
}

.convert-recipe-btn {
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 9px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: 500;
}

.convert-recipe-btn:hover {
  background: #0284c7;
}

.placeholder-meal:hover .remove-meal-btn {
  display: flex;
}

/* Placeholder Edit Form Styles */
.placeholder-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px;
}

.placeholder-input {
  border: 1px solid #0ea5e9;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

.placeholder-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1);
}

.placeholder-form-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.save-placeholder-btn,
.cancel-placeholder-btn {
  background: #0ea5e9;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-weight: 500;
}

.save-placeholder-btn:hover {
  background: #0284c7;
}

.cancel-placeholder-btn {
  background: #6b7280;
}

.cancel-placeholder-btn:hover {
  background: #4b5563;
}

/* Loading and Error States */
.placeholder-meal.loading {
  opacity: 0.6;
  pointer-events: none;
}

.placeholder-edit-form.loading {
  opacity: 0.7;
}

.placeholder-edit-form.loading .placeholder-input {
  background: #f3f4f6;
}

.placeholder-edit-form.loading button {
  opacity: 0.6;
  cursor: not-allowed;
}

.placeholder-meal.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 8px;
  width: 12px;
  height: 12px;
  border: 2px solid #0ea5e9;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.placeholder-meal.error {
  background: #fef2f2;
  border-color: #ef4444;
  animation: shake 0.5s ease-in-out;
}

.error-message {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ef4444;
  color: white;
  font-size: 10px;
  padding: 4px 6px;
  border-radius: 0 0 4px 4px;
  z-index: 10;
  animation: fadeIn 0.3s ease;
}

.retry-button {
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 9px;
  cursor: pointer;
  margin-left: 4px;
  transition: background 0.2s ease;
}

.retry-button:hover {
  background: #d97706;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { 
    opacity: 0; 
    transform: translateX(100%); 
  }
  to { 
    opacity: 1; 
    transform: translateX(0); 
  }
}

@keyframes slideOutRight {
  from { 
    opacity: 1; 
    transform: translateX(0); 
  }
  to { 
    opacity: 0; 
    transform: translateX(100%); 
  }
}

.empty-meal-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 2px dashed #e5e5e5;
  border-radius: 4px;
  color: #9ca3af;
  font-size: 12px;
  transition: all 0.2s ease;
}

.empty-meal-slot.drag-over {
  border-color: #0ea5e9;
  background: #f0f9ff;
  color: #0ea5e9;
}

.drop-hint {
  font-style: italic;
}

.calendar-empty {
  text-align: center;
  padding: 80px 40px;
  color: #6b7280;
}

.calendar-empty .empty-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.calendar-empty h3 {
  font-size: 24px;
  margin: 0 0 12px 0;
  color: #374151;
}

.calendar-empty p {
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

/* Draggable Recipe Conversation Styles */
.draggable-recipe {
  cursor: grab;
  position: relative;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.draggable-recipe:hover {
  background: rgba(14, 165, 233, 0.05);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.draggable-recipe.dragging {
  opacity: 0.6;
  transform: rotate(2deg);
  cursor: grabbing;
}

.draggable-recipe:active {
  cursor: grabbing;
}

/* Ensure all child elements inherit the drag cursor */
.draggable-recipe * {
  cursor: inherit;
}

/* Override cursor for interactive elements within draggable items */
.draggable-recipe a,
.draggable-recipe button {
  cursor: pointer;
}

/* Recipe Indicator Icon */
.recipe-indicator-icon {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: transparent;
  color: #9ca3af;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  z-index: 10;
  transition: all 0.2s ease;
  user-select: none;
  pointer-events: none;
}

.draggable-recipe:hover .recipe-indicator-icon {
  color: #6b7280;
}

.sidebar-link.with-drag-handle {
  padding-left: 32px;
}

.recipe-indicator {
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.7;
}

.conversation-item {
  position: relative;
}

/* Favorites Page Styles */
.favorites-page {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.favorites-header {
  margin-bottom: 32px;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 20px;
}

.page-title-section h1 {
  font-size: 32px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-subtitle {
  font-size: 16px;
  color: #6b7280;
  margin: 0;
}

.favorites-filters {
  margin-top: 16px;
}

.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.favorite-card {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.favorite-card:hover {
  border-color: #ffc107;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
  transform: translateY(-2px);
}

.favorite-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.favorite-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}

.favorite-link {
  color: #374151;
  text-decoration: none;
  transition: color 0.2s ease;
}

.favorite-link:hover {
  color: #ffc107;
}

.favorite-actions {
  display: flex;
  gap: 4px;
}

.favorite-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.meta-badge {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cuisine-badge {
  background: #fef3c7;
  color: #92400e;
}

.meal-type-badge {
  background: #dbeafe;
  color: #1e40af;
}

.difficulty-badge {
  background: #fde68a;
  color: #78350f;
}

.time-badge {
  background: #d1fae5;
  color: #065f46;
}

.stars {
  font-size: 10px;
}

.favorite-ingredients {
  margin-bottom: 16px;
}

.ingredients-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 14px;
  color: #6b7280;
}

.ingredient-count {
  font-weight: 500;
  color: #374151;
}

.total-weight {
  font-size: 12px;
  color: #9ca3af;
}

.ingredients-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ingredient-tag {
  font-size: 11px;
  background: #f3f4f6;
  color: #374151;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e5e5e5;
}

.ingredient-tag.more {
  background: #e5e5e5;
  color: #6b7280;
  font-style: italic;
}

.favorite-notes {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.favorite-notes strong {
  color: #374151;
}

.favorite-actions-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.add-to-meal-plan {
  flex: 1;
}

.add-to-meal-plan label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 500;
}

.add-to-meal-plan .btn {
  margin-right: 6px;
  margin-bottom: 4px;
}

.favorite-timestamp {
  font-size: 12px;
  color: #9ca3af;
  text-align: right;
  flex-shrink: 0;
}

.favorites-empty {
  text-align: center;
  padding: 80px 40px;
  color: #6b7280;
}

.favorites-empty .empty-icon {
  font-size: 64px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.favorites-empty h3 {
  font-size: 24px;
  margin: 0 0 12px 0;
  color: #374151;
}

.favorites-empty p {
  font-size: 16px;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

/* Responsive design for favorites */
@media (max-width: 768px) {
  .favorites-page {
    padding: 16px;
  }
  
  .favorites-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .favorite-card {
    padding: 16px;
  }
  
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-select {
    width: 100%;
  }
  
  .favorite-actions-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .favorite-timestamp {
    text-align: left;
  }
  
  .add-to-meal-plan .btn {
    width: 100%;
    margin-right: 0;
    margin-bottom: 8px;
  }
}

/* Favorite Recipe Detail Page */
.favorite-recipe-detail {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.favorite-detail-header {
  margin-bottom: 32px;
  border-bottom: 2px solid #e5e5e5;
  padding-bottom: 24px;
}

.breadcrumb {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 16px;
}

.breadcrumb-link {
  color: #3b82f6;
  text-decoration: none;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-separator {
  margin: 0 8px;
  color: #9ca3af;
}

.breadcrumb-current {
  color: #374151;
  font-weight: 500;
}

.favorite-detail-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.favorite-detail-title h1 {
  font-size: 32px;
  font-weight: 700;
  color: #374151;
  margin: 0;
  flex: 1;
}

.favorite-detail-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.favorite-detail-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
}

.recipe-metadata {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.metadata-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metadata-item label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.personal-notes {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.personal-notes h3 {
  font-size: 18px;
  font-weight: 600;
  color: #9a3412;
  margin: 0 0 12px 0;
}

.notes-content {
  color: #7c2d12;
  line-height: 1.6;
}

.edit-form {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.edit-form h3 {
  font-size: 18px;
  font-weight: 600;
  color: #0c4a6e;
  margin: 0 0 20px 0;
}

.add-to-meal-plans {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
}

.add-to-meal-plans h3 {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 16px 0;
}

.meal-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.meal-plan-option {
  background: #f8f9fa;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.meal-plan-option:hover {
  border-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.meal-plan-option h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 4px 0;
}

.meal-plan-option p {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 12px 0;
}

.favorite-detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ingredients-section,
.source-section {
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 20px;
}

.ingredients-section h3,
.source-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 16px 0;
}

.ingredients-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #374151;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ingredients-list .ingredient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.ingredients-list .ingredient-item:last-child {
  border-bottom: none;
}

.ingredients-list .ingredient-name {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.ingredients-list .ingredient-amount {
  font-size: 13px;
  color: #6b7280;
  font-weight: 600;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
}

.no-ingredients {
  font-size: 14px;
  color: #6b7280;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.source-info p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #6b7280;
}

.source-link {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  display: block;
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  margin: 8px 0;
  transition: all 0.2s ease;
}

.source-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.source-date {
  font-size: 12px !important;
  color: #9ca3af !important;
  margin-top: 8px !important;
}

/* Responsive design for detail page */
@media (max-width: 1024px) {
  .favorite-detail-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .favorite-detail-sidebar {
    order: -1;
  }
  
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  
  .meal-plans-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .favorite-recipe-detail {
    padding: 16px;
  }
  
  .favorite-detail-title {
    flex-direction: column;
    align-items: stretch;
  }
  
  .favorite-detail-title h1 {
    font-size: 24px;
    margin-bottom: 16px;
  }
  
  .favorite-detail-actions {
    justify-content: flex-start;
  }
  
  .ingredients-stats {
    flex-direction: column;
    gap: 12px;
  }
  
  .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
  
  .stat-number {
    font-size: 16px;
  }
}

/* Image Upload and Preview Styles */
.image-preview-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid #e9ecef;
  border-radius: 12px;
  margin-bottom: 12px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

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

.image-preview-title {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-preview-title::before {
  content: "📸";
  font-size: 16px;
}

.clear-images-btn {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.clear-images-btn:hover {
  background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.image-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.image-preview-item {
  position: relative;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 8px;
  max-width: 200px;
}

.preview-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

.image-preview-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.image-name {
  font-size: 12px;
  font-weight: 500;
  color: #495057;
  word-break: break-all;
}

.image-size {
  font-size: 11px;
  color: #6c757d;
}

.remove-image-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.remove-image-btn:hover {
  background: rgba(200, 35, 51, 0.9);
}

/* Message Image Display */
.message-images {
  margin-bottom: 8px;
}

.message-image-item {
  display: inline-block;
  margin: 4px 8px 4px 0;
  position: relative;
}

.message-image {
  max-width: 300px;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.message-image:hover {
  transform: scale(1.02);
}

.image-filename {
  font-size: 11px;
  color: #6c757d;
  margin-top: 4px;
  word-break: break-all;
  max-width: 300px;
}

.user-message .message-image {
  border-color: rgba(0, 123, 255, 0.3);
}

.assistant-message .message-image {
  border-color: rgba(40, 167, 69, 0.3);
}

.image-count {
  margin-left: 8px;
  font-size: 11px;
  color: #6c757d;
  background: rgba(108, 117, 125, 0.1);
  padding: 2px 6px;
  border-radius: 12px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .image-previews {
    gap: 8px;
  }
  
  .image-preview-item {
    max-width: 150px;
  }
  
  .preview-image {
    height: 100px;
  }
  
  .message-image {
    max-width: 250px;
    max-height: 150px;
  }
  
  .chat-actions {
    flex-direction: column;
    gap: 4px;
  }
}

/* Image viewer modal (basic styling) */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: pointer;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.image-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 24px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 4px;
}

.image-preview-info {
  margin-bottom: 8px;
  padding: 0 4px;
}

.text-muted {
  color: #6c757d;
  font-style: italic;
}

.chat-form {
  width: 100%;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  padding: 16px;
  margin: 16px 0;
}

.chat-input-wrapper {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 12px;
  transition: all 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
  padding: 8px;
}

.chat-input::placeholder {
  color: #6c757d;
  font-style: italic;
}

/* Disabled state renders the placeholder as a div (grows with content, no
   clipping) styled to mimic the textarea placeholder. */
.chat-input-placeholder {
  display: flex;
  align-items: center;
  color: #6c757d;
  font-style: italic;
}

/* Initial message hint for placeholder conversion */
.initial-message-hint {
  font-size: 12px;
  color: #0ea5e9;
  text-align: center;
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(14, 165, 233, 0.1);
  border-radius: 6px;
  animation: fadeInOut 4s ease-in-out forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; transform: translateY(-10px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* Ingredient editing styles */
.ingredient-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.ingredient-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ingredient-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ingredient-item:hover .ingredient-edit-btn {
  opacity: 1;
}

.ingredient-edit-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.ingredient-amount {
  font-weight: 500;
  color: #666;
}

.ingredient-edit-form {
  width: 100%;
  padding: 8px 0;
}

.edit-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.ingredient-edit-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  min-width: 0;
}

.ingredient-edit-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.edit-form-buttons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-save,
.btn-cancel {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s ease;
}

.btn-save {
  color: #059669;
  background-color: #d1fae5;
}

.btn-save:hover {
  background-color: #a7f3d0;
}

.btn-cancel {
  color: #dc2626;
  background-color: #fef2f2;
}

.btn-cancel:hover {
  background-color: #fecaca;
}

/* Quick Add Ingredient Form */
.quick-add-form {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}

.quick-add-header {
  margin-bottom: 16px;
}

.quick-add-header h3 {
  margin: 0;
  color: #374151;
  font-size: 18px;
  font-weight: 600;
}

.quick-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.quick-add-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  min-width: 0;
}

.quick-add-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.quick-add-amount {
  width: 80px;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
}

.quick-add-amount:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.quick-add-btn {
  background-color: #059669;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s ease;
}

.quick-add-btn:hover {
  background-color: #047857;
}

/* Custom Ingredients Panel */
.custom-ingredients-panel {
  margin-top: 32px;
  margin-bottom: 24px;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: none;
}

/* Custom Ingredients Main Header */
.custom-ingredients-main-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.custom-ingredients-main-header h3 {
  margin: 0;
  color: #374151;
  font-size: 18px;
  font-weight: 600;
}

/* Ingredients Divider */
.ingredients-divider {
  height: 1px;
  background-color: #e5e7eb;
  margin: 20px 0;
}

.custom-ingredients-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.custom-ingredients-header h4 {
  margin: 0;
  color: #374151;
  font-size: 18px;
  font-weight: 600;
}

.custom-ingredients-count {
  background-color: #f3f4f6;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.custom-ingredients-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-ingredient-item {
  padding: 12px;
  background-color: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: background-color 0.2s ease;
}

.custom-ingredient-item:hover {
  background-color: #f3f4f6;
}

.custom-ingredient-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.custom-ingredient-name {
  font-weight: 500;
  color: #374151;
  flex: 1;
}

.custom-ingredient-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-ingredient-edit-btn,
.custom-ingredient-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.custom-ingredient-item:hover .custom-ingredient-edit-btn,
.custom-ingredient-item:hover .custom-ingredient-delete-btn {
  opacity: 1;
}

.custom-ingredient-edit-btn:hover {
  background-color: rgba(59, 130, 246, 0.1);
}

.custom-ingredient-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.custom-ingredient-amount {
  font-weight: 500;
  color: #6b7280;
  font-size: 14px;
}

.custom-ingredient-edit-form {
  width: 100%;
  padding: 8px 0;
}

.edit-custom-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.edit-ingredient-name {
  font-weight: 500;
  color: #374151;
  min-width: 120px;
}

.custom-ingredient-edit-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  min-width: 0;
}

.custom-ingredient-edit-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.edit-custom-form-buttons {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Custom Ingredients Empty State */
.custom-ingredients-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}

.custom-empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.custom-ingredients-empty h4 {
  margin: 0 0 8px 0;
  color: #374151;
  font-size: 18px;
  font-weight: 600;
}

.custom-ingredients-empty p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

/* Chat input */

/* Flash Messages */
.flash-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: 500;
  line-height: 1.4;
  animation: slideIn 0.3s ease-out;
}

.flash-notice {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.flash-alert {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.flash-message-text {
  flex: 1;
  margin-right: 12px;
}

.flash-dismiss-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  padding: 0;
  line-height: 1;
}

.flash-dismiss-btn:hover {
  opacity: 1;
}

.flash-notice .flash-dismiss-btn {
  color: #065f46;
}

.flash-alert .flash-dismiss-btn {
  color: #991b1b;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Chat input */

/* =============================================================================
   UNIFIED INGREDIENT ITEM STYLES
   Based on meal plan ingredients styling with green amount boxes
   ============================================================================= */

.unified-ingredient-item {
  margin-bottom: 4px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.unified-ingredient-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.unified-ingredient-item.checked {
  background-color: rgba(16, 185, 129, 0.05);
}

.unified-ingredient-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
}

.unified-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 2px solid #d1d5db;
  cursor: pointer;
  flex-shrink: 0;
}

.unified-checkbox:checked {
  background-color: #10b981;
  border-color: #10b981;
}

.unified-ingredient-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-width: 0;
}

.unified-ingredient-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unified-ingredient-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.unified-ingredient-edit-btn,
.unified-ingredient-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: background-color 0.15s ease;
}

.unified-ingredient-edit-btn:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.unified-ingredient-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

.unified-ingredient-amount {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  background: #d1fae5;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  min-width: 40px;
  text-align: center;
}

/* Checked state styling */
.unified-ingredient-item.checked .unified-ingredient-name {
  color: #6b7280;
  text-decoration: line-through;
}

.unified-ingredient-item.checked .unified-ingredient-amount {
  opacity: 0.7;
}

/* Container for unified ingredients */
.unified-ingredients-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Organization Settings Styles */
.settings-container {
  max-width: 800px;
  margin: 0;
  padding: 0;
}

.settings-section {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
  overflow: hidden;
}

.settings-section-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 20px 24px;
}

.settings-section-header h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #2d3748;
}

.settings-section-description {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

.settings-section-content {
  padding: 24px;
}

.categories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.categories-header h3,
.hidden-ingredients-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
}

.hidden-ingredients-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

/* Hidden ingredients grid and items */
.hidden-ingredients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.hidden-ingredient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 8px 12px;
  transition: background-color 0.15s ease;
}

.hidden-ingredient-item:hover {
  background: #fef3c7;
  border-color: #d97706;
}

.hidden-ingredient-name {
  font-size: 14px;
  font-weight: 500;
  color: #92400e;
  flex: 1;
}

.hidden-ingredient-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  font-size: 12px;
  transition: background-color 0.15s ease;
  margin-left: 8px;
}

.hidden-ingredient-delete-btn:hover {
  background-color: rgba(217, 119, 6, 0.1);
}

.hidden-ingredients-empty {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

.hidden-ingredients-empty p {
  margin: 0 0 8px 0;
  font-weight: 500;
}

.hidden-ingredients-empty small {
  color: #9ca3af;
}

/* Form styling for both categories and hidden ingredients */
.hidden-ingredient-input-group,
.category-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 16px;
}

.hidden-ingredient-input,
.category-input {
  flex: 1;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.5;
}

.hidden-ingredient-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.category-input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.hidden-ingredient-submit,
.category-submit {
  height: 40px;
  padding: 0 16px;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Error message styling */
.form-error {
  background-color: #fef2f2;
  border: 1px solid #f87171;
  color: #dc2626;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 12px;
}

.settings-section-content h4 {
  margin: 32px 0 16px 0;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

/* Custom ingredient layout with external delete button */
.custom-ingredient-with-delete {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-ingredient-with-delete .unified-ingredient-item {
  flex: 1;
}

.custom-ingredient-external-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.custom-ingredient-external-delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
}

/* ========================================
   PHASE 2.3: MOBILE TOUCH IMPROVEMENTS
   ======================================== */

/* Enhanced touch targets for mobile devices */
@media (max-width: 768px) {
  /* Ensure minimum touch target sizes (44px iOS recommendation) */
  .placeholder-meal,
  .recipe-meal,
  .empty-meal-slot {
    min-height: 48px;
    touch-action: manipulation; /* Prevent double-tap zoom */
    -webkit-touch-callout: none; /* Disable iOS callout menu on long press */
  }
  
  /* Larger tap targets for action buttons */
  .placeholder-actions button,
  .recipe-actions button {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
    font-size: 14px;
    margin: 2px;
  }
  
  /* Enhanced touch feedback */
  .placeholder-meal:active,
  .recipe-meal:active,
  .empty-meal-slot:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
    background-color: rgba(59, 130, 246, 0.1);
  }
  
  /* Better drag visual feedback for mobile */
  .placeholder-meal.dragging,
  .recipe-meal.dragging {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0.9;
  }
  
  /* Mobile-friendly form inputs */
  .placeholder-input {
    min-height: 48px;
    font-size: 16px; /* Prevent iOS zoom */
    padding: 14px;
    border-radius: 8px;
    -webkit-appearance: none; /* Remove iOS default styling */
  }
  
  .save-placeholder-btn,
  .cancel-placeholder-btn {
    min-height: 44px;
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 8px;
    margin: 4px 2px;
  }
  
  /* Improved Convert Recipe button for mobile */
  .convert-recipe-btn {
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    min-height: 44px;
  }
  
  /* Better remove button visibility on mobile */
  .remove-meal-btn {
    padding: 10px 14px;
    font-size: 18px;
    font-weight: bold;
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Touch-friendly drag handles */
  .placeholder-meal,
  .recipe-meal {
    cursor: grab;
    position: relative;
  }
  
  .placeholder-meal:active,
  .recipe-meal:active {
    cursor: grabbing;
  }
  
  /* Add visual drag indicator for mobile */
  .placeholder-meal::before,
  .recipe-meal::before {
    content: '⋮⋮';
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 12px;
    line-height: 0.5;
    opacity: 0.6;
  }
  
  /* Enhanced error messages for mobile */
  .error-message,
  .create-error-message {
    font-size: 12px;
    padding: 8px 10px;
    border-radius: 6px;
  }
  
  .retry-button {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 4px;
  }
  
  /* Mobile-optimized success/error toasts */
  .success-message,
  .error-message-toast {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    max-width: none !important;
    width: calc(100% - 20px) !important;
    text-align: center;
    padding: 16px;
    font-size: 14px;
  }
}

/* Touch improvements for all screen sizes */
.placeholder-meal,
.recipe-meal {
  touch-action: manipulation;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Smooth transitions for all interactive elements */
.placeholder-meal,
.recipe-meal,
.placeholder-actions button,
.recipe-actions button {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

/* ========================================
   PHASE 2.4: FINAL POLISH & PERFORMANCE
   ======================================== */

/* Performance optimizations */
.placeholder-meal,
.recipe-meal {
  will-change: transform, opacity; /* Optimize for animations */
  backface-visibility: hidden; /* Prevent flickering */
  perspective: 1000; /* Enable 3D acceleration */
}

/* Accessibility improvements */
.placeholder-meal:focus,
.recipe-meal:focus,
.empty-meal-slot:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .placeholder-meal {
    border: 2px solid;
    background: white;
  }
  
  .placeholder-icon {
    background: #000;
  }
  
  .error-message,
  .create-error-message {
    border: 2px solid;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .placeholder-meal,
  .recipe-meal,
  .placeholder-actions button,
  .recipe-actions button {
    transition: none;
  }
  
  .placeholder-meal.loading::after {
    animation: none;
  }
  
  .success-message,
  .error-message-toast {
    animation: none;
  }
  
  .placeholder-meal.error {
    animation: none;
  }
}

/* Print styles */
@media print {
  .placeholder-actions,
  .recipe-actions,
  .success-message,
  .error-message-toast,
  .error-message {
    display: none;
  }
  
  .placeholder-meal,
  .recipe-meal {
    background: white !important;
    border: 1px solid #000 !important;
    box-shadow: none !important;
  }
}

/* Mobile-specific optimizations */
.mobile-optimized {
  -webkit-tap-highlight-color: rgba(59, 130, 246, 0.3);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Performance hint for frequently animated elements */
.dragging,
.loading {
  will-change: transform, opacity, box-shadow;
}

/* GPU acceleration for smooth animations */
.placeholder-meal.dragging,
.recipe-meal.dragging {
  transform: translateZ(0); /* Force GPU layer */
}

/* Optimize for different screen densities */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .placeholder-icon::before {
    border-radius: 50%;
    background: white;
  }
  
  .retry-button,
  .save-placeholder-btn,
  .cancel-placeholder-btn {
    font-weight: 500; /* Better text rendering on high DPI */
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .placeholder-meal {
    background: #1f2937;
    border-color: #374151;
    color: #f9fafb;
  }
  
  .placeholder-meal.error {
    background: #374151;
    border-color: #ef4444;
  }
  
  .placeholder-input {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }
  
  .empty-meal-slot {
    border-color: #4b5563;
    color: #9ca3af;
  }
  
  .success-message {
    background: #059669 !important;
  }
  
  .error-message-toast {
    background: #dc2626 !important;
  }
}

/* ========================================
   FAVORITE RECIPE CONTENT STYLING
   ======================================== */

/* Recipe content section in detailed view */
.recipe-content-section {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.recipe-content-section h3 {
  margin: 0 0 16px 0;
  color: #374151;
  font-size: 18px;
  font-weight: 600;
}

.recipe-content {
  line-height: 1.6;
  color: #4b5563;
  font-size: 14px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #f3f4f6;
  border-radius: 6px;
  padding: 16px;
  background: #fafbfc;
}

/* Recipe preview in index cards */
.favorite-recipe-preview {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}

.recipe-preview-content {
  font-size: 12px;
  line-height: 1.4;
  color: #6c757d;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .recipe-content-section {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .recipe-content {
    max-height: 300px;
    padding: 12px;
    font-size: 13px;
  }
  
  .favorite-recipe-preview {
    padding: 10px;
    margin-bottom: 10px;
  }
  
  .recipe-preview-content {
    font-size: 11px;
    -webkit-line-clamp: 3;
  }
}

/* Smart Placeholder Input Styling */
.smart-placeholder-form {
  position: relative;
  width: 100%;
}

.smart-placeholder-input {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #0ea5e9;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: white;
  color: #1f2937;
}

.smart-placeholder-input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.smart-placeholder-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: white;
  border: 2px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.smart-placeholder-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.smart-placeholder-actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-placeholder-btn {
  background: #10b981;
  color: white;
}

.save-placeholder-btn:hover {
  background: #059669;
  transform: scale(1.05);
}

.cancel-placeholder-btn {
  background: #ef4444;
  color: white;
}

.cancel-placeholder-btn:hover {
  background: #dc2626;
  transform: scale(1.05);
}

/* Dropdown Item Styling */
.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.selected {
  background: #f0f9ff;
}

.favorite-item {
  border-left: 3px solid #0ea5e9;
}

.favorite-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.favorite-title {
  font-weight: 600;
  color: #1f2937;
  font-size: 14px;
}

.favorite-badge {
  font-size: 10px;
  background: #fef3c7;
  color: #d97706;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.favorite-details {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #6b7280;
  flex-wrap: wrap;
}

.favorite-details .cuisine {
  background: #e0e7ff;
  color: #4338ca;
  padding: 1px 4px;
  border-radius: 4px;
}

.favorite-details .ingredients-count {
  font-weight: 500;
}

.favorite-details .difficulty {
  color: #f59e0b;
}

.create-option {
  border-left: 3px solid #6b7280;
  background: #f9fafb;
}

.create-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.create-title {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

.create-badge {
  font-size: 10px;
  background: #e5e7eb;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.create-details {
  font-size: 11px;
  color: #9ca3af;
}

/* Enhanced Smart Placeholder Visual Design */
.placeholder-meal.from-favorite {
  background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  border: 2px solid #0ea5e9;
  position: relative;
}

/* Star icon replaces the blue dot for favorite placeholders */
.placeholder-meal.from-favorite .placeholder-icon {
  background: none; /* Remove blue dot background for favorites */
  width: 12px; /* Adjust size for star */
  height: 12px;
  top: 2px; /* Slightly adjust position for star */
  left: 4px;
}

.placeholder-meal.from-favorite .placeholder-icon::before {
  content: '⭐';
  position: absolute;
  top: 0;
  left: 0;
  font-size: 12px;
  color: #f59e0b;
  background: none;
  width: auto;
  height: auto;
  border-radius: 0;
  transform: none;
}

.placeholder-meal.from-favorite .placeholder-title {
  font-weight: 600;
  color: #0369a1;
}

.placeholder-meal.from-favorite .convert-recipe-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  font-weight: 600;
  color: white;
}

.placeholder-meal.from-favorite .convert-recipe-btn:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

.placeholder-meta {
  margin: 4px 0;
  font-size: 11px;
}

.ingredients-indicator {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

/* Responsive Design for Smart Placeholders */
@media (max-width: 768px) {
  .smart-placeholder-dropdown {
    max-height: 250px;
  }
  
  .dropdown-item {
    padding: 16px 12px;
  }
  
  .favorite-header,
  .create-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  
  .smart-placeholder-input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px;
  }
  
  .smart-placeholder-actions button {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }
}

/* Animation enhancements */
.dropdown-item {
  animation: fadeInUp 0.2s ease;
}

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

.smart-placeholder-dropdown {
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: scaleY(0.95) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scaleY(1) translateY(0);
  }
}

/* Loading states for smart placeholders */
.smart-placeholder-form.loading .smart-placeholder-input {
  opacity: 0.6;
  pointer-events: none;
}

.smart-placeholder-form.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid #e5e7eb;
  border-top-color: #0ea5e9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Focus improvements for accessibility */
.dropdown-item:focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.smart-placeholder-input:focus {
  /* Enhanced focus for better accessibility */
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Dark mode support for smart placeholders */
@media (prefers-color-scheme: dark) {
  .smart-placeholder-input {
    background: #1f2937;
    color: #f9fafb;
    border-color: #374151;
  }
  
  .smart-placeholder-dropdown {
    background: #1f2937;
    border-color: #374151;
  }
  
  .dropdown-item {
    border-bottom-color: #374151;
  }
  
  .dropdown-item:hover,
  .dropdown-item.selected {
    background: #374151;
  }
  
  .favorite-title,
  .create-title {
    color: #f9fafb;
  }
  
  .placeholder-meal.from-favorite {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-color: #0ea5e9;
  }
}

/* Meal plan list page */
.meal-plans-index {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 0;
}

.meal-plans-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e5e5;
}

.meal-plans-header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 8px 0;
}

.meal-plan-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.meal-plan-card {
  display: block;
  padding: 20px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.meal-plan-card:hover {
  border-color: #10a37f;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.meal-plan-card.active {
  border-color: #10a37f;
  box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.2);
}

.meal-plan-card-title {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 6px 0;
}

.meal-plan-card-dates {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 14px 0;
}

.meal-plan-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meal-plans-empty {
  text-align: center;
  padding: 64px 24px;
  color: #6b7280;
}

.meal-plans-empty h3 {
  color: #374151;
  margin: 0 0 8px 0;
}

.meal-plans-empty p {
  margin: 0 0 20px 0;
}

/* Login QR code on the user settings page */
.login-qr {
  max-width: 220px;
  margin: 0 0 12px 0;
  padding: 12px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

.login-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.login-qr-url {
  display: block;
  max-width: 320px;
  margin: 0 0 8px 0;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #0ea5e9;
  word-break: break-all;
}

.login-qr-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
}

/* Chat panel header with back-to-meal-plan control */
.chat-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: #f8f9fa;
}

.chat-panel-title {
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-back-btn {
  flex-shrink: 0;
}
