.calendar-days div[style*="font-weight: bold"], .calendar-days .calendar-weekday {
  color: var(--color-primary);
  font-weight: bold;
  background: transparent !important;
}
.calendar-day.selected {
  background: var(--color-primary) !important;
  color: #fff;
}
body.dark-mode .calendar-day.selected {
  background: var(--color-primary) !important;
  color: #fff;
  border: none;
}
/* Calendar Modal Overlay and Window Styling */
.calendar-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  backdrop-filter: blur(5px);
}
.calendar-modal-overlay.active {
  display: flex;
}
.calendar-modal {
  background: var(--color-surface);
  padding-top: 32px;
  padding-bottom: 32px;
  border-radius: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 10px 20px rgba(0, 0, 0, 0.1);
  max-width: 420px;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
  color: var(--color-text);
}

@media (min-width: 300px) {
  .calendar-modal {
    padding-left: 0;
    padding-right: 0;
    max-height: none;
    max-width: 340px;
    width: 100%;
  }

  .calendar-days .calendar-weekday {
    margin-left: 0;
  }
}

@media (min-width: 360px) {
  .calendar-modal {
    padding-left: 16px;
    padding-right: 16px;
    max-height: none;
    max-width: 340px;
    width: 100%;
  }

  .calendar-days .calendar-weekday {
    margin-left: 8px;
  }
}

@media (min-width: 385px) {
  .calendar-modal {
    padding-left: 32px;
    padding-right: 32px;
    max-height: none;
    max-width: 340px;
    width: 100%;
  }

  .calendar-days .calendar-weekday {
    margin-left: 8px;
  }
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-arrow {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: var(--color-primary);
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
}

.calendar-arrow img {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 1;
  transition: opacity 0.2s;
}

#next-month img {
  transform: scaleX(-1);
}

.calendar-close {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #888;
  margin-left: 8px;
}
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}
.calendar-day {
  padding: 8px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-weight: 500;
}
.calendar-day:hover {
  background: var(--color-primary) !important;
  color: #fff;
}
.calendar-day.selected {
  background: var(--color-primary);
  color: #fff;
}
.calendar-day.inactive {
  color: #bbb;
  background: var(--color-surface);
}
body.dark-mode .calendar-modal {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 20px 40px rgba(0,0,0,0.7), 0 10px 20px rgba(0,0,0,0.4);
  border: 1px solid #333;
}
body.dark-mode .calendar-day {
  background: #23272a;
  color: var(--color-text);
}
body.dark-mode .calendar-day.inactive {
  background: #181a1b;
  color: #555;
}

/* Remove white row borders in profile popup menu for dark mode */
body.dark-mode .profile-popup th,
body.dark-mode .profile-popup td {
    border-bottom: 1px solid #333 !important;
}
/* Dark mode: macronutrient tiles in food details window */
body.dark-mode .food-details-content .macro-item {
    background: #23272a !important;
    color: var(--color-text);
}

body.dark-mode .food-details-content .macro-value {
    color: var(--color-text) !important;
}

body.dark-mode .food-details-content .macro-label {
    color: #aaa !important;
}
/* Brighter blue for food details headings in dark mode */
body.dark-mode .food-details-content h2,
body.dark-mode .food-details-content h3,
body.dark-mode .food-details-content .food-details-name {
    color: #4285f4 !important;
}
/* Dark mode for modals and popups */
body.dark-mode .modal-content,
body.dark-mode #setupModal .modal-content {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 20px 40px rgba(0,0,0,0.7), 0 10px 20px rgba(0,0,0,0.4);
    border: 1px solid #333;
}

body.dark-mode .food-details-content,
body.dark-mode .modal-content.food-details-content {
    background: #23272a;
    color: var(--color-text);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.2);
    border: 0px solid #444;
}

body.dark-mode .modal-content label,
body.dark-mode .modal-content input,
body.dark-mode .modal-content select,
body.dark-mode .modal-content button,
body.dark-mode .modal-content h2,
body.dark-mode .modal-content span,
body.dark-mode .modal-content .close-btn {
    color: var(--color-text);
    background: transparent;
}

body.dark-mode .modal-content input,
body.dark-mode .modal-content select {
    background: #23272a;
    border: 1px solid #444;
    color: var(--color-text);
}

body.dark-mode .modal-content button {
    background: var(--color-primary);
    color: #fff;
}

body.dark-mode .modal-content .close-btn {
    color: var(--color-text);
}

/* Profile details page dark mode */
body.dark-mode .profile-page-container,
body.dark-mode .profile-card,
body.dark-mode .profile-details-grid,
body.dark-mode .profile-avatar-large,
body.dark-mode .profile-info-section {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: #333;
}
:root {
    --color-bg: #f5f6fa;
    --color-surface: #fff;
    --color-surface-alt: #f1f3f4;
    --color-primary: #4285f4;
    --color-accent: #34a853;
    --color-fat: #fbbc04;
    --color-carb: #ff7043;
    --color-text: #222;
    --color-text-secondary: #757575;
    --color-muted: #757575;
    --color-border: #e8eaed;
    --bar-height: 18px;
    --bar-radius: 9px;
    --shadow: 0 2px 8px rgba(60, 64, 67, 0.08), 0 1.5px 4px rgba(60, 64, 67, 0.08);
    --icon-filter: brightness(0) saturate(100%) invert(47%) sepia(6%) saturate(446%) hue-rotate(200deg) brightness(99%) contrast(86%);
}

body.dark-mode {
    --color-bg: #181a1b;
    --color-surface: #23272a;
    --color-surface-alt: #22262a;
    --color-primary: #4285f4;
    --color-accent: #57e690;
    --color-fat: #ffd166;
    --color-carb: #ff9776;
    --color-text: #f1f1f1;
    --color-text-secondary: #b0b0b0;
    --color-muted: #b0b0b0;
    --color-border: #333;
    --icon-filter: brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

body.dark-mode {
    background: var(--color-bg);
    color: var(--color-text);
}

body.dark-mode .profile-popup {
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
    border: 1px solid #333;
}

body.dark-mode .profile-menu-btn, body.dark-mode .sign-out-btn {
    color: var(--color-text);
}

body.dark-mode .profile-menu-btn:hover, body.dark-mode .sign-out-btn:hover {
    background: #23272a;
}

body {
    margin: 0;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    /* Ensure no conflicting positioning */
    position: relative;
}

header {
    margin-top: 0;
    margin-bottom: 32px;
    position: relative; /* Ensure it doesn't create stacking context issues */
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--color-primary);
}

#calendarBar {
    position: static; /* Changed from sticky */
    z-index: 1000;
    background: var(--color-surface);
    box-shadow: 0 2px 8px rgba(60, 64, 67, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 24px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 80px;
    margin-bottom: 32px;
    /* Add backdrop for better visibility */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(224, 224, 224, 0.3);
}

body.dark-mode #calendarBar {
    border-bottom: 1px solid #222;
}

#calendarBar>button {
    font-size: 22px;
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#nextDayBtn img {
    transform: scaleX(-1);
}

#calendarBar>span#currentDate {
    flex: 0 1 auto;
    min-width: 180px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1em;
    color: var(--color-primary);
    letter-spacing: 0.5px;
}

/* Progress bars wrapper for two-column layout on desktop */
.progress-bars-wrapper {
    display: block;
    max-width: 1029px;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 1030px) {
    .progress-bars-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        max-width: none;
        width: 98%;
    }
}

@media (max-width: 1029px) {
    .modal-content {
        width: 100%;
    }
}

.progress-column-left,
.progress-column-right {
    display: flex;
    flex-direction: column;
}

/* Hide right column on mobile */
@media (max-width: 1029px) {
    .progress-column-right {
        display: none;
    }
}

/* Hide mobile fiber on desktop */
@media (min-width: 1030px) {
    .progress-container.mobile-fiber {
        display: none;
    }
}

