/* ── HOME SCREEN STYLES ── */
.date-strip-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: var(--card-shadow);
}

.date-dropdown {
  display: flex;
  justify-content: flex-start;
}

/* .dropdown-btn styles are in calendar.css */


.date-horizontal {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
}

.scroll-helper {
  font-size: 0.7rem;
  color: var(--text-secondary);
  align-self: flex-end;
}

.days-list {
  display: flex;
  overflow-x: auto;
  gap: 0.35rem;
  scrollbar-width: none;
  scroll-behavior: smooth;
  padding-bottom: 4px;
}

.days-list::-webkit-scrollbar {
  display: none;
}

.day-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.6rem;
  border-radius: 14px;
  cursor: pointer;
  min-width: 52px;
  flex-shrink: 0;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  position: relative;
}

.day-item:hover {
  background-color: var(--accent-teal-bg);
  border-color: var(--accent-teal);
}

.day-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.day-name.special-label {
  font-size: 0.6rem;
  color: var(--accent-teal);
  font-weight: 700;
  text-transform: none;
}

.day-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Today dot indicator */
.today-dot {
  width: 5px;
  height: 5px;
  background-color: var(--accent-teal);
  border-radius: 50%;
  margin-top: 3px;
}

/* Past day (before today) — slightly muted */
.day-item.past-day {
  opacity: 0.55;
}

.day-item.past-day:hover {
  opacity: 1;
}

/* Active (selected) day */
.day-item.active {
  border: 2px solid var(--accent-teal);
  background-color: var(--accent-teal-bg);
}

.day-item.active .day-name {
  color: var(--accent-teal);
}

.day-item.active .day-num {
  color: var(--accent-teal);
}

body.dark .day-item.active {
  background-color: rgba(13, 148, 136, 0.18);
}

body.dark .day-item:hover {
  background-color: rgba(13, 148, 136, 0.12);
}

.overview-header {
  margin-top: 0.5rem;
}

.overview-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
}

.overview-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-icon {
  font-size: 1.2rem;
}

