/* static/css/recipe-styles.css */

@import url('./colors.css');

/* Bookmark Icon Styles */
.bookmark-icon svg {
  width: 24px;
  height: 24px;
}

.bookmark-icon svg path {
  fill: none;
  stroke: var(--bs-dark);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

a.bookmark-icon:hover {
  text-decoration: none;
  cursor: pointer;
}

a.bookmark-icon:hover svg path {
  stroke: var(--bs-orange);
  fill: var(--bs-orange);
}

.bookmark-icon.bookmarked svg path {
  stroke: var(--bs-orange);
  fill: var(--bs-orange);
}

a.bookmark-icon.bookmarked:hover svg path {
  stroke: var(--bs-dark);
  fill: none;
}

.chevron-btn {
  color: var(--bs-black);
  transition: color 0.3s ease;
}

.chevron-btn:hover {
  color: orange;
}

.recipe-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

.action-icon svg {
  width: 100%;
  height: 100%;
}

/* Recipe Card Styles */
.recipe-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: visible;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  z-index: 1;
}

.recipe-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-5px);
  z-index: 100;
}

/* Ensure columns don't clip tooltips - more specific selectors */
.row>.col-lg-3,
.row>.col-md-4,
.row>.col-sm-6,
.row>[class*="col-"] {
  overflow: visible;
}

/* Ensure row doesn't clip tooltips */
.container .row,
.container-fluid .row,
div.row {
  overflow: visible;
}

/* Ensure container doesn't clip tooltips */
div.container,
div.container-fluid {
  overflow: visible;
}

/* Make the recipe card establish positioning context without clipping */
.recipe-card .recipe-nutrition-preview,
.recipe-card .recipe-info,
.recipe-card .recipe-details {
  position: relative;
  overflow: visible;
}

.recipe-image-wrapper {
  position: relative;
  width: 100%;
  height: 133px;
  overflow: hidden;
}

.recipe-image-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.recipe-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-details {
  padding: 0.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.recipe-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.25rem;
  min-height: 3.5rem;
}

.recipe-title {
  font-size: 1rem;
  line-height: 1.2;
  margin: 0 0 0.1rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.recipe-source {
  font-size: 0.75rem;
  color: var(--bs-dark);
  margin-bottom: 0.1rem;
}

.recipe-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin-top: 0;
  overflow: visible;
}

.recipe-rating,
.recipe-time,
.recipe-ingredients {
  font-size: 0.75rem;
  color: var(--bs-dark);
  margin-bottom: 0.1rem;
}

.star {
  color: #ccc;
  font-size: 0.875em;
}

.star.filled {
  color: #ffd700;
}

.rating-count {
  margin-left: 0.25rem;
}

.recipe-time {
  color: var(--bs-dark);
  margin-left: 0;
  text-align: left;
  margin-bottom: 0.25rem;
}

.recipe-ingredients {
  font-style: italic;
  margin-top: auto;
}

/* Recipe Source Link Styles */
.recipe-source a,
.recipe-source a:link,
.recipe-source a:visited {
  color: var(--bs-dark);
  text-decoration: none;
  transition: color 0.3s ease;
}

.recipe-source a:active,
.recipe-source a:hover {
  color: var(--bs-orange);
}


/* Recipe Card Bookmark Styles */
.recipe-card .bookmark-container {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 10;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  padding: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.recipe-card .bookmark-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.recipe-card .bookmark-icon svg {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0px 0px 2px rgba(0, 0, 0, 0.5));
}

