/* Profile Dashboard Styles - Extracted from style.css */

/******Profile Dashboard*******/

/* Container */
.text-orange {
  color: var(--fs-accent);
}
.bg-orange {
  background-color: var(--fs-accent);
}
.table th,
.table td {
  white-space: nowrap;
}
@media (max-width: 767.98px) {
  .table th,
  .table td {
    font-size: 0.875rem;
  }
  .navigationFont {
    margin-bottom: 8px;
  }
}

.container-fluid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Meal Planner Header */
.meal-planner-header {
  background-color: #fdf6e3;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.meal-planner-title {
  color: #d97706;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
}

.meal-planner-steps {
  list-style-type: none;
  padding: 0;
  margin: 0;
  counter-reset: step-counter;
}

.meal-planner-steps li {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #4b5563;
}

.meal-planner-steps li::before {
  content: counter(step-counter);
  counter-increment: step-counter;
  background-color: #d97706;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  font-size: 14px;
  font-weight: bold;
}

/* Meal Sections */
.meal-section {
  border: 1px solid var(--fs-border-default);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.meal-header {
  background-color: var(--fs-bg-tertiary);
  padding: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  color: #374151;
  transition: background-color 0.2s ease;

  &:hover {
    background-color: var(--fs-border-default);
  }
}

.meal-name {
  flex: 0 0 30%;
  font-weight: bold;
  color: #1f2937;
}

.meal-totals {
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: center;

  .nutrient-total {
    flex: 1;
    text-align: right;
    padding: 0 5px;
  }
}

.meal-total-spacer {
  flex: 0 0 20%;
}

.toggle-icon {
  flex: 0 0 auto;
}

.meal-content {
  padding: 20px;
}

/* Tables */
.meal-table,
.daily-summary-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 15px;
  table-layout: fixed;
}

/*Align meal totals with daily summary table */
.meal-totals .nutrient-total,
.daily-summary-table th,
.daily-summary-table td {
  flex: 1;
  text-align: right;
  padding: 0 5px;
}

.meal-totals .nutrient-total:first-child,
.daily-summary-table th:nth-child(3),
.daily-summary-table td:nth-child(3) {
  padding-left: 0;
}

.meal-totals .nutrient-total:last-child,
.daily-summary-table th:last-child,
.daily-summary-table td:last-child {
  padding-right: 0;
}
/* Allow text to wrap in table cells */

.meal-table th,
.meal-table td,
.daily-summary-table th,
.daily-summary-table td {
  white-space: normal; /* Allow text to wrap */
  word-wrap: break-word; /* Break long words */
  overflow-wrap: break-word; /* Support for different browsers */
  padding: 8px 4px; /* Default padding */
}

.meal-table th,
.daily-summary-table th {
  font-weight: bold;
  color: #4b5563;
  background-color: var(--fs-bg-hover);
}

/* Column widths */
.meal-table th,
.meal-table td,
.daily-summary-table th,
.daily-summary-table td {
  width: 16%; /* Adjusted default width */
  text-align: right;
}

.meal-table th:first-child,
.meal-table td:first-child,
.daily-summary-table th:first-child,
.daily-summary-table td:first-child {
  width: 30%; /* Narrower first column for food names */
  text-align: left;
}

.meal-table th:nth-child(2),
.meal-table td:nth-child(2),
.daily-summary-table th:nth-child(2),
.daily-summary-table td:nth-child(2) {
  width: 20%; /* Narrower 'Serving' column */
  text-align: left;
}

/* Right-align numeric columns in both tables starting from the 3rd column */
.meal-table th:nth-child(n + 3),
.meal-table td:nth-child(n + 3),
.daily-summary-table th:nth-child(n + 3),
.daily-summary-table td:nth-child(n + 3) {
  text-align: right;
}

/* Style for the empty state message */
.empty-state {
  text-align: center;
  padding: 20px;
  color: var(--fs-text-secondary);
  font-style: italic;
}

/* Style for serving info on small screens */
.serving-info {
  display: none; /* Hidden by default */
  margin-top: 8px;
  align-items: center;
  gap: 4px;
}

.serving-label {
  font-weight: bold;
}