.progress-container {
    background: var(--color-surface);
    box-shadow: var(--shadow);
    border-radius: 14px;
    padding: 18px 20px 12px 20px;
    margin-bottom: 18px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.progress-bar {
    height: var(--bar-height);
    background: var(--color-surface-alt);
    border-radius: var(--bar-radius);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    transition: width 0.4s cubic-bezier(.4, 0, .2, 1);
    border-radius: var(--bar-radius);
}

.protein-fill {
    background: var(--color-primary);
}

.fat-fill {
    background: var(--color-fat);
}

.carb-fill {
    background: var(--color-carb);
}

.fiber-fill {
    background: #1BB01A;
}

.water-fill {
    background: #2196F3;
}

.sugar-fill {
    background: #E91E63;
}

.caffeine-fill {
    background: #795548;
}

#caloriesProgress {
    background: #ea4335;
}

#addFoodBtn,
#setupBtn {
    width: 48px !important;
    height: 48px !important;
    font-size: 24px !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-shadow: 0 4px 16px rgba(66, 133, 244, 0.18);
    background: #4285f4;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

@media (max-width: 600px) {

    #addFoodBtn,
    #setupBtn {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
        margin: 0 !important;
    }
}

/* Make the button row tight */
.button-row {
    display: none; /* Always hidden - button is now in bottom dock */
}

@media (max-width: 600px) {
    #addFoodBtn,
    #setupBtn {
        width: 48px !important;
        height: 48px !important;
        font-size: 24px !important;
        margin: 0 !important;
    }
}

/* Mobile Bottom Dock */
.mobile-bottom-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    display: none; /* Hidden by default */
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1029px) {
    .mobile-bottom-dock {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
    
    /* Add bottom padding to body to account for fixed dock */
    body {
        padding-bottom: max(80px, calc(80px + env(safe-area-inset-bottom)));
    }
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 60px;
    flex: 1 1 0;
    max-width: 80px;
    height: 60px;
    margin-bottom: 18px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    overflow: visible;
}

@media (min-width: 1030px) {
    .dock-item {
        margin-bottom: 10px;
    }
    .mobile-bottom-dock {
        padding: 8px;
        left: 50%;
        transform: translateX(-50%);
        max-width: 500px;
        border-radius: 60px;
        bottom: 20px;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }
}

.dock-item:hover,
.dock-item:focus {
    color: var(--color-primary);
    outline: none;
}

.dock-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    filter: var(--icon-filter);
}

.dock-item:hover .dock-icon,
.dock-item:focus .dock-icon {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

.dock-item:active .dock-icon {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

/* Plus button should keep its original colors */
.dock-plus {
    /* Ensure plus button container takes same space as other dock items */
    flex: 1 1 0;
    min-width: 60px;
    max-width: 80px;
}

.dock-plus .dock-icon {
    filter: none;
    transform: scale(1.8);
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.dock-plus:hover .dock-icon,
.dock-plus:focus .dock-icon {
    filter: none;
}

.dock-label {
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Dark mode adjustments for dock */
body.dark-mode .mobile-bottom-dock {
    background: var(--color-surface);
    border-top-color: var(--color-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

/* Active dock item */
.dock-item.active {
    color: var(--color-primary);
}

.dock-item.active .dock-icon {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

/* Greyed out dock (for secondary pages) */
.mobile-bottom-dock.greyed-out .dock-item {
    color: var(--color-muted);
    opacity: 0.6;
}

.mobile-bottom-dock.greyed-out .dock-icon {
    filter: var(--icon-filter);
    opacity: 0.5;
}

/* Home button styling - same size as other icons but with extra padding to match plus button space */
/* Home button styling - same as other dock icons */
.dock-home .dock-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    filter: var(--icon-filter);
}

.dock-home:hover .dock-icon,
.dock-home:focus .dock-icon {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

.dock-home:active .dock-icon {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

.dock-home .dock-label {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.dock-home:hover .dock-label,
.dock-home:focus .dock-label {
    color: var(--color-primary);
}

/* Fix dock alignment on small screens */
@media (max-width: 480px) {
    .mobile-bottom-dock {
        justify-content: space-evenly;
        padding: 8px 4px max(8px, env(safe-area-inset-bottom));
    }
    
    .dock-item {
        flex: 0 0 auto;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }
    
    .dock-plus {
        flex: 0 0 auto;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }
    
    .dock-home {
        flex: 0 0 auto;
        width: 60px;
        min-width: 60px;
        max-width: 60px;
    }
}

#foodList {
    list-style: none;
    padding: 0;
    margin: 0 auto 32px auto;
    max-width: 420px;
}

#foodList li {
    background: var(--color-surface);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--color-primary);
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.04em;
    gap: 12px;
}

#foodList li span:first-child {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

#foodList li span:last-child {
    flex: 0 0 auto;
    margin-left: 16px;
    font-weight: 500;
    color: var(--color-muted);
    text-align: right;
    width: 70px;
    /* Fixed width for weight */
}

#foodList li button {
    background: none;
    border: none;
    color: #ea4335;
    font-size: 22px;
    cursor: pointer;
    margin-left: 10px;
    border-radius: 50%;
    transition: background 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#foodList li button:hover {
    background: var(--color-surface-alt);
}

/* Nutrients table container for two-column layout */
.nutrients-table-container {
    width: 100%;
    max-width: 1028px;
    margin: 0 auto 32px auto;
}

.nutrients-column-left,
.nutrients-column-right {
    flex-direction: column;
    gap: 16px;
}

/* On mobile, hide the right column */
@media (max-width: 1028px) {
    .nutrients-table-container {
        display: block;
    }
    
    .nutrients-column-right {
        display: none;
    }
}

@media (min-width: 1029px) {
    .nutrients-table-container {
        max-width: 3840px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        align-items: start;
        margin-bottom: 120px; /* Add extra bottom margin to account for bottom dock */
        width: 98%;
    }
    .nutrients-column-left,
    .nutrients-column-right {
        display: flex;
        flex-direction: column;
        gap: 16px;
    }
}

#foodList {
    width: 98% !important;
}

/* Individual nutrient category tables */
.nutrient-category-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    table-layout: fixed;
}

/* Set consistent column widths for all nutrient tables */
.nutrient-category-table th:first-child,
.nutrient-category-table td:first-child {
    width: 50%;
    text-align: left;
}

.nutrient-category-table th:nth-child(2),
.nutrient-category-table td:nth-child(2) {
    width: 30%;
    text-align: right;
}

.nutrient-category-table th:nth-child(3),
.nutrient-category-table td:nth-child(3) {
    width: 20%;
    text-align: right;
}

/* Nutrient info icon styling */
.nutrient-info-icon {
    opacity: 0.6;
    filter: brightness(0) saturate(100%) invert(47%) sepia(6%) saturate(446%) hue-rotate(200deg) brightness(99%) contrast(86%);
}

.nutrient-info-icon:hover {
    opacity: 1;
}

body.dark-mode .nutrient-info-icon {
    filter: brightness(0) saturate(100%) invert(70%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

/* Legacy table styling for backward compatibility */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

@media (min-width: 1029px) {
    table {
        margin-bottom: 0;
    }
}

th,
td {
    padding: 12px 10px;
    text-align: right;
    /* border-bottom: 1px solid #e0e0e0; */
    font-size: 15px;
}

td:first-child,
th:first-child {
    text-align: left;
}

th {
    background: var(--color-surface-alt);
    color: var(--color-primary);
    text-align: left;
    font-weight: 700;
}

caption {
    font-weight: 700;
    text-align: left;
    padding: 12px 0 8px 0;
    color: var(--color-primary);
    font-size: 1.1em;
}

tr[style*="color"] td:first-child {
    color: inherit;
}

/* Modal styling */
#addFoodModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

#addFoodModal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(180deg, #f5f6fa, #ffffff) !important;
    padding: 32px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 10px 20px rgba(0, 0, 0, 0.1);
    width: 92%;
    max-width: 540px;
    position: relative;
    /* animation: modalSlideIn 0.4s ease-out; */
    max-height: 90vh;
    overflow-y: auto;
    max-width: 855px;
    box-sizing: border-box;
    overflow-x: hidden;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Small loading spinner for search suggestions */
.search-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid currentColor;
    border-top: 1px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0.5;
    margin-right: 8px;
    vertical-align: middle;
}

.modal-content h2 {
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-top: 0;
    padding-bottom: 12px;
}

/* Modal inner content container */
.modal-inner-content {
    padding: 30px;
    text-align: left;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
    color: #2c3e50;
    font-weight: 600;
    text-align: left;
    font-size: 15px;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    background-color: #f8f9fa;
    box-sizing: border-box;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    color: var(--color-text);
    outline: none;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

.modal-content input:focus,
.modal-content select:focus {
    border-color: #4285f4;
    background-color: white;
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
    transform: translateY(-1px);
}

.modal-content input::placeholder {
    color: #94a3b8;
    font-style: normal;
    font-weight: 400;
}

.modal-content button {
    background: #4285f4;
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 12px;
    margin-top: 24px;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    letter-spacing: 0.5px;
}

/* Quick Action Buttons Container */
.modal-quick-actions {
    display: none;
    flex-direction: row;
    justify-content: space-around;
    gap: 12px;
    padding-top: 24px;
}

.modal-quick-actions-row2 {
    padding-top: 8px;
}

#quickActionSuggestion {
    display: none !important;
}

@media (max-width: 1029px) {
    .modal-quick-actions {
        display: flex;
    }
    
    #quickActionSuggestion {
        display: block !important;
    }
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none !important;
    color: var(--color-text-secondary) !important;
    border: none !important;
    padding: 8px !important;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 80px;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.quick-action-btn:hover,
.quick-action-btn:focus {
    color: var(--color-primary) !important;
    outline: none;
}

.quick-action-btn img {
    width: 28px;
    height: 28px;
    margin-bottom: 6px;
    filter: var(--icon-filter);
    transition: filter 0.2s ease;
}

.quick-action-btn:hover img,
.quick-action-btn:focus img {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

.quick-action-btn:active img {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

.quick-action-btn span {
    text-align: center;
    line-height: 1.2;
    font-size: 11px;
    font-weight: 400;
}

/* Active state for AI Parse button when switched on */
.quick-action-btn.active {
    color: var(--color-primary) !important;
}

.quick-action-btn.active img {
    filter: brightness(0) saturate(100%) invert(40%) sepia(93%) saturate(1352%) hue-rotate(210deg) brightness(119%) contrast(119%);
}

/* AI Food Search button icon styling */
#modalAIDescribeBtn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

#modalAIDescribeBtn img {
    width: 22px !important;
    height: 22px !important;
    filter: brightness(0) invert(1) !important;
    margin-right: 0 !important;
}

/* Dark mode for quick action buttons */
body.dark-mode .quick-action-btn {
    color: var(--color-text-secondary) !important;
}

body.dark-mode .quick-action-btn:hover,
body.dark-mode .quick-action-btn:focus {
    color: var(--color-primary) !important;
}

body.dark-mode .quick-action-btn img {
    filter: brightness(0) invert(1);
}

.modal-content .close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 32px;
    font-weight: bold;
    color: #6d6d6d;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    background: none;
    border: none;
    padding: 4px;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content .close-btn:hover {
    color: #ff4757;
}

.modal-content .sun-btn {
    position: absolute;
    top: 38px;
    left: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1001;
    background: none !important;
    border: none;
    padding: 0;
    line-height: 1;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    margin: 0;
    border-radius: 0;
}

.modal-content .sun-btn:focus {
    outline: none;
    box-shadow: none;
    background: none !important;
}

.modal-content .sun-btn img {
    width: 24px;
    height: 24px;
    margin-left: 10px;
    transition: opacity 0.3s ease;
    filter: brightness(0) saturate(100%) invert(42%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(85%);
}

.modal-content .sun-btn:hover img {
    opacity: 1;
}

body.dark-mode .modal-content .sun-btn img {
    filter: none;
    opacity: 0.7;
}

body.dark-mode .modal-content .sun-btn:hover img {
    opacity: 1;
}

/* Modal inner content container - removed duplicate styles */

#suggestions {
    background: #f8f9fa;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.12);
}
/* Dark mode for food suggestions dropdown */
body.dark-mode #suggestions {
    background: var(--color-surface);
    border: 2px solid #333;
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}

body.dark-mode #suggestions div {
    color: var(--color-text);
    background: transparent;
}

body.dark-mode #suggestions div:last-child {
    border-bottom: none;
}

body.dark-mode #suggestions div:hover,
body.dark-mode #suggestions div:focus {
    background: #2a2d30;
    color: var(--color-text);
}

