/* ==========================================================================  
   Nutrition Tracker CSS - Enhanced with Sidebar Integration
   ========================================================================== */

/* Body Styles */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-color);
  transition: background 0.3s ease, color 0.3s ease;
}

body.light-mode {
  background: #f8fafc;
  color: #1a202c;
  --dark-bg: #f2f2f2;
  --darker-bg: #ffffff;
  --card-bg: #ffffff;
  --elevated-bg: #ffffff;
  --text-color: #212121;
  --light-text: #515c6f;
  --muted-text: #718096;
}

/* Stat Cards */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px var(--glow);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1.25rem;
}

.stat-icon i {
  color: white;
  font-size: 2rem;
}

.stat-content h3 {
  color: var(--light-text);
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  color: var(--text-color);
}

.stat-value .divider {
  color: var(--light-text);
  margin: 0 0.25rem;
}

/* Two-column layout */
.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Nutrition sections */
.nutrition-section {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
}

.nutrition-section .section-header {
  margin-bottom: 1.5rem;
}

.nutrition-section .section-header h2 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text-color);
}

/* Forms */
.goals-form {
  transition: max-height 0.5s ease;
  overflow: hidden;
  max-height: 1000px;
}

.goals-form.collapsed {
  max-height: 0;
}

.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-group {
  flex: 1;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--light-text);
  font-size: 0.95rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background-color: var(--darker-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

body.light-mode .form-group input,
body.light-mode .form-group select {
  background: #f8fafc;
  color: #1a202c;
  border: 1px solid #ddd;
}
body.light-mode .form-group input:focus,
body.light-mode .form-group select:focus {
  border-color: var(--accent);
}

.quantity-input {
  display: flex;
}

.quantity-input input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.quantity-input select {
  width: auto;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Progress Wheel */
.progress-wheel-container {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-wheel {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg, var(--primary) 0deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 1.5rem;
  transition: all var(--transition-speed) ease;
}

.progress-wheel::before {
  content: '';
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background-color: var(--card-bg);
}

.progress-inner {
  position: relative;
  text-align: center;
  z-index: 1;
}

.progress-percentage {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.progress-label {
  font-size: 0.9rem;
  color: var(--light-text);
}

.progress-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.progress-stats .stat {
  text-align: center;
}

.progress-stats .label {
  font-size: 0.85rem;
  color: var(--light-text);
  margin-bottom: 0.25rem;
  display: block;
}

.progress-stats .value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
}

.meal-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.meal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: none;
  background-color: var(--darker-bg);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
  min-width: 80px;
  border: 2px solid var(--border-color);
  color: var(--text-color);
  text-decoration: none;
}

.meal-btn:hover {
  transform: translateY(-4px);
  background-color: var(--primary-dark);
  border-color: var(--primary);
}

.meal-btn i {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.meal-btn span {
  font-size: 0.85rem;
}

.meal-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
}

.meal-btn.active i,
.meal-btn.active span {
  color: white;
}

body.light-mode .meal-btn.active {
  background: var(--accent);
  color: #181717;
}
body.light-mode .meal-btn.active i,
body.light-mode .meal-btn.active span {
  color: #1d1c1c;
}

/* Food Log Form */
.food-log-form {
  background-color: var(--darker-bg);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.form-header h3 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.search-container {
  display: flex;
  align-items: center;
}

.search-container input {
  padding: 0.5rem 1rem;
  border-radius: 8px 0 0 8px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-right: none;
  color: var(--text-color);
}

.search-container button {
  border-radius: 0 8px 8px 0;
  background-color: var(--primary);
  color: white;
  height: 100%;
  padding: 0.5rem;
  border: 1px solid var(--primary);
}

.search-container button:hover {
  background-color: var(--primary-light);
}

.nutrition-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.preview-item {
  flex: 1;
  min-width: 100px;
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}

.preview-item .value {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
  color: var(--text-color);
}

.preview-item .label {
  font-size: 0.85rem;
  color: var(--light-text);
}

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

/* Food Log Entries */
.food-log-entries {
  margin-top: 2rem;
}

.food-log-meal {
  margin-bottom: 1.5rem;
}

.food-log-meal-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.food-log-meal-header i {
  margin-right: 0.75rem;
  font-size: 1.5rem;
  color: var(--accent);
}

.food-log-meal-header h4 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.food-log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--darker-bg);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  transition: background-color var(--transition-speed) ease;
}

.food-log-entry:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.food-log-entry-name {
  flex: 1;
}

.food-log-entry-name h5 {
  margin: 0 0 0.25rem 0;
  font-size: 1rem;
  color: var(--text-color);
}

.food-log-entry-name p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--light-text);
}