.recipe-card .bookmark-icon svg path {
  fill: none;
  stroke: var(--bs-white);
  stroke-width: 2px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.recipe-card a.bookmark-icon:hover svg path {
  fill: var(--bs-orange);
  stroke: var(--bs-orange);
}

.recipe-card .bookmark-icon.bookmarked svg path {
  fill: var(--bs-orange);
  stroke: var(--bs-orange);
}

.recipe-card .bookmark-icon.bookmarked:hover svg path {
  fill: var(--bs-orange);
  stroke: var(--bs-orange);
}

/* Ensure in-page scroll to notes accounts for fixed/sticky headers */
.my-notes {
  scroll-margin-top: 80px;
}


/* cluster layout - removed problematic overflow-y: auto rule that was creating duplicate scrollers */

.cluster {
  margin-bottom: 2rem;
}

.recipe-row {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  padding-bottom: 1rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.recipe-row::-webkit-scrollbar {
  height: 6px;
}

.recipe-row::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.recipe-row::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.recipe-row::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.cluster-title {
  position: sticky;
  left: 0;
  background: white;
  padding: 0.5rem 0;
  margin-bottom: 1rem;
  z-index: 1;
  font-size: 1.5rem;
}

/* Page Title Styles */
.page-title {
  font-size: 3rem;
  font-weight: 600;
  color: var(--bs-black);
  margin-bottom: 1rem;
}

/* Nutrition Facts Display Styles */
/* Nutrition Facts Container */
.nutrition-facts-container {
  background-color: var(--bs-gray-50);
}

.nutrition-grid {
  font-size: 0.95rem;
}

/* Desktop: Nutrition stays with ingredients column */
@media (min-width: 768px) {
  .nutrition-column {
    display: none;
  }

  .ingredients-column .nutrition-section {
    display: block;
    margin-top: 2rem;
  }
}

/* Mobile: Nutrition shows in its own section after instructions */
@media (max-width: 767px) {
  .ingredients-column .nutrition-section {
    display: none;
  }

  .nutrition-column {
    order: 3;
  }

  .ingredients-column {
    order: 1;
  }

  .instructions-column {
    order: 2;
  }
}

/* Desktop font sizes for ingredients and instructions */
.checklist li,
.instruction-list li {
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
}

.checklist .form-check-label {
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
}

.instruction-list li+li {
  margin-top: 8px;
}

.checklist li {
  margin-bottom: 2px;
}

.recipe-checkbox.form-check {
  margin-top: 10px;
}

.ingredients-column .recipe-checkbox.form-check .form-check-input {
  width: 20px;
  height: 20px;
}

/* Section headings (Ingredients, Instructions, Notes, etc.) */
.ingredients-column h6,
.instructions-column h6,
.nutrition-column h6,
.my-notes h6 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

/* Diabetic Friendly Breakdown Headers */
.diabetic-section-header {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
}

/* Diabetic Pill Badges */
.diabetic-pill-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-left: 12px;
  white-space: nowrap;
  line-height: 1.4;
}

/* Modification Icon Spacing */
.modification-icon {
  font-size: 1.5rem;
  margin-right: 16px;
  min-width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.diabetic-pill-friendly {
  background-color: #d4edda;
  color: #155724;
  border: 2px solid #a8d5b0;
}

.diabetic-pill-caution {
  background-color: #fff3cd;
  color: #856404;
  border: 2px solid #ffd966;
}

.diabetic-pill-not-recommended {
  background-color: #f8d7da;
  color: #721c24;
  border: 2px solid #f0a3a8;
}

.diabetic-breakdown-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 1.5rem;
}

.diabetic-modifications-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

/* Add spacing between ingredient/instruction columns */
.ingredients-column,
.instructions-column,
.nutrition-column {
  padding-left: 2rem;
  padding-right: 2rem;
}

.nutrition-item {
  transition: background-color 0.2s ease;
}

.nutrition-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
  padding-left: 4px;
  padding-right: 4px;
}

/* Make calories stand out */
.nutrition-item.border-bottom {
  font-size: 1.1rem;
  padding-bottom: 8px !important;
  margin-bottom: 8px !important;
}

/* Indented sub-items (fiber, sugars, fat breakdown) */
.nutrition-item.ps-3 {
  font-size: 0.9rem;
}