body.dark-mode #suggestions div[style*="italic"] {
    background: linear-gradient(135deg, rgba(138,180,248,0.05) 0%, rgba(156, 163, 175, 0.05) 100%) !important;
    color: #b0b0b0 !important;
}

#suggestions div {
    padding: 8px 20px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    color: var(--color-text);
    font-weight: 500;
    background: transparent;
}

#suggestions div:last-child {
    border-bottom: none;
}

#suggestions div:hover,
#suggestions div:focus {
    background: var(--color-surface-alt);
}

/* Enhanced loading and error states for suggestions */
#suggestions div[style*="italic"] {
    text-align: center;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.05) 0%, rgba(156, 163, 175, 0.05) 100%) !important;
    color: #6b7280 !important;
    cursor: default;
    border-bottom: none;
    font-style: italic;
    padding: 20px;
    border-radius: 8px;
    margin: 8px;
}

#suggestions div[style*="italic"]:hover {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.05) 0%, rgba(156, 163, 175, 0.05) 100%) !important;
    color: #6b7280 !important;
    transform: none;
}

/* Loading animation for suggestions */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

#suggestions div[style*="Searching"] {
    animation: pulse 2s infinite;
}

#mealTabs {
    display: flex;
    justify-content: center;
    gap: 8px; /* Reduced from 14px */
    margin: 0 auto 24px auto;
    max-width: 420px;
    padding: 0 16px; /* Add horizontal padding to create space from edges */
    box-sizing: border-box;
    width: 100%;
}

.meal-tab {
    background: var(--color-surface);
    color: var(--color-primary);
    border: none;
    padding: 10px 16px; /* Reduced horizontal padding from 28px to 16px */
    border-radius: 24px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(60, 64, 67, 0.06);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    outline: none;
    letter-spacing: 0.5px;
    margin-bottom: 0;
    margin-top: 0;
    position: relative;
    min-width: 0; /* Allow shrinking below content size */
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 244px;
}

/* Ensure the existing active and hover states still work */
.meal-tab.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.10);
    z-index: 1;
}

.meal-tab:hover,
.meal-tab:focus {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.meal-tab.active:hover,
.meal-tab.active:focus {
    background: var(--color-primary);
    color: #fff;
}

::-webkit-scrollbar {
    width: 8px;
    background: #f1f3f4;
}

::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 4px;
}

#modalFoodName {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    margin-bottom: 20px;
}

/* When suggestions are visible, adjust the food name input */
#modalFoodName.has-suggestions {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    margin-bottom: 0;
}

#suggestions {
    border-top: none;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    margin-top: 0;
    margin-bottom: 20px;
    position: relative;
    top: -28px;
    z-index: 10;
}

#modalFoodWeight,
#modalFoodUnit {
    margin-bottom: 20px !important;
    height: auto;
    font-size: 16px;
    padding: 16px 20px;
    box-sizing: border-box;
}

#modalFoodWeight {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

#modalFoodUnit {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

.weight-row {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
}

.weight-row>input,
.weight-row>select {
    flex: 1;
    margin-bottom: 0 !important;
}

.top-right-buttons {
    position: absolute; /* Changed back from fixed */
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2000; /* Higher than calendar bar */
}

.cloud-sync-status {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    cursor: help;
    transition: all 0.2s ease;
}