.food-log-entry-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.food-log-entry-info .nutrients {
  display: flex;
  gap: 1rem;
}

.food-log-entry-info .nutrient {
  text-align: center;
  font-size: 0.85rem;
}

.food-log-entry-info .nutrient .value {
  font-weight: 600;
  color: var(--text-color);
}

.food-log-entry-info .nutrient .label {
  color: var(--light-text);
}

.food-log-entry-info .actions {
  display: flex;
  gap: 0.5rem;
}

/* Recipe Section */
.recipe-section .section-header {
  justify-content: flex-start;
  gap: 1rem;
}

.recipe-section .section-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.recipe-section .section-header .section-tabs {
  display: flex;
  gap: 1rem;
  margin-left: 2rem;
}

.section-tab {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background-color: transparent;
  border: none;
  color: var(--light-text);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.section-tab.active {
  background-color: var(--primary);
  color: white;
}

.section-tab:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

.recipe-actions {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.recipe-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background-color: var(--darker-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid var(--border-color);
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px var(--glow);
}

.recipe-image {
  position: relative;
  height: 160px;
  overflow: hidden;
}

.recipe-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recipe-card:hover .recipe-image img {
  transform: scale(1.05);
}

.recipe-tags {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 0.5rem;
}

.recipe-tag {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  background-color: var(--primary);
  color: white;
}

.recipe-ready-time {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.recipe-content {
  padding: 1rem;
}

.recipe-title {
  font-size: 1.1rem;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
  color: var(--text-color);
}

.recipe-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.recipe-meta-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--light-text);
  gap: 0.25rem;
}

.recipe-meta-item i {
  font-size: 1rem;
}

.recipe-description {
  font-size: 0.9rem;
  color: var(--light-text);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.recipe-actions button {
  flex: 1;
  font-size: 0.85rem;
  padding: 0.5rem;
}

/* Meal Plan Section */
.meal-plan-section .meal-plan-container {
  margin-top: 1.5rem;
}

.meal-plan-summary {
  background-color: var(--darker-bg);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.meal-plan-summary p {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  color: var(--text-color);
}

.meal-plan-meals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.meal-plan-item {
  background-color: var(--darker-bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.meal-plan-item-header {
  background-color: var(--primary-dark);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meal-plan-item-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: white;
}

.meal-plan-item-content {
  padding: 1rem;
  display: flex;
  gap: 1rem;
}

.meal-plan-item-content img {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
}

.meal-plan-item-details {
  flex: 1;
}

.meal-plan-item-details h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--text-color);
}

.meal-plan-item-details p {
  margin: 0 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--light-text);
}

/* Product search section */
.product-search-container {
  position: relative;
}

.product-autocomplete {
  position: relative;
  margin-bottom: 1.5rem;
}

.product-autocomplete-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background-color: var(--darker-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1rem;
}

.product-autocomplete-input:focus {
  outline: none;
  border-color: var(--primary);
}

.product-autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background-color: var(--darker-bg);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  z-index: 10;
  display: none;
}

.product-autocomplete-suggestions.active {
  display: block;
}

.product-suggestion {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.product-suggestion:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.product-details {
  display: flex;
  flex-direction: column;
  background-color: var(--darker-bg);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.product-header {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.product-image {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  margin-right: 1.5rem;
}

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

.product-header-info h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  color: var(--text-color);
}

.product-header-info p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--light-text);
}

.product-nutrition {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

.nutrition-item {
  text-align: center;
}

.nutrition-item .value {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
  color: var(--text-color);
}

.nutrition-item .label {
  font-size: 0.85rem;
  color: var(--light-text);
}

.product-ingredients {
  padding: 0 1.5rem 1.5rem;
}

.product-ingredients h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.product-ingredients p {
  font-size: 0.9rem;
  color: var(--light-text);
  line-height: 1.6;
}

/* Recipe Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: modal-in 0.3s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  position: relative;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-color);
}

.close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--light-text);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 2rem;
}

.recipe-content {
  margin-bottom: 2rem;
}

.recipe-content img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.recipe-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.recipe-info p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-color);
}

.recipe-ingredients {
  margin-bottom: 2rem;
}

.recipe-ingredients ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

.recipe-ingredients li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-color);
}

.recipe-ingredients li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.recipe-instructions {
  line-height: 1.8;
}

.recipe-instructions p {
  margin-bottom: 1rem;
  color: var(--text-color);
}

.recipe-instructions ol {
  padding-left: 1.5rem;
}

.recipe-instructions li {
  margin-bottom: 1rem;
  color: var(--text-color);
}

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

/* AI Chatbot */
.ai-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 350px;
  background-color: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
  transform: translateY(calc(100% + 20px));
  transition: transform 0.3s ease;
  border: 1px solid var(--border-color);
}

.ai-chatbot.active {
  transform: translateY(0);
}

.chat-header {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-header button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

.chat-body {
  height: 300px;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  max-width: 80%;
  word-break: break-word;
}

.chat-message.bot {
  background-color: var(--primary-dark);
  align-self: flex-start;
  border-bottom-left-radius: 0;
  color: white;
}

.chat-message.user {
  background-color: var(--accent-dark);
  align-self: flex-end;
  border-bottom-right-radius: 0;
  color: white;
}

body.light-mode .chat-message.bot {
  background: #f2cfff;
  color: #6a1b9a;
}
body.light-mode .chat-message.user {
  background: #ffe0b2;
  color: #ff6f00;
}

.chat-footer {
  display: flex;
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.chat-footer input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px 0 0 8px;
  background-color: var(--darker-bg);
  color: var(--text-color);
}

.chat-footer input:focus {
  outline: none;
}

.chat-footer button {
  background-color: var(--primary);
  color: white;
  border: none;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.chat-footer button:hover {
  background-color: var(--primary-light);
}

/* Chat toggle button */
.chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 999;
  transition: transform 0.3s ease;
  border: none;
}

.chat-toggle:hover {
  transform: scale(1.1);
}

.chat-toggle i {
  font-size: 1.5rem;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--light-text);
}

.empty-state i {
  font-size: 4rem;
  color: var(--muted-text);
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.empty-state p {
  color: var(--light-text);
}

body.light-mode .empty-state {
  color: #b0b0b0;
}
body.light-mode .empty-state i {
  color: var(--primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--darker-bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent), var(--primary));
}

body.light-mode ::-webkit-scrollbar-track {
  background: #f8fafc;
}
body.light-mode ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6a1b9a, #ff6f00);
}
body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff6f00, #6a1b9a);
}