/* Vitamins section header */
.nutrition-item .fw-bold.small {
  color: var(--bs-black);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.85rem;
}

/* Quick nutrition badge for recipe cards */
.recipe-nutrition-preview {
  position: relative;
  z-index: 10;
  overflow: visible;
}

.nutrition-summary-badge {
  position: relative;
  display: inline-block;
}

.nutrition-label {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  background-color: var(--color-blue-light);
  color: var(--color-blue);
  border: 1px solid var(--color-blue);
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}

.nutrition-details {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--bs-gray-300);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  width: max-content;
  max-width: 240px;
}

.nutrition-summary-badge:hover .nutrition-details {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 6px;
}

/* Hover effects for clickable nutrition and diabetic badges */
.clickable-nutrition:hover,
.clickable-diabetic:hover {
  opacity: 0.85;
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

.clickable-nutrition:active,
.clickable-diabetic:active {
  transform: translateY(0);
}

.clickable-nutrition .nutrition-label,
.clickable-diabetic .nutrition-label {
  transition: all 0.2s ease;
}

.clickable-nutrition:hover .nutrition-label,
.clickable-diabetic:hover .nutrition-label {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Substitution Item Styles */
.substitution-item {
  border-radius: 8px;
  padding: 12px 16px !important;
  margin-bottom: 8px;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.substitution-item:hover {
  background-color: #f8f9fa !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.substitution-item.selected {
  background-color: #e7f5ff !important;
  border-left: 4px solid #0d6efd;
  box-shadow: 0 2px 12px rgba(13, 110, 253, 0.15);
}

.modification-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.modification-checkbox:checked {
  background-color: #198754;
  border-color: #198754;
}

/* Select All / Clear All Buttons */
#select-all-modifications,
#clear-all-modifications {
  font-weight: 600;
  padding: 6px 16px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#select-all-modifications:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

#clear-all-modifications:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
  background-color: #dc3545;
  color: white;
  border-color: #dc3545;
}

/* Modifications Cart - Sticky Footer */
.modifications-cart {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--bs-secondary-600) 0%, var(--bs-secondary-800) 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1040;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modifications-cart h6 {
  font-weight: 600;
  margin: 0;
}

.modifications-cart .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.modifications-cart .btn-outline-light:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: white;
}

.modifications-cart .btn-light {
  font-weight: 600;
}

#cart-summary {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

#cart-summary .cart-impact-item {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
}

.preview-substitution-btn {
  font-size: 0.875rem;
  padding: 4px 12px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.preview-substitution-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Comparison Modal Styles */
#substitutionComparisonModal .modal-dialog {
  max-width: 900px;
}

#substitutionComparisonModal .nutrition-item {
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  font-size: 0.95rem;
}

#substitutionComparisonModal .nutrition-item:last-child {
  border-bottom: none;
}

#substitutionComparisonModal .border-end {
  border-right: 2px solid #e9ecef !important;
}

#substitutionComparisonModal .badge {
  font-size: 0.75rem;
  padding: 4px 8px;
}

#substitutionComparisonModal h6 {
  font-weight: 600;
  letter-spacing: 0.5px;
  font-size: 0.875rem;
}

#substitutionComparisonModal .text-success {
  color: #198754 !important;
}

#substitutionComparisonModal .alert-success {
  background-color: #d1e7dd;
  border-color: #badbcc;
}



.nutrition-badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.nutrition-badge-calories {
  background-color: var(--color-orange-light);
  color: var(--color-orange);
}

.nutrition-badge-protein {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
}

.nutrition-badge-carbs {
  background-color: var(--color-green-light);
  color: var(--color-green);
}

.nutrition-badge-fat {
  background-color: var(--color-red-light);
  color: var(--color-red);
}

.nutrition-badge-fiber {
  background-color: var(--color-brown-light);
  color: var(--color-brown);
}

.nutrition-badge-gi {
  background-color: var(--color-purple-light);
  color: var(--color-purple);
}