/* Dark mode for cloud sync status indicator */
body.dark-mode .cloud-sync-status {
    background: #23272a;
    border: 1px solid #333;
    color: var(--color-text);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.cloud-sync-status:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

#profileBtn {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
    padding: 0;
    position: relative; /* Add this for fallback positioning */
}

#profileBtn:hover {
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.18);
    border-color: var(--color-primary);
}

#profileImage {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Fallback when image fails to load */
#profileBtn.no-image {
    background: var(--color-primary);
    color: white;
    font-size: 18px;
    font-weight: 600;
}

#profileBtn.no-image #profileImage {
    display: none;
}

#setupBtn,
#menuBtn,
#installBtn {
    position: static;
    background: #4285f4;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s;
}

#setupBtn:hover,
#menuBtn:hover,
#installBtn:hover {
    background: #3367d6;
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.18);
}

#installIcon,
#menuIcon {
    width: 24px;
    height: 24px;
}

/* Invert the settings icon to make it white on blue background */
#setupIcon {
    filter: invert(1) brightness(100%);
}

/* Dark mode styles for top-right buttons */
body.dark-mode #setupBtn,
body.dark-mode #menuBtn,
body.dark-mode #installBtn {
    background: var(--color-primary);
    color: #fff;
    border: 1px solid #333;
}

body.dark-mode #setupBtn:hover,
body.dark-mode #menuBtn:hover,
body.dark-mode #installBtn:hover {
    background: #3367d6;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@media (max-width: 1029px) {
    .top-right-buttons {
        position: absolute; /* Keep as absolute on mobile too */
        top: 16px;
        right: 8px;
        gap: 6px;
    }
    
    #calendarBar {
        padding: 8px 4px;
        gap: 8px;
        margin-top: 72px;
        z-index: 1000;
        width: 100%;
    }
}

/* Prevent horizontal scroll on all elements */
html,
body {
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Ensure all major containers don't overflow */
#calendarBar,
header,
.progress-container,
#foodList,
table,
#mealTabs,
.setup-content {
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Mobile-specific adjustments */
@media (max-width: 1029px) {
    #mealTabs {
        gap: 6px; /* Further reduced gap for mobile */
        padding: 0 12px; /* Reduced padding for mobile */
        max-width: 100vw;
        margin-left: 0;
        margin-right: 0;
    }

    .meal-tab {
        padding: 10px 8px; /* Further reduced horizontal padding for mobile */
        font-size: 14px; /* Slightly smaller font on mobile */
        min-width: 70px; /* Set minimum width to ensure readability */
        max-width: none; /* Remove max-width constraint */
        flex: 1; /* Equal distribution */
    }

    .progress-container {
        max-width: 98vw;
        padding-left: 2vw;
        padding-right: 2vw;
    }

    table {
        max-width: 98vw;
        margin-left: 1vw;
        margin-right: 1vw;
    }

    .modal-content,
    .setup-content {
        max-width: 100vw;
        width: 100vw;
        margin-bottom: -28px;
        border-radius: 0;
        height: 105%;
        max-height: none;
        padding-left: 2vw;
        padding-right: 2vw;
    }
}

@media (max-width: 1029px) {
    .meal-tab {
        padding: 10px 8px; /* Further reduced horizontal padding for mobile */
        font-size: 14px; /* Slightly smaller font on mobile */
        min-width: 70px; /* Set minimum width to ensure readability */
        max-width: none; /* Remove max-width constraint */
        flex: 1; /* Equal distribution */
    }
}

@media (max-width: 400px) {
    #mealTabs {
        gap: 4px;
        padding: 0 8px;
    }
    
    .meal-tab {
        padding: 8px 6px;
        font-size: 13px;
        min-width: 60px;
        border-radius: 20px; /* Slightly smaller border radius for compact look */
    }
}

@media (max-width: 375px) {
    #mealTabs {
        gap: 3px;
        padding: 0 6px;
    }
    
    .meal-tab {
        padding: 8px 4px;
        font-size: 12px;
        min-width: 55px;
        letter-spacing: 0.3px;
    }
}

/* Remove extra padding/margin that could cause overflow */
body {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#setupModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

#setupModal.active {
    display: flex;
}

/* Also update other modals to have consistent high z-index */
#addFoodModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

#addFoodModal.active {
    display: flex;
}

#foodDetailsModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(60, 64, 67, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000; /* Increased from 2000 to match others */
    padding: 20px;
    box-sizing: border-box;
}

/* Hide scrollbars everywhere */
html, body, * {
  scrollbar-width: none;         /* Firefox */
  -ms-overflow-style: none;      /* IE and Edge */
}
html::-webkit-scrollbar, 
body::-webkit-scrollbar, 
*::-webkit-scrollbar {
  display: none;                 /* Chrome, Safari, Opera */
}

/* Prevent background scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    height: 100vh;
}

.profile-popup {
    position: absolute;
    top: 56px; /* Position below the profile button */
    right: 0px; /* Move a little to the left */
    background: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(60, 64, 67, 0.15);
    border: 1px solid #e0e0e0;
    min-width: 160px;
    z-index: 1000;
    overflow: hidden;
}

.profile-menu-btn, .sign-out-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    box-sizing: border-box;
    border-radius: 0;
}

.profile-menu-btn:hover, .sign-out-btn:hover {
    background: var(--color-surface-alt);
}

.profile-menu-btn {
    border-bottom: 1px solid #e0e0e0;
}

/* Remove extra margin/padding from sign-out button to match menu */
.sign-out-btn {
    margin: 0;
    padding: 12px 16px;
    border-top: none;
    border-bottom: none;
    border-radius: 0;
}

.food-details-content {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.food-details-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
}

.food-details-name {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.food-details-weight {
    font-size: 1.1em;
    color: var(--color-muted);
    font-weight: 500;
}

.nutrition-section {
    margin-bottom: 24px;
}

.nutrition-section h3 {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-surface-alt);
}

body.dark-mode .nutrition-section h3 {
    border-bottom: 1px solid #4285f4;
}

.macro-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.macro-item {
    background: var(--color-surface-alt);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.macro-value {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--color-text);
}

.macro-label {
    font-size: 0.9em;
    color: var(--color-muted);
    margin-top: 2px;
}

.micro-list {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px 16px;
    align-items: center;
}

.micro-name {
    font-weight: 500;
    color: var(--color-text);
}

.micro-value {
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
}

.micro-percent {
    font-weight: 600;
    text-align: right;
    min-width: 50px;
}

.micro-percent.good {
    color: #4caf50;
}

.micro-percent.moderate {
    color: #ff9800;
}

.micro-percent.low {
    color: var(--color-muted);
}

.micro-percent.bad {
    color: #f44336;
}

/* Food Details Modal */
#foodDetailsModal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(5px);
}

#foodDetailsModal.active {
    display: flex;
}

.food-details-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* animation: modalSlideIn 0.4s ease-out; */
}

.food-details-header {
    text-align: center;
    padding: 30px 30px 20px 30px;
    flex-shrink: 0;
}

.food-details-name {
    font-size: 1.4em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.food-details-weight {
    font-size: 1.1em;
    color: #757575;
    font-weight: 500;
}

#foodDetailsContent {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    padding-top: 0;
}

.nutrition-section {
    margin-bottom: 24px;
    margin-top: 24px;
}

.nutrition-section:first-child {
    margin-top: 24px;
}

.nutrition-section h3 {
    font-size: 1.1em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2c3e50;
}

.macro-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.macro-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.macro-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
}

.macro-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 2px;
}

.micro-list {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px 16px;
    align-items: center;
}

.micro-name {
    font-weight: 500;
    color: var(--color-text);
}

.micro-value {
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
}

.micro-percent {
    font-weight: 600;
    text-align: right;
    min-width: 50px;
}

.micro-percent.good {
    color: #4caf50;
}

.micro-percent.moderate {
    color: #ff9800;
}

.micro-percent.low {
    color: var(--color-muted);
}

.micro-percent.bad {
    color: #f44336;
}