.card-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.card-content-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.metric-val {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.metric-val .sub-val {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.metric-item.highlight .metric-val {
  color: var(--accent-orange);
}

.food-log {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.log-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.log-progress-pill {
  background-color: #e2e8f0;
  color: #475569;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
}

body.dark .log-progress-pill {
  background-color: #334155;
  color: #cbd5e1;
}

.meal-list-ui {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.meal-list-ui li {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
}

.meal-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.meal-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.meal-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-edit, .btn-delete {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.95rem;
  transition: transform 0.2s;
}

.btn-edit:hover, .btn-delete:hover {
  transform: scale(1.15);
}

.meal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.meal-badges .badge {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.meal-progress-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.progress-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-col .label {
  font-size: 0.65rem;
  color: var(--text-secondary);
}

.progress-col .val {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0.15rem 0;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.15rem;
}

.progress-bar .fill {
  height: 100%;
  background-color: var(--accent-teal);
  border-radius: 2px;
}

.progress-col .percent {
  font-size: 0.65rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── AI FOOD CHAT PANEL ── */
.home-ai-chat-panel {
  position: fixed;
  bottom: calc(65px + env(safe-area-inset-bottom, 0px)); /* Lifted above bottom-bar + safe area */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

body.dark .home-ai-chat-panel {
  background: rgba(15, 23, 42, 0.97);
}

/* Scrollable chat message log - HIDDEN as per user request */
.home-chat-log {
  display: none !important;
}

/* Welcome message */
.home-chat-welcome {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent-teal-bg);
  border: 1px solid var(--accent-teal);
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.home-chat-welcome span { font-size: 1.2rem; flex-shrink: 0; }
.home-chat-welcome p    { margin: 0; line-height: 1.4; }

/* Chat bubbles */
.hc-bubble {
  max-width: 88%;
  border-radius: 16px;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.45;
  animation: fadeIn 0.25s ease;
}

.hc-user {
  align-self: flex-end;
  background: var(--accent-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.hc-bot {
  align-self: flex-start;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

/* Image preview in user bubble */
.hc-img-preview {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 10px;
}

/* Typing dots */
.hc-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
}

.hc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: dotBounce 1.2s infinite ease-in-out;
}

.hc-dot:nth-child(2) { animation-delay: 0.2s; }
.hc-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1.1); opacity: 1;   }
}

/* AI result bubble */
.hc-result { padding: 0.7rem 0.9rem; }

.hc-food-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.45rem;
}

.hc-macros-row {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.hc-macro {
  flex: 1;
  background: var(--accent-teal-bg);
  border: 1px solid var(--accent-teal);
  border-radius: 8px;
  padding: 0.35rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hc-macro-val {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--accent-teal);
}

.hc-macro-lbl {
  font-size: 0.62rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 1px;
}

.hc-add-btn {
  width: 100%;
  background: var(--accent-teal);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.hc-add-btn:hover:not(:disabled) { opacity: 0.88; }
.hc-add-btn:disabled { background: var(--text-secondary); cursor: default; }

.hc-note {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0.2rem 0 0;
  text-align: center;
}

.hc-error {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

/* Composer row */
.home-chat-composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--card-bg);
}

.home-chat-input {
  flex: 1;
  background: var(--bg-color);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  border-radius: 9999px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}

.home-chat-input:focus {
  border-color: var(--accent-teal);
}

.home-chat-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Icon action buttons (photo / camera) */
.home-chat-action-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-color);
  border: 1.5px solid var(--border-color);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  text-decoration: none;
}

.home-chat-action-btn:hover {
  background: var(--accent-teal-bg);
  border-color: var(--accent-teal);
}

/* Send button */
.home-chat-send-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-teal);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.home-chat-send-btn:hover {
  opacity: 0.88;
  transform: scale(1.05);
}


/* ── DATE-BROWSING UX ── */

/* Read-only banner shown on past / future dates */
.readonly-date-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  animation: fadeIn 0.3s ease;
}

.readonly-date-banner > span {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.readonly-date-banner div {
  flex: 1;
}

.readonly-date-banner strong {
  display: block;
  font-weight: 700;
  margin-bottom: 0.15rem;
  color: var(--text-primary);
}

.readonly-date-banner p {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin: 0;
}

.past-banner {
  background-color: rgba(100, 116, 139, 0.1);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.future-banner {
  background-color: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

body.dark .past-banner {
  background-color: rgba(100, 116, 139, 0.15);
}

body.dark .future-banner {
  background-color: rgba(99, 102, 241, 0.12);
}

/* "Go to Today" button in banner */
.btn-goto-today {
  background: var(--accent-teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.btn-goto-today:hover {
  opacity: 0.85;
}

/* Empty / no-meals state with icon */
.no-meals.date-info-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 0;
  gap: 0.4rem;
  list-style: none;
  text-align: center;
}

.no-meals.date-info-msg p {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.no-meals.date-info-msg small {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Time badge on meal entries */
.meal-badges .time-badge {
  border-color: var(--accent-teal);
  color: var(--accent-teal);
}

/* Read-only lock icon */
.readonly-lock {
  font-size: 0.9rem;
  opacity: 0.6;
}

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

/* ── MULTI-FOOD RESULT BUBBLE ── */
.hc-multi-result {
  padding: 0.85rem;
  min-width: 280px;
  max-width: 92% !important;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.hc-multi-header {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.4rem;
}

.hc-multi-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.hc-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.5rem;
  background: var(--bg-color);
  border-radius: 8px;
  gap: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.hc-item-row:hover {
  border-color: var(--border-color);
}

.hc-item-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.hc-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-item-qty {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.hc-item-cal {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-teal);
  white-space: nowrap;
}

.hc-item-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.hc-item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  font-size: 0.85rem;
  border-radius: 4px;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}

.hc-item-actions button:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.05);
}

body.dark .hc-item-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hc-multi-total {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.5rem;
}

.hc-total-macros {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.hc-total-macro {
  flex: 1;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.35rem 0.15rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hc-total-macro .hc-tmv {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
}

.hc-total-macro .hc-tml {
  font-size: 0.6rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 1px;
  text-transform: uppercase;
}

.hc-add-all-btn {
  width: 100%;
  background: var(--accent-teal);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(13, 148, 136, 0.2);
}

.hc-add-all-btn:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.hc-add-all-btn:disabled {
  background: var(--border-color);
  color: var(--text-secondary);
  cursor: default;
  box-shadow: none;
  transform: none;
}

/* Inline Edit Panel */
.hc-inline-edit {
  background: var(--bg-color);
  border: 1.5px solid var(--accent-teal);
  border-radius: 10px;
  padding: 0.75rem;
  margin: 0.25rem 0 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  animation: fadeIn 0.2s ease;
}

.hc-edit-fields {
  display: flex;
  gap: 0.5rem;
}

.hc-edit-label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}

.hc-edit-input {
  background: var(--card-bg);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.2rem;
  outline: none;
}

.hc-edit-input:focus {
  border-color: var(--accent-teal);
}

.hc-edit-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: 0.25rem;
  align-self: center;
}

.hc-edit-preview {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-teal);
  background: var(--accent-teal-bg);
  padding: 0.35rem;
  border-radius: 6px;
  text-align: center;
}

.hc-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.hc-edit-actions button {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}

.hc-edit-save {
  background: var(--accent-teal);
  color: #fff;
}

.hc-edit-cancel {
  background: var(--border-color);
  color: var(--text-primary);
}

.hc-edit-actions button:hover {
  opacity: 0.9;
}