.nutrition-badge-gl {
  background-color: var(--color-teal-light);
  color: var(--color-teal);
}

/* ADA Compliance Badge */
.ada-compliance-badge {
  position: relative;
  display: inline-block;
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  margin-left: 8px;
  cursor: help;
  transition: transform 0.2s ease;
}

.ada-compliance-badge:hover {
  transform: scale(1.05);
}

.ada-label {
  white-space: nowrap;
}

/* ADA Compliance Rating Colors */
.ada-compliance-recommended {
  background-color: var(--ada-recommended-bg);
  color: var(--ada-recommended-color);
  border: 1px solid var(--ada-recommended-border);
}

.ada-compliance-acceptable {
  background-color: var(--ada-acceptable-bg);
  color: var(--ada-acceptable-color);
  border: 1px solid var(--ada-acceptable-border);
}

.ada-compliance-caution {
  background-color: var(--ada-caution-bg);
  color: var(--ada-caution-color);
  border: 1px solid var(--ada-caution-border);
}

.ada-compliance-not_recommended {
  background-color: var(--ada-not-recommended-bg);
  color: var(--ada-not-recommended-color);
  border: 1px solid var(--ada-not-recommended-border);
}

/* ADA Tooltip */
.ada-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 0;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  min-width: 280px;
  max-width: 320px;
  text-align: left;
  font-size: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  white-space: normal;
  letter-spacing: normal;
  overflow: hidden;
}

.ada-tooltip-header {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  border-radius: 8px 8px 0 0;
  margin-bottom: 8px;
}

.ada-compliance-badge:hover .ada-tooltip {
  display: block;
}

/* Tooltip arrow */
.ada-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: white;
}

.ada-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top-color: #ddd;
  margin-top: 1px;
}

.ada-tooltip-section {
  margin-bottom: 8px;
  padding: 0 12px 12px 12px;
}

.ada-tooltip-section:last-child {
  margin-bottom: 0;
}

.ada-tooltip-section strong {
  display: block;
  margin-bottom: 4px;
  color: #333;
  font-size: 0.8rem;
  font-weight: 600;
}

.ada-tooltip-section ul {
  margin: 0;
  padding-left: 16px;
  color: #555;
  font-weight: 400;
  letter-spacing: normal;
}

.ada-tooltip-section li {
  margin-bottom: 4px;
  line-height: 1.4;
}

.ada-tooltip-section li:last-child {
  margin-bottom: 0;
}

/* ADA Compliance Assessment (Recipe Detail Page) */
.ada-assessment-container {
  background: white;
  border: 1px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.5rem;
}

.ada-assessment-toggle {
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.ada-assessment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  transition: background 0.2s ease;
}

.ada-assessment-toggle:hover .ada-assessment-header {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.ada-assessment-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin-right: 12px;
}

.ada-compliance-badge-inline {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: auto;
  margin-left: 12px;
}

.ada-chevron {
  transition: transform 0.3s ease;
  color: #666;
  font-size: 1rem;
}

.ada-assessment-toggle[aria-expanded="true"] .ada-chevron {
  transform: rotate(180deg);
}

.ada-assessment-content {
  padding: 24px 20px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.ada-assessment-section {
  margin-bottom: 20px;
}

.ada-assessment-section:last-of-type {
  margin-bottom: 0;
}

.ada-assessment-section h6 {
  font-size: 1rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e9ecef;
}

.ada-assessment-section ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.ada-assessment-section li {
  padding: 10px 0 10px 28px;
  position: relative;
  line-height: 1.6;
  color: #495057;
  border-bottom: 1px solid #f1f3f5;
}

.ada-assessment-section li:last-child {
  border-bottom: none;
}

.ada-assessment-section li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: #6c757d;
  font-size: 1.2rem;
  line-height: 1.6;
}

.ada-assessment-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e9ecef;
  color: #6c757d;
  text-align: right;
}