/* Close button for food details modal */
.food-details-content .close-btn {
    position: absolute;
    /* top: 15px; */
    /* right: 20px; */
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.food-details-content .close-btn:hover {
    color: #ff4757;
}

/* Make food list items clickable */
#foodList li {
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#foodList li:hover {
    background: var(--color-surface-alt);
}

#foodList li:active {
    transform: translateY(0);
}

/* Prevent the remove button from triggering the food details */
#foodList li button {
    z-index: 10;
    position: relative;
}

/* Form section grouping for better visual hierarchy */
.modal-form-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(225, 232, 237, 0.5);
}

.modal-form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.modal-form-section.meal-section {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.05) 0%, rgba(52, 168, 83, 0.05) 100%);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(66, 133, 244, 0.1);
    margin-bottom: 24px;
}

/* Improved placeholder styling */
.modal-content input::placeholder {
    color: #94a3b8;
    font-style: normal;
    font-weight: 400;
}

/* Better focus states for accessibility */
.modal-content input:focus,
.modal-content select:focus {
    border-color: #4285f4;
    background-color: white;
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
    transform: translateY(-1px);
    outline: none;
}

/* Improve select dropdown styling */
.modal-content select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='[http://www.w3.org/2000/svg](http://www.w3.org/2000/svg)' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
}

/* Style dropdown options for better visibility on Windows */
.modal-content select option {
    background-color: #ffffff;
    color: #222222;
    padding: 8px 12px;
    font-weight: 500;
}

.modal-content select option:hover,
.modal-content select option:focus,
.modal-content select option:checked {
    background-color: #4285f4;
    color: #ffffff;
}

/* Focus visible for keyboard navigation */
.modal-content button:focus-visible {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

.modal-content input:focus-visible,
.modal-content select:focus-visible {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

/* Improved accessibility for modals */
.modal {
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.6);
}

/* Better button active states */
.modal-content button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.2);
}

/* ===== PROFILE PAGE STYLES ===== */

/* Profile page container */
.profile-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 40px 20px;
    min-height: 100vh;
    background: var(--color-bg);
}

@media (min-width: 1029px) {
    .profile-page-container {
        margin-bottom: 80px;
    }
}