.serving-column {
  width: 150px; /* Increased width to accommodate grams */
}
.serving-input {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;

  input {
    width: 60px;
    border: 1px solid var(--fs-border-hover);
    border-radius: 4px;
    padding: 4px;

    &:focus {
      outline: none;
      border-color: var(--fs-border-selected);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
  }
}
.serving-grams {
  font-size: 0.85em;
  color: var(--fs-text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Hide spacer column in Daily Summary on small screens */
@media (max-width: 576px) {
  .daily-summary {
    overflow-x: hidden;
    width: 100%;
    padding: 0;
  }

  .daily-summary-table {
    width: 100%;
    table-layout: fixed;
    margin: 0;
  }

  /* Force table to take up exactly 100% width */
  .daily-summary-table tbody,
  .daily-summary-table tr {
    width: 100%;
    display: table;
    table-layout: fixed;
  }

  .daily-summary-table th,
  .daily-summary-table td {
    font-size: 11px;
    padding: 4px 2px;
    word-break: break-word;
    white-space: normal;
    vertical-align: top;
  }

  /* Adjust column widths */
  .daily-summary-table th:first-child,
  .daily-summary-table td:first-child {
    width: 35%;
  }

  .daily-summary-table th:not(:first-child),
  .daily-summary-table td:not(:first-child) {
    width: 16.25%;
    text-align: center;
  }

  td .nutrient-total {
    display: grid !important;
    grid-template-rows: auto auto !important;
    justify-items: center !important;
    gap: 2px !important;
    height: 100% !important;
  }

  td .nutrient-total > * {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Remove text truncation */
  .daily-summary-table .nutrient-total,
  .daily-summary-table td {
    overflow: visible;
    text-overflow: clip;
  }

  .daily-summary-table td {
    line-height: 1.2;
  }

  .nutrient-total {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 4px !important;
    text-align: center !important;
  }

  .nutrient-total > span {
    display: block !important;
    width: 100% !important;
  }

  /* Hide the serving column */
  table.meal-table .serving-column,
  table.daily-summary-table .daily-summary-spacer {
    display: none;
  }

  /* Show serving info beneath course name */
  .serving-info {
    display: flex;
  }

  .serving-info label.serving-label {
    display: none;
  }

  /* Table adjustments - Override main selector for small screens */
  .meal-table th,
  .meal-table td,
  .daily-summary-table th,
  .daily-summary-table td {
    padding: 6px 4px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Abbreviate headers */
  .meal-table th:nth-child(3),
  .daily-summary-table th:nth-child(3) {
    content: "Cal";
  }
  .meal-table th:nth-child(4),
  .daily-summary-table th:nth-child(4) {
    content: "P";
  }
  .meal-table th:nth-child(5),
  .daily-summary-table th:nth-child(5) {
    content: "C";
  }
  .meal-table th:nth-child(6),
  .daily-summary-table th:nth-child(6) {
    content: "F";
  }

  .daily-summary-table tr:nth-child(3) td:not(:first-child) {
    font-size: 10px;
    white-space: pre-line; /* This allows breaking at \n */
    word-break: break-word;
    line-height: 1.3;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .daily-summary-table tr:nth-child(3) .btn-link {
    display: block;
    margin: 2px auto 0;
  }

  .meal-table input[type="number"] {
    width: 45px;
    font-size: 13px;
    padding: 2px;
  }

  .add-foods-button {
    font-size: 14px;
    padding: 8px 16px;
  }

  .btn-link {
    padding: 0;
    margin-top: 2px;
  }

  .bi-info-circle {
    font-size: 11px;
  }
}

/* Ensure tables are responsive */

/* Button Styles */
.add-foods-button {
  background-color: var(--fs-border-selected);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
}

.add-foods-button:hover {
  background-color: var(--fs-primary);
}

/* Daily Summary Section Styles */
.daily-summary {
  background-color: var(--fs-bg-tertiary);
  border-radius: 8px;
  padding: 20px;
  margin-top: 30px;
}

.daily-summary-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  color: #374151;
}

/* Nutrient Total Styles */
.nutrient-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.nutrient-total-value {
  font-weight: bold;
  margin-right: 6px;
}

.nutrient-total-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.nutrient-total-icon.green {
  background-color: var(--fs-success);
}
.nutrient-total-icon.yellow {
  background-color: #fbbf24;
}
.nutrient-total-icon.red {
  background-color: var(--fs-error);
}

/* Ensure cells occupy space even if empty */
.daily-summary-table th,
.daily-summary-table td {
  min-width: 50px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--fs-border-default);
  white-space: nowrap;
}

/* Input Styles for Serving Amounts */
.meal-table input[type="number"] {
  width: 60px; /* Moved from inline styles */
  padding: 4px;
  border: 1px solid var(--fs-border-hover);
  border-radius: 4px;
  font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .serving-column {
    display: none;
  }
  .serving-info {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }
  .serving-info input {
    width: 60px;
  }
  .serving-info .serving-grams {
    width: 100%;
    margin-top: 2px;
  }

  .meal-name {
    flex: 0 0 100%;
    margin-bottom: 10px;
  }

  .meal-totals {
    flex: 0 0 100%;
    justify-content: space-between;
    padding-right: 0;
  }

  .meal-total-spacer {
    display: none;
  }

  .toggle-icon {
    position: absolute;
    right: 15px;
    top: 15px;
  }

  .meal-planner-title {
    font-size: 20px;
  }

  .meal-planner-steps li {
    font-size: 14px;
  }

  .meal-header {
    font-size: 16px;
    padding: 12px;
  }

  .meal-content {
    padding: 15px;
  }

  .meal-table,
  .daily-summary-table {
    font-size: 12px;
  }

  /* Adjust column widths for smaller screens */
  .meal-table col:first-child,
  .meal-table col:nth-child(2),
  .daily-summary-table col:first-child,
  .daily-summary-table col:nth-child(2) {
    width: 25%;
  }

  .meal-table col:nth-child(2),
  .daily-summary-table col:nth-child(2) {
    width: 18%;
  }

  .add-foods-button {
    font-size: 14px;
    padding: 8px 16px;
  }

  .daily-summary-title {
    font-size: 18px;
  }

  .nutrient-total-value {
    font-size: 12px;
  }

  .nutrient-total-icon {
    width: 10px;
    height: 10px;
  }

  .meal-table input[type="number"] {
    width: 50px;
    font-size: 12px;
  }
}

/* Shared Table Styles */
.aligned-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* Ensures fixed layout */
}

.aligned-table th,
.aligned-table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--fs-border-default);
  text-align: left; /* Default alignment */
}

.aligned-table th {
  background-color: var(--fs-bg-hover);
  font-weight: bold;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #374151;
}

/* Align numeric data to the right */
.aligned-table td:nth-child(n + 3),
.aligned-table th:nth-child(n + 3) {
  text-align: right;
}

/* Additional styles for better alignment and spacing */
.text-center {
  text-align: center;
}

.mt-3 {
  margin-top: 15px;
}

.mt-4 {
  margin-top: 20px;
}

.bg-white {
  background-color: white;
}

.border {
  border: 1px solid var(--fs-border-default);
}

.rounded-lg {
  border-radius: 8px;
}

.p-4 {
  padding: 16px;
}

.text-xl {
  font-size: 20px;
}

.font-bold {
  font-weight: bold;
}

.mb-2 {
  margin-bottom: 8px;
}

.py-2 {
  padding-top: 8px;
  padding-bottom: 8px;
}

.px-4 {
  padding-left: 16px;
  padding-right: 16px;
}

.rounded {
  border-radius: 4px;
}

.bg-gray-300 {
  background-color: var(--fs-border-hover);
}

.hover\:bg-gray-400:hover {
  background-color: var(--fs-text-muted);
}

.text-gray-800 {
  color: #1f2937;
}

/* Alert styles */

.bi {
  display: inline-block;
  vertical-align: -0.125em;
}

.me-2 {
  margin-right: 8px;
}

.d-none {
  display: none;
}

/***************************/

/* Secondary font */
body,
p,
li,
div {
  font-family: "Cabin", sans-serif;
  font-weight: 400; /* Use normal weight for body text */
  line-height: 1.5; /* Adjust line-height for readability */
}

/* Accent font */
.button,
.cta {
  font-family: "Bitter", sans-serif;
  font-weight: 700; /* Use bold for call-to-action elements */
}