/* Override styles for light mode */
body.light-mode .stat-card,
body.light-mode .nutrition-section,
body.light-mode .food-log-form,
body.light-mode .preview-item,
body.light-mode .meal-btn,
body.light-mode .food-log-entry,
body.light-mode .product-search-container,
body.light-mode .modal-content,
body.light-mode .header,
body.light-mode .dashboard-footer {
  background: var(--card-bg) !important;
  color: var(--text-color) !important;
  border-color: #eee !important;
  box-shadow: 0 2px 12px rgba(106, 27, 154, 0.06);
}

body.light-mode .stat-icon {
  background: linear-gradient(135deg, #f2cfff, #ffe0b2);
  color: var(--primary);
}

body.light-mode .section-header h1,
body.light-mode .section-header h2 {
  color: var(--accent);
}

body.light-mode .form-group label,
body.light-mode .progress-label,
body.light-mode .label {
  color: var(--light-text);
}

body.light-mode .header .logo span,
body.light-mode .dashboard-footer .footer-left,
body.light-mode .dashboard-footer .footer-right a {
  color: #6a1b9a !important;
}

body.light-mode .header .logo span {
  font-weight: 700;
}

body.light-mode .nav.desktop-nav a,
body.light-mode .sidebar-nav-link,
body.light-mode .sidebar-title {
  color: #6a1b9a !important;
  background: none !important;
}

body.light-mode .nav.desktop-nav a.active,
body.light-mode .nav.desktop-nav a:hover {
  background: #ffe0b2 !important;
  color: #ff6f00 !important;
}

body.light-mode .sidebar {
  background: #fff !important;
  border-right: 1px solid #eee !important;
}

body.light-mode .sidebar-nav-link.active,
body.light-mode .sidebar-nav-link:hover {
  background: #ffe0b2 !important;
  color: #ff6f00 !important;
}

body.light-mode .sidebar-nav-badge,
body.light-mode .water-badge {
  background: #ff6f00 !important;
  color: #fff !important;
}

body.light-mode .sidebar-section {
  border-bottom: 1px solid #eee !important;
}

body.light-mode .sidebar-title {
  color: #6a1b9a !important;
}

body.light-mode .user-profile,
body.light-mode .avatar {
  background: #f2cfff !important;
  color: #6a1b9a !important;
}

body.light-mode .user-dropdown {
  background: #fff !important;
  color: #1a202c !important;
  box-shadow: 0 4px 16px rgba(106, 27, 154, 0.08);
}
body.light-mode .user-dropdown a {
  color: #1a202c !important;
}
body.light-mode .user-dropdown a:hover {
  background: #ffe0b2 !important;
  color: #ff6f00 !important;
}

body.light-mode .dropdown-divider {
  border-top: 1px solid #eee !important;
}

/* Light mode: Make theme toggler and sidebar menu icons black for visibility */
body.light-mode .theme-toggle .material-icons,
body.light-mode .sidebar-toggle .material-icons,
body.light-mode .sidebar-nav-link .material-icons,
body.light-mode .sidebar-title .material-icons,
body.light-mode .header-right .material-icons,
body.light-mode .dropdown-arrow.material-icons {
  color: #222 !important;
}

/* Also ensure nav and header icons are black in light mode */
body.light-mode .nav.desktop-nav .material-icons {
  color: #222 !important;
}

/* Responsive Design: Auto-fit for all screen sizes */
@media (max-width: 1200px) {
  .two-column {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .sidebar {
    width: 220px;
  }
}

@media (max-width: 900px) {
  .two-column {
    grid-template-columns: 1fr;
  }
  .stat-cards {
    grid-template-columns: 1fr 1fr;
  }
  .nutrition-section, .modal-content, .food-log-form, .product-search-container {
    padding: 1rem !important;
  }
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }
  .chat-header, .chat-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .chat-footer input {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 600px) {
  .stat-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .main-content, .nutrition-section, .stat-card, .food-log-form, .product-search-container, .modal-content {
    padding: 0.5rem !important;
  }
  .section-header h1, .section-header h2 {
    font-size: 1rem;
  }
  .form-group input, .form-group select {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
  }
  .meal-btn, .btn, .btn-primary, .btn-secondary {
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
  }
  .food-log-entries, .food-log-container {
    padding: 0.25rem;
  }
  .chat-body {
    max-height: 200px;
    font-size: 0.95rem;
  }
  .modal-content {
    width: 98vw;
    min-width: unset;
    max-width: 100vw;
  }
  .product-autocomplete-input {
    font-size: 0.95rem;
  }
  .footer-content {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .header, .main-content, .sidebar, .dashboard-footer, .nutrition-section, .modal-content {
    padding: 0.1rem !important;
  }
  .section-header h1, .section-header h2 {
    font-size: 0.85rem;
  }
  .btn, .btn-primary, .btn-secondary {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
  }
  .form-group input, .form-group select {
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
  }
}