/* Mobile-first responsive adjustments */
@media (max-width: 768px) {
    .profile-page-container {
        padding: 80px 12px 20px 12px; /* Reduced top padding and side padding */
        margin-top: 10px;
    }
    
    .profile-page-header h1 {
        font-size: 2rem; /* Reduced from 2.5rem */
        margin-bottom: 24px; /* Reduced spacing */
    }
    
    .profile-info-section {
        padding: 24px 16px; /* Reduced from 40px */
    }
    
    /* Profile avatar adjustments */
    .profile-avatar-large {
        width: 80px; /* Reduced from 120px */
        height: 80px;
        margin: 0 auto 20px auto; /* Reduced bottom margin */
    }
    
    .profile-initials-large {
        font-size: 1.8rem; /* Reduced from 2.5rem */
    }
    
    /* Grid adjustments for mobile */
    .profile-details-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 20px; /* Reduced gap */
        margin-top: 20px;
    }
    
    .profile-card {
        padding: 16px; /* Reduced from 24px */
        margin-bottom: 16px;
    }
    
    .profile-card h3 {
        font-size: 1.1rem; /* Reduced from 1.3rem */
        margin-bottom: 16px;
    }
    
    /* Profile field adjustments */
    .profile-field {
        flex-direction: row; /* Stack label and value vertically */
        align-items: flex-start;
        margin-bottom: 12px;
        gap: 4px;
    }
    
    .profile-field label {
        font-size: 14px;
        margin-right: 0;
        margin-bottom: 2px;
    }
    
    .profile-field span {
        font-size: 16px;
        font-weight: 600;
        color: var(--color-text); /* Make values more prominent */
    }
    
    /* Subscription section mobile adjustments */
    .subscription-details ul {
        margin: 12px 0;
        padding-left: 16px;
    }
    
    .subscription-details li {
        margin-bottom: 6px;
        font-size: 14px;
        line-height: 1.4;
    }
    
    .premium-benefits {
        margin-top: 12px;
        padding: 12px;
    }
    
    .premium-benefits h4 {
        font-size: 1rem;
    }
    
    .premium-benefits ul {
        padding-left: 16px;
    }
    
    .premium-benefits li {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    /* Profile actions mobile adjustments */
    .profile-actions {
        padding: 20px 16px;
    }
    
    .profile-action-btn {
        padding: 12px 24px;
        font-size: 14px;
        width: 100%;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .profile-page-container {
        padding: 80px 12px 20px 12px;
        margin-top: 10px;
    }
    
    .profile-page-header {
        margin-bottom: 20px;
    }
    
    .profile-page-header h1 {
        font-size: 1.8rem;
        margin-bottom: 16px;
    }
    
    .profile-info-section {
        padding: 20px 12px;
    }
    
    .profile-avatar-large {
        width: 70px;
        height: 70px;
        margin-bottom: 16px;
    }
    
    .profile-initials-large {
        font-size: 1.5rem;
    }
    
    .profile-details-grid {
        gap: 16px;
        margin-top: 16px;
    }
    
    .profile-card {
        padding: 12px;
        border-radius: 12px;
    }
    
    .profile-card h3 {
        font-size: 1rem;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .profile-field {
        margin-bottom: 10px;
    }
    
    .profile-field label {
        font-size: 13px;
    }
    
    .profile-field span {
        font-size: 15px;
    }
    
    .status-badge {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .subscription-details {
        font-size: 13px;
    }
    
    .subscription-details li {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .premium-benefits {
        padding: 10px;
        margin-top: 10px;
    }
    
    .premium-benefits h4 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }
    
    .premium-benefits li {
        font-size: 12px;
        margin-bottom: 3px;
    }
    
    .payment-info {
        padding: 12px;
        border-radius: 8px;
    }
    
    .payment-info h4 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    .price-option {
        padding: 8px;
        font-size: 13px;
    }
    
    .price-option strong {
        font-size: 0.9rem;
    }
    
    .address-display code {
        font-size: 10px;
    }
    
    .copy-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .payment-status {
        padding: 8px;
        font-size: 13px;
    }
    
    .profile-actions {
        padding: 16px 12px;
    }
    
    .profile-action-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .profile-page-container {
        padding-top: 60px; /* Reduced for landscape */
    }
    
    .profile-page-header {
        margin-bottom: 16px;
    }
    
    .profile-page-header h1 {
        font-size: 1.8rem;
        margin-bottom: 12px;
    }
    
    .profile-avatar-large {
        width: 60px;
        height: 60px;
        margin-bottom: 12px;
    }
    
    .profile-initials-large {
        font-size: 1.4rem;
    }
}

/* Improve button positioning on mobile */
@media (max-width: 768px) {
    #showPaymentInfoBtn {
        font-size: 13px;
        padding: 10px 16px;
        margin-top: 16px;
        width: 100%;
        text-align: center;
    }
    
}

/* Fix any overflow issues */
@media (max-width: 768px) {
    .profile-page-content {
        overflow-x: hidden;
        border-radius: 16px;
    }
    
    .profile-card {
        overflow-x: hidden;
    }
    
    /* Ensure subscription list items don't overflow */
    .subscription-details ul,
    .premium-benefits ul {
        padding-left: 16px;
        margin-right: 0;
    }
    
    .subscription-details li,
    .premium-benefits li {
        word-wrap: break-word;
        hyphens: auto;
    }
}

/* Dark mode mobile adjustments */
body.dark-mode .profile-page-container,
body.dark-mode .profile-card,
body.dark-mode .profile-page-content {
    background: var(--color-bg);
    color: var(--color-text);
}

@media (max-width: 352px) {
    .profile-field span {
        margin-right: 20px;
    }
}

@media (max-width: 323px) {
    .profile-field span {
        margin-right: 40px;
    }
}

@media (max-width: 600px) {
    body.dark-mode .profile-page-container,
    body.dark-mode .profile-card,
    body.dark-mode .profile-page-content {
        background: var(--color-bg);
        color: var(--color-text);
        margin-left: -6px;
        margin-right: -6px;
    }

    .profile-page-container,
    .profile-card,
    .profile-page-content {
        margin-left: -6px;
        margin-right: -6px;
    }
}

@media (max-width: 369px) {
    body.dark-mode .profile-page-container,
    body.dark-mode .profile-card,
    body.dark-mode .profile-page-content {
        background: var(--color-bg);
        color: var(--color-text);
        margin-left: -18px;
        margin-right: -18px;
    }

    .profile-page-container,
    .profile-card,
    .profile-page-content {
        margin-left: -18px;
        margin-right: -18px;
    }
}

@media (max-width: 768px) {
    body.dark-mode .profile-field span {
        color: var(--color-text);
    }
    
    body.dark-mode .subscription-details li,
    body.dark-mode .premium-benefits li {
        color: var(--color-text);
    }
}

.profile-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.profile-page-header h1 {
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

/* Profile content layout */
.profile-page-content {
    background: var(--color-surface);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-info-section {
    padding: 40px;
}

/* Profile avatar */
.profile-avatar-large {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px auto;
    position: relative;
    border-radius: 50%;
    background: var(--color-surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(66, 133, 244, 0.15);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-initials-large {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

/* Profile details grid */
.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

@media (max-width: 600px) {
    .profile-details-grid {
        display: block;
    }
}

.profile-card {
    background: var(--color-surface-alt);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(66, 133, 244, 0.1);
}

.profile-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-primary);
}

.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 8px 0;
}

.profile-field label {
    font-weight: 600;
    color: var(--color-text);
    margin-right: 16px;
}

.profile-field span {
    color: var(--color-muted);
    font-weight: 500;
}

/* Subscription section */
.subscription-info {
    margin-top: 16px;
}

.subscription-status {
    margin-bottom: 20px;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

.status-badge.free {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.status-badge.premium {
    background: linear-gradient(135deg, #fff3e0 0%, #f3e5f5 100%);
    color: #f57c00;
    border: 1px solid #ffcc02;
}

/* Subscription duration styling */
.subscription-duration {
    margin: 10px 0;
    padding: 12px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    border-left: 4px solid #4caf50;
    transition: all 0.3s ease;
}

.subscription-duration:hover {
    background: rgba(76, 175, 80, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.subscription-duration p {
    margin: 0;
    font-weight: 600;
}

.subscription-duration p:first-child {
    font-size: 1em;
    margin-bottom: 5px;
}

.subscription-duration p:last-child {
    font-size: 0.9em;
    opacity: 0.8;
    font-weight: 400;
}

/* Cancel subscription button styling */
.cancel-subscription-btn {
    background: linear-gradient(135deg, #ff5722 0%, #e91e63 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 120px;
}

.cancel-subscription-btn:hover {
    background: linear-gradient(135deg, #e64a19 0%, #c2185b 100%);
}

/* Refresh subscription button styling */
.refresh-subscription-btn {
    background: linear-gradient(135deg, #2196f3 0%, #21cbf3 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    min-width: 120px;
}

.refresh-subscription-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1976d2 0%, #00bcd4 100%);
}

.refresh-subscription-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Subscription actions container */
.subscription-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 3840px) {
    .subscription-actions {
        flex-direction: column;
    }
    
    .refresh-subscription-btn,
    .cancel-subscription-btn {
        width: 100%;
        margin-right: 0 !important;
    }
}

/* Dark mode support for subscription duration */
body.dark-mode .subscription-duration {
    background: rgba(76, 175, 80, 0.2);
    border-left-color: #66bb6a;
}

body.dark-mode .subscription-duration:hover {
    background: rgba(76, 175, 80, 0.25);
}

.subscription-details ul {
    margin: 16px 0;
    padding-left: 20px;
}

.subscription-details li {
    margin-bottom: 8px;
    color: var(--color-text);
}

.premium-benefits {
    margin-top: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.premium-benefits h4 {
    margin: 0 0 10px 0;
    color: #ffd700;
}

.premium-benefits ul {
    margin: 0;
    padding-left: 20px;
}

/* Payment info - HIDDEN BY DEFAULT */
.payment-info {
    display: none; /* Hide by default */
    margin-top: 24px;
    padding: 20px;
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-surface-alt);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
}

.payment-info.show {
    display: block; /* Show when needed */
    opacity: 1;
    max-height: 1000px; /* Large enough to accommodate content */
}

.payment-info h4 {
    font-size: 1.1rem;
    color: var(--color-primary);
    margin: 0 0 16px 0;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.price-option {
    padding: 12px;
    background: var(--color-surface-alt);
    border-radius: 8px;
    text-align: center;
    border: 1px solid rgba(66, 133, 244, 0.1);
}

.price-option.lifetime {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-color: #ffc107;
}

.price-option strong {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.payment-address {
    margin: 20px 0;
}

.payment-address label {
    display: block;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.address-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface-alt);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.address-display code {
    flex: 1;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    background: none;
    border: none;
    color: var(--color-text);
}

.copy-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #3367d6;
}

.payment-status {
    margin-top: 16px;
    padding: 12px;
    background: var(--color-surface-alt);
    border-radius: 8px;
}

/* Food Menu Styles */
.food-menu-container {
    padding: 20px;
}

.menu-button {
    transition: transform 0.2s, background-color 0.2s;
}

.menu-button:hover {
    transform: scale(1.02);
    background-color: #3367d6 !important;
}

.menu-button:active {
    transform: scale(0.98);
}

body.dark-mode .menu-button {
    background: #3b3b3b;
}

body.dark-mode .menu-button:hover {
    background: #4a4a4a !important;
}

/* Profile actions */
.profile-actions {
    padding: 30px 40px;
    text-align: center;
}

.profile-action-btn {
    background: linear-gradient(135deg, #ea4335 0%, #d32f2f 100%);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

/* ===== PREMIUM UNLOCK BANNER STYLES ===== */

/* Premium banner container */
#premiumBannerContainer {
    width: 100%;
    max-width: 420px;
    margin: 16px auto 32px auto;
}

@media (min-width: 1029px) {
    #premiumBannerContainer {
        max-width: 900px;
        margin-bottom: 120px; /* Add extra bottom margin to account for bottom dock */
    }
}

/* Premium unlock banner for non-premium users */
.premium-unlock-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 24px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.premium-unlock-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.premium-unlock-banner h3 {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.premium-unlock-banner p {
    margin: 0 0 20px 0;
    font-size: 1rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.unlock-premium-btn {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #2c3e50;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
    letter-spacing: 0.5px;
}

.unlock-premium-btn:hover {
    background: linear-gradient(135deg, #ffed4e 0%, #ffd700 100%);
    color: #1a202c;
}

.unlock-premium-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

/* Mobile responsiveness for premium banner */
@media (max-width: 768px) {
    .premium-unlock-banner {
        padding: 20px 16px;
        margin: 12px 0;
        border-radius: 10px;
    }
    
    .premium-unlock-banner h3 {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .premium-unlock-banner p {
        font-size: 0.9rem;
        margin-bottom: 16px;
    }
    
    .unlock-premium-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: 20px;
    }
}

@media (max-width: 480px) {
    .premium-unlock-banner {
        padding: 16px 12px;
        margin: 10px 0;
    }
    
    .premium-unlock-banner h3 {
        font-size: 1.1rem;
    }
    
    .premium-unlock-banner p {
        font-size: 0.85rem;
    }
    
    .unlock-premium-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

/* Category tags pill style for Add Food modal */
.category-tag {
  display: inline-block;
  padding: 4px 14px;
  /* Remove margin, use gap in parent for spacing */
  border-radius: 18px;
  border: 1px solid #ccc;
  background: #eee;
  color: #333;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: background 0.2s, color 0.2s, border 0.2s, box-shadow 0.2s;
}
.category-tag.active {
  background: var(--color-primary, #4285f4);
  color: #fff;
  border: 1px solid var(--color-primary, #4285f4);
}
.category-tag:hover, .category-tag:focus {
  background: #d2e3fc;
  color: #222;
}
.category-tag.active:hover, .category-tag.active:focus {
  background: #3367d6;
  color: #fff;
  border: 1px solid #3367d6;
}

/* Tags wrapper and label styling */
.tags-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: -32px 0 0 0;
}

.tags-label {
  font-size: 0.98rem;
  font-weight: 500;
  color: #555;
  margin-right: 20px;
  position: relative;
  top: 6px;
  right: -8px;
  min-width: fit-content;
  white-space: nowrap;
}

/* Ensure tags section is horizontally scrollable and tags are side by side */
#modalCategoryTags {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Dark mode styles for category tags in Add Food modal */
body.dark-mode .category-tag {
  background: #2a2a2a;
  color: #e0e0e0;
  border: 1px solid #444;
}
body.dark-mode .category-tag.active {
  background: var(--color-primary, #4285f4);
  color: #fff;
  border: 1px solid var(--color-primary, #4285f4);
}
body.dark-mode .category-tag:hover, body.dark-mode .category-tag:focus {
  background: #3a3a3a;
  color: #fff;
  border: 1px solid rgba(66, 133, 244, 0.8);
}
body.dark-mode .category-tag.active:hover, body.dark-mode .category-tag.active:focus {
  background: #3367d6;
  color: #fff;
  border: 1px solid #3367d6;
}

/* Help tag specific styles */
.category-tag.help-tag {
  background: #ffffff !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
  font-weight: bold !important;
  position: relative;
  transition: all 0.2s ease;
}

body.dark-mode .category-tag.help-tag {
  background: #23272a !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
}

/* Camera tag specific styles */
.category-tag.camera-tag {
  background: #f0f8ff !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
  font-weight: bold !important;
  position: relative;
  transition: all 0.2s ease;
}

.category-tag.camera-tag:hover {
  background: #e6f3ff !important;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.category-tag.camera-tag img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(100%) saturate(2078%) hue-rotate(216deg) brightness(97%) contrast(94%) !important;
}

body.dark-mode .category-tag.camera-tag {
  background: #1a2332 !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
}

body.dark-mode .category-tag.camera-tag:hover {
  background: #2a3342 !important;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

body.dark-mode .category-tag.camera-tag img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(100%) saturate(2078%) hue-rotate(216deg) brightness(97%) contrast(94%) !important;
}

/* Barcode tag specific styles */
.category-tag.barcode-tag {
  background: #f0f8ff !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
  font-weight: bold !important;
  position: relative;
  transition: all 0.2s ease;
}

.category-tag.barcode-tag:hover {
  background: #e6f3ff !important;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.category-tag.barcode-tag img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(100%) saturate(2078%) hue-rotate(216deg) brightness(97%) contrast(94%) !important;
}

body.dark-mode .category-tag.barcode-tag {
  background: #1a2332 !important;
  color: #4285f4 !important;
  border: 1px solid #4285f4 !important;
}

body.dark-mode .category-tag.barcode-tag:hover {
  background: #2a3342 !important;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

#modalEnhanceBtn:hover {
    background: linear-gradient(135deg, #764ba2, #768cef 100%)
    
}

body.dark-mode .category-tag.barcode-tag img {
  filter: brightness(0) saturate(100%) invert(31%) sepia(100%) saturate(2078%) hue-rotate(216deg) brightness(97%) contrast(94%) !important;
}
body.dark-mode #modalCategoryTags {
  background: transparent;
}

/* Dark mode styling for tags label */
body.dark-mode .tags-label {
  color: #b0b0b0;
}

/* NEW STYLES FOR AI ENHANCEMENT BUTTON */
#modalEnhanceBtn {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 12px; /* Add margin to separate from Add Food button */
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    letter-spacing: 0.5px;
}

#modalEnhanceBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#modalEnhanceBtn.loading {
    animation: pulse 1.5s infinite;
}

/* WEIGHT HELPER STYLES */
#modalWeightHelperBtn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 12px;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    letter-spacing: 0.5px;
}

#modalWeightHelperBtn:hover {
    background: linear-gradient(135deg, #ff8a90 0%, #fdbde2 100%);
}

#weightHelperSection {
    background: var(--color-surface-alt);
    border-radius: 12px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 10px;
    margin-bottom: 15px;
    border: 2px solid #e1e8ed;
}

#weightHelperSection label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 15px;
}

#modalPortionDescription {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 16px;
    background-color: #f8f9fa;
    box-sizing: border-box;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    color: var(--color-text);
    outline: none;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
}

#modalPortionDescription:focus {
    border-color: #ff9a9e;
    background-color: white;
    box-shadow: 0 0 0 4px rgba(255, 154, 158, 0.1);
    transform: translateY(-1px);
}

#modalPortionDescription::placeholder {
    color: #94a3b8;
    font-style: normal;
    font-weight: 400;
}

#modalCalculateWeightBtn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', 'Roboto', Arial, sans-serif;
    letter-spacing: 0.5px;
}

#modalCalculateWeightBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Dark mode styles for weight helper */
body.dark-mode #weightHelperSection {
    background: #23272a;
    border: 2px solid #333;
}

body.dark-mode #modalPortionDescription {
    background: #23272a;
    border: 2px solid #444;
    color: var(--color-text);
}

body.dark-mode #modalPortionDescription:focus {
    border-color: #ff9a9e;
    background-color: #2a2d30;
    box-shadow: 0 0 0 4px rgba(255, 154, 158, 0.1);
}

/* Fix white lines in dark mode - Add these rules to your CSS */

/* Fix profile popup borders in dark mode */
body.dark-mode .profile-popup {
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
    border: 1px solid #333; /* Changed from #e0e0e0 */
}

body.dark-mode .profile-menu-btn {
    border-bottom: 1px solid #333; /* Changed from #e0e0e0 */
}

/* Fix modal borders in dark mode */
body.dark-mode .modal-content,
body.dark-mode #setupModal .modal-content {
    background: linear-gradient(180deg, #181a1b, #23272a) !important;
    color: var(--color-text);
    box-shadow: 0 20px 40px rgba(0,0,0,0.7), 0 10px 20px rgba(0,0,0,0.4);
    border: 0px solid #333; /* Ensure consistent dark border */
}

/* Fix modal input borders in dark mode */
body.dark-mode .modal-content input,
body.dark-mode .modal-content select {
    background: #23272a;
    border: 1px solid #444; /* Changed from #e1e8ed */
    color: var(--color-text);
}

/* Style dropdown options for dark mode - better visibility on Windows */
body.dark-mode .modal-content select option {
    background-color: #23272a;
    color: #f1f1f1;
    padding: 8px 12px;
    font-weight: 500;
}

body.dark-mode .modal-content select option:hover,
body.dark-mode .modal-content select option:focus,
body.dark-mode .modal-content select option:checked {
    background-color: #4285f4;
    color: #ffffff;
}

/* Fix profile button border in dark mode */
body.dark-mode #profileBtn {
    background: var(--color-surface);
    border: 2px solid #333; /* Changed from #e0e0e0 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* Fix address display border in dark mode */
body.dark-mode .address-display {
    background: var(--color-surface-alt);
    border: 1px solid #333; /* Changed from #e0e0e0 */
}

/* Fix profile page borders in dark mode */
body.dark-mode .profile-page-content,
body.dark-mode .profile-card {
    border: 1px solid #333;
}

/* Fix calendar modal borders in dark mode */
body.dark-mode .calendar-modal {
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 20px 40px rgba(0,0,0,0.7), 0 10px 20px rgba(0,0,0,0.4);
    border: 1px solid #333; /* Ensure border is dark */
}

/* Fix food details modal borders in dark mode */
body.dark-mode .food-details-content {
    background: #23272a;
    color: var(--color-text);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 10px 20px rgba(0,0,0,0.2);
    border: 1px solid #333; /* Changed from #444 to match other modals */
}

/* Fix meal tabs borders in dark mode - remove any white borders */
body.dark-mode .meal-tab {
    border: none; /* Remove any default borders */
}

/* Fix any remaining white borders on containers */
body.dark-mode .progress-container,
body.dark-mode table {
    border: none; /* Remove any white borders */
}

body.dark-mode #foodList li {
    border-left: 5px solid var(--color-primary);
}

/* Ensure calendar bar has proper dark border */
body.dark-mode #calendarBar {
    border-bottom: 1px solid #23272a; /* Changed from #222 to match other borders */
}

/* Fix premium unlock banner border in dark mode */
body.dark-mode .premium-unlock-banner {
    border: 1px solid rgba(255, 255, 255, 0.2); /* Keep this as is - it's intentionally light */
}

/* Fix any white lines in suggestions dropdown */
body.dark-mode #suggestions {
    background: var(--color-surface);
    border: 2px solid #333; /* Ensure dark border */
    box-shadow: 0 4px 16px rgba(0,0,0,0.7);
}

/* Fix category tags borders in dark mode */
body.dark-mode .category-tag {
    background: #222;
    color: #eee;
    border: 1px solid #444; /* Keep this as is - it's already dark */
}

/* Fix price option borders in dark mode */
body.dark-mode .price-option {
    background: var(--color-surface-alt);
    border: 1px solid #333; /* Changed from rgba(66, 133, 244, 0.1) */
}

body.dark-mode .price-option.lifetime {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-color: #444; /* Darker border for lifetime option */
}

/* Stripe payment styles */
.upgrade-btn {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 12px 20px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.upgrade-btn.yearly {
    background: #4285f4;
}

.pricing-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 600px) {
    .pricing-options {
        flex-direction: row;
        gap: 12px;
    }
    
    .upgrade-btn {
        flex: 1;
    }
}

/* Premium Upgrade Modal Styles */
.premium-modal {
    display: block !important;
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.premium-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border: none;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    height: 45%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.premium-modal-icon {
    color: #4285f4;
    font-size: 48px;
    margin-bottom: 20px;
}

.premium-modal-icon img {
    width: 48px;
    height: 48px;
    filter: invert(49%) sepia(9%) saturate(356%) hue-rotate(169deg) brightness(91%) contrast(91%);
}

.premium-modal-title {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 600;
}

.premium-modal-description {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.5;
    font-size: 16px;
}

.premium-modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.premium-upgrade-btn {
    background: #4285f4, !important;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.premium-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 133, 244, 0.4);
}

.premium-cancel-btn {
    background: #f1f3f4 !important;
    color: #5f6368 !important;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-cancel-btn:hover {
    background: #e8eaed !important;
}

/* Dark mode styles for premium modal */
body.dark-mode .premium-modal-content {
    background-color: #2d2d2d;
    color: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid #444;
}

body.dark-mode .premium-modal-title {
    color: #ffffff;
}

body.dark-mode .premium-modal-description {
    color: #cccccc;
}

body.dark-mode .premium-modal-icon img {
    filter: none;
}

body.dark-mode .premium-cancel-btn {
    background: #444 !important;
    color: #cccccc !important;
}

body.dark-mode .premium-cancel-btn:hover {
    background: #555 !important;
}

@media (max-width: 1029px) {
    .premium-modal-content {
        width: 100%;
        max-width: 1029px;
        height: 100%;
        max-height: none;
        margin: 0;
        border-radius: 0px;
    }

    .premium-modal-buttons {
        display: block;
    }

    .premium-upgrade-btn {
        margin-bottom: 0px !important;
    }
}

body.dark-mode #calendarBar[style*="position: fixed"] {
    background: linear-gradient(180deg, #181a1b, #23272a) !important;
}

#calendarBar[style*="position: fixed"] {
    background: linear-gradient(180deg, #f5f6fa, #ffffff) !important;
}

/* iOS-specific liquid glass styling */

/* Universal liquid glass styling - enabled with class toggle */
body.liquid-glass-enabled #calendarBar[style*="position: fixed"] {
    background: linear-gradient(180deg, #f5f6fa, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled.dark-mode #calendarBar[style*="position: fixed"] {
    background: linear-gradient(180deg, #181a1b, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled .mobile-bottom-dock {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled.dark-mode .mobile-bottom-dock {
    background: rgba(255, 255, 255, 0.01) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled .modal-content {
    background: linear-gradient(180deg, #f5f6fa, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled #addFoodModal {
    background: none !important;
    backdrop-filter: none !important;
}

body.liquid-glass-enabled .modal {
    background: none !important;
    backdrop-filter: none !important;
}

body.liquid-glass-enabled .calendar-modal-overlay {
    backdrop-filter: none !important;
    background: none !important;
}

body.liquid-glass-enabled .calendar-modal {
    background: linear-gradient(180deg, #f5f6fa, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled .calendar-day {
    background: inherit;
}

body.liquid-glass-enabled #foodDetailsModal {
    background: none !important;
    backdrop-filter: none !important;
    bottom: 100px; /* Adjust to sit above bottom dock */
}

body.liquid-glass-enabled .food-details-content {
    background: linear-gradient(180deg, #f5f6fa, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled .macro-item {
    background: none !important;
}

body.liquid-glass-enabled .modal-content select {
    background: transparent !important;
}

body.liquid-glass-enabled .modal-content input {
    background: transparent;
}

body.liquid-glass-enabled .category-tag.help-tag {
    background: transparent !important;
}

body.liquid-glass-enabled #weightHelperSection {
    background: transparent !important;
}

body.liquid-glass-enabled #modalPortionDescription {
    background: transparent !important;
}

body.liquid-glass-enabled #suggestions {
    background: transparent !important;
}

body.liquid-glass-enabled.dark-mode .modal-content {
    background: linear-gradient(180deg, #181a1b, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled.dark-mode #addFoodModal {
    background: none !important;
    backdrop-filter: none !important;
}

body.liquid-glass-enabled.dark-mode .modal {
    background: none !important;
    backdrop-filter: none !important;
}

body.liquid-glass-enabled.dark-mode .calendar-modal-overlay {
    backdrop-filter: none !important;
    background: none !important;
}

body.liquid-glass-enabled.dark-mode .calendar-modal {
    background: linear-gradient(180deg, #181a1b, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled.dark-mode .calendar-day {
    background: inherit;
}

body.liquid-glass-enabled.dark-mode #foodDetailsModal {
    background: none !important;
    backdrop-filter: none !important;
    bottom: 100px; /* Adjust to sit above bottom dock */
}

body.liquid-glass-enabled.dark-mode .food-details-content {
    background: linear-gradient(180deg, #181a1b, 20%, transparent) !important;
    backdrop-filter: blur(10px) saturate(180%) !important;
}

body.liquid-glass-enabled.dark-mode .macro-item {
    background: none !important;
}

body.liquid-glass-enabled.dark-mode .modal-content select {
    background: transparent !important;
}

body.liquid-glass-enabled.dark-mode .modal-content input {
    background: transparent;
}

body.liquid-glass-enabled.dark-mode .category-tag.help-tag {
    background: transparent !important;
}

body.liquid-glass-enabled.dark-mode #weightHelperSection {
    background: transparent !important;
}

body.liquid-glass-enabled.dark-mode #modalPortionDescription {
    background: transparent !important;
}

body.liquid-glass-enabled.dark-mode #suggestions {
    background: transparent !important;
}

/* Loading spinner animation for profile initialization */
.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(66, 133, 244, 0.2);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Floating Bottom Bar - enabled with class toggle */
body.floating-bottom-bar-enabled .mobile-bottom-dock {
    width: 90%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 60px;
    bottom: 20px;
}

body.floating-bottom-bar-enabled .dock-item {
    margin-bottom: 10px;
}

@media (max-width: 1029px) {
    #foodDetailsModal {
        bottom: 0 !important;
        padding: 0 !important;
    }
    
    .food-details-content {
        border-radius: 0 !important;
        width: 100% !important;
        max-width: 1029vw !important;
        max-height: 100vh !important;
        margin-bottom: 0 !important;
    }
}

button#close-calendar:hover {
    color: #ff4757;
}