/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Modern iOS 17+ Style Variables */
:root {
  --primary-color: #007AFF;
  --primary-dark: #0051D5;
  --primary-light: #5AC8FA;
  --secondary-color: #30D158;
  --danger-color: #FF453A;
  --warning-color: #FF9F0A;
  --background-color: #F2F2F7;
  --background-secondary: #FFFFFF;
  --card-background: #FFFFFF;
  --grouped-background: #F2F2F7;
  --text-primary: #000000;
  --text-secondary: #6D6D70;
  --text-tertiary: #C7C7CC;
  --text-quaternary: #F2F2F7;
  --border-color: #D1D1D6;
  --separator-color: #C6C6C8;
  --fill-primary: rgba(120, 120, 128, 0.2);
  --fill-secondary: rgba(120, 120, 128, 0.16);
  --fill-tertiary: rgba(118, 118, 128, 0.12);
  --shadow-light: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-elevated: 0 8px 32px rgba(0,0,0,0.12);
  --border-radius-small: 8px;
  --border-radius: 12px;
  --border-radius-large: 20px;
  --border-radius-xl: 28px;
  --transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --blur-background: rgba(255, 255, 255, 0.85);
  --blur-background-dark: rgba(255, 255, 255, 0.72);
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, var(--background-color) 0%, #FAFAFA 100%);
  margin: 0;
  padding: 0;
  line-height: 1.47058823529;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 17px;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  min-height: 100vh;
}

/* Screen Management */
.screen {
  display: none;
  min-height: 100vh;
  opacity: 0;
  transform: translateY(20px);
  transition: var(--transition);
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Login Screen */
#loginScreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 50%, var(--secondary-color) 100%);
  padding: 20px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#loginScreen.hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.92);
  transition: var(--transition-bounce);
}

.login-container {
  background: var(--blur-background);
  backdrop-filter: blur(60px);
  -webkit-backdrop-filter: blur(60px);
  padding: 56px 40px 48px;
  border-radius: var(--border-radius-xl);
  box-shadow:
    0 32px 64px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  width: 100%;
  max-width: 400px;
  text-align: center;
  border: 0.5px solid rgba(255, 255, 255, 0.25);
}

/* Logo Icon */
.logo-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.app-logo h1 {
  font-size: 3rem;
  font-weight: 800;
  margin: 0 0 12px 0;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-logo p {
  color: var(--text-secondary);
  margin: 0 0 40px 0;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.login-form {
  text-align: left;
}

/* Input Groups */
.input-group {
  margin-bottom: 28px;
}

.input-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.input-group input {
  width: 100%;
  padding: 18px 20px;
  border: 0.5px solid var(--fill-tertiary);
  border-radius: var(--border-radius);
  font-size: 17px;
  transition: var(--transition);
  background-color: var(--fill-secondary);
  font-family: inherit;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow:
    0 0 0 4px rgba(0, 122, 255, 0.08),
    0 2px 8px rgba(0, 122, 255, 0.12);
  background-color: var(--card-background);
  transform: translateY(-1px);
}

.input-group input::placeholder {
  color: var(--text-tertiary);
  font-weight: 400;
}

/* Buttons */
.btn {
  padding: 18px 32px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
  text-align: center;
  min-width: 140px;
  font-family: inherit;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
  opacity: 0;
  transition: var(--transition);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow:
    0 4px 16px rgba(0, 122, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 122, 255, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(0, 122, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #28CD4F 100%);
  color: white;
  box-shadow:
    0 4px 16px rgba(48, 209, 88, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(48, 209, 88, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color) 0%, #FF2D20 100%);
  color: white;
  box-shadow:
    0 4px 16px rgba(255, 69, 58, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(255, 69, 58, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #28CD4F 100%) !important;
  color: white !important;
  box-shadow:
    0 4px 16px rgba(48, 209, 88, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transform: scale(1.02);
}

/* Main App Layout */
#mainScreen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  background: var(--blur-background-dark);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-bottom: 0.5px solid var(--separator-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-light);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 36px;
}

/* Header Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-icon {
  font-size: 20px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.header-content h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info span {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
}

/* Smaller button for header */
.user-info .btn {
  padding: 4px 10px;
  font-size: 11px;
  min-height: 28px;
  border-radius: 14px;
  font-weight: 500;
}

/* Main Content */
.main-content {
  flex: 1;
  padding-bottom: 120px; /* Space for bottom nav */
}

.content-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.content-container h2 {
  margin: 0 0 32px 0;
  color: var(--text-primary);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Food Form */
.food-form {
  background: var(--card-background);
  padding: 32px;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow);
  margin-bottom: 32px;
  border: 0.5px solid var(--separator-color);
}

/* Food Image Preview */
.food-image-container {
  height: 144px; /* 120px + 24px margin */
  margin-bottom: 0;
}

.food-image-preview {
  position: relative;
  width: 100%;
  height: 120px;
  margin-bottom: 24px;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: var(--background-color);
  border: 2px dashed var(--border-color);
  transition: var(--transition);
}

.food-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
}

.food-image-preview.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-color);
}

.food-image-preview.loading::after {
  content: "Loading image...";
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: var(--transition);
}

.food-image-preview:hover .image-overlay {
  opacity: 1;
}

.btn-image-change {
  background: var(--blur-background);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-image-change:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

/* Summary Cards */
.summary-date {
  text-align: center;
  margin-bottom: 24px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-secondary);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.summary-card {
  background: linear-gradient(135deg, var(--card-background) 0%, #FAFAFA 100%);
  padding: 32px 24px;
  border-radius: var(--border-radius-large);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  text-align: center;
  border: 0.5px solid var(--separator-color);
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

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

.summary-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-elevated);
}

.summary-card:hover::before {
  opacity: 1;
}

.summary-value {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.summary-label {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Today's Foods Section */
.today-foods {
  background: var(--card-background);
  padding: 32px;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow);
  border: 0.5px solid var(--separator-color);
}

.today-foods h3 {
  margin: 0 0 24px 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Food List */
.food-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.food-item {
  background: var(--fill-secondary);
  padding: 20px;
  border-radius: var(--border-radius);
  border: 0.5px solid var(--fill-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.food-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  opacity: 0.8;
}

.food-item.with-image {
  padding: 16px;
}

.food-item:hover {
  background: var(--card-background);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.food-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.food-image-thumb {
  width: 70px;
  height: 70px;
  border-radius: var(--border-radius);
  object-fit: cover;
  background: var(--card-background);
  border: 1px solid var(--separator-color);
}

.food-info h4 {
  margin: 0 0 4px 0;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.food-details {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
}

.food-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 15px;
  min-width: auto;
  font-weight: 500;
}

/* History Controls */
.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 15px;
  flex-wrap: wrap;
}

.date-input {
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  background-color: var(--card-background);
}

/* Modern iOS Bottom Navigation - Fixed Position */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(248, 248, 248, 0.98);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  z-index: 1000;
  box-shadow:
    0 -1px 0 rgba(0, 0, 0, 0.03),
    0 -4px 20px rgba(0, 0, 0, 0.08);
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  contain: layout style paint;
}

.nav-container {
  display: flex;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  padding: 4px;
  gap: 2px;
  position: relative;
  overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 12px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 12px 6px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  color: rgba(142, 142, 147, 1);
  min-width: 60px;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  font-weight: 500;
}

.nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  z-index: -1;
}

.nav-btn.active {
  color: var(--primary-color);
  background: rgba(0, 122, 255, 0.1);
}

.nav-btn.active::before {
  opacity: 1;
  transform: scale(1);
}

.nav-btn:active {
  opacity: 0.7;
}

@media (hover: hover) {
  .nav-btn:hover:not(.active) {
    color: var(--primary-color);
    opacity: 0.8;
  }

  .nav-btn:hover:not(.active)::before {
    opacity: 0.6;
  }
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
  font-weight: 400;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}

.nav-btn.active .nav-icon {
  font-weight: 600;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1px;
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  line-height: 1.2;
  margin-top: 1px;
}

.nav-btn.active .nav-label {
  font-weight: 600;
  opacity: 1;
}

/* Navigation haptic feedback effects - Static */
.nav-btn.tap-feedback {
  opacity: 0.7;
}

/* Enhanced active state with subtle glow */
.nav-btn.active {
  color: var(--primary-color);
  transform: translateY(-1px);
  filter: drop-shadow(0 2px 4px rgba(0, 122, 255, 0.2));
}

/* Smooth state transitions */
.nav-btn {
  will-change: transform, color, filter;
}

/* iOS-style focus states for accessibility */
.nav-btn:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: 20px;
}

/* Dark mode support for navigation */
@media (prefers-color-scheme: dark) {
  .bottom-nav {
    background: rgba(28, 28, 30, 0.95);
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .nav-container {
    background: rgba(0, 122, 255, 0.15);
    border-color: rgba(0, 122, 255, 0.2);
  }

  .nav-btn {
    color: rgba(0, 122, 255, 0.8);
  }

  .nav-btn::before {
    background: rgba(44, 44, 46, 0.9);
  }

  .nav-btn.active {
    color: #0A84FF;
  }
}

/* Messages */
.message {
  position: fixed;
  top: 60px;
  right: 20px;
  padding: 16px 20px;
  border-radius: var(--border-radius-large);
  color: white;
  font-weight: 500;
  font-size: 15px;
  z-index: 1001;
  transform: translateX(400px);
  transition: var(--transition);
  box-shadow: var(--shadow-elevated);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  max-width: 300px;
}

.message.show {
  transform: translateX(0);
}

.message.success {
  background-color: var(--secondary-color);
}

.message.error {
  background-color: var(--danger-color);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--text-tertiary);
  font-weight: 300;
}

.empty-state p {
  margin: 8px 0;
  font-size: 17px;
  line-height: 1.4;
}

.empty-state p:first-of-type {
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-state p:last-of-type {
  font-size: 15px;
  color: var(--text-tertiary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    padding: 12px 20px;
  }

  .header-content h1 {
    font-size: 20px;
  }

  .content-container {
    padding: 20px 16px;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .food-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .food-actions {
    align-self: flex-end;
  }

  .history-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .user-info {
    flex-direction: column;
    gap: 8px;
  }

  .user-info span {
    font-size: 14px;
  }

  /* iOS tablet specific adjustments */
  .sphere-container {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .calorie-goal-section {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .recent-meals {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 30px 20px;
  }

  .app-logo h1 {
    font-size: 2rem;
  }

  .content-container h2 {
    font-size: 1.5rem;
  }

  .summary-value {
    font-size: 1.5rem;
  }

  /* Mobile Navigation Adjustments */
  .bottom-nav {
    padding: 6px 16px calc(6px + env(safe-area-inset-bottom));
  }

  .nav-container {
    border-radius: 20px;
    padding: 4px;
    gap: 2px;
  }

  .nav-btn {
    padding: 10px 12px 8px 12px;
    min-width: 60px;
    border-radius: 16px;
  }

  .nav-btn::before {
    border-radius: 14px;
  }

  .nav-icon {
    font-size: 18px;
    height: 20px;
    margin-bottom: 2px;
  }

  .nav-label {
    font-size: 10px;
  }
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* ==========================================================================
   Advanced Animations and Effects
   ========================================================================== */

/* Fire Animation Keyframes */
@keyframes fireFlicker {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    filter: hue-rotate(0deg) brightness(1);
  }
  25% {
    transform: scale(1.05) rotate(-2deg);
    filter: hue-rotate(10deg) brightness(1.1);
  }
  50% {
    transform: scale(1.1) rotate(1deg);
    filter: hue-rotate(-5deg) brightness(1.2);
  }
  75% {
    transform: scale(1.03) rotate(-1deg);
    filter: hue-rotate(15deg) brightness(1.05);
  }
}

@keyframes fireParticles {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-100px) scale(0);
    opacity: 0;
  }
}

@keyframes goalCelebration {
  0% { transform: scale(1); }
  20% { transform: scale(1.1) rotate(5deg); }
  40% { transform: scale(0.95) rotate(-3deg); }
  60% { transform: scale(1.05) rotate(2deg); }
  80% { transform: scale(0.98) rotate(-1deg); }
  100% { transform: scale(1) rotate(0deg); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      inset -12px -12px 24px rgba(0, 122, 255, 0.08),
      inset 12px 12px 24px rgba(255, 255, 255, 0.9),
      0 12px 36px rgba(0, 122, 255, 0.12),
      0 4px 12px rgba(0, 0, 0, 0.04);
  }
  50% {
    box-shadow:
      inset -12px -12px 24px rgba(255, 165, 0, 0.15),
      inset 12px 12px 24px rgba(255, 255, 255, 0.9),
      0 12px 36px rgba(255, 165, 0, 0.25),
      0 4px 12px rgba(255, 165, 0, 0.1),
      0 0 40px rgba(255, 165, 0, 0.3);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

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

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

@keyframes fadeInScale {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
  70% {
    transform: scale(0.9);
    opacity: 0.9;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes progressFill {
  from {
    --progress-angle: 0deg;
  }
  to {
    --progress-angle: var(--target-angle);
  }
}

/* Fire Effect Container */
.fire-container {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 10;
}

.fire-emoji {
  position: absolute;
  font-size: 40px;
  animation: fireFlicker 0.5s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 165, 0, 0.8));
}

.fire-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, #ff6b35, #f7931e);
  border-radius: 50%;
  animation: fireParticles 1s ease-out infinite;
}

.fire-particle:nth-child(2) { animation-delay: 0.1s; left: 10px; }
.fire-particle:nth-child(3) { animation-delay: 0.2s; left: 20px; }
.fire-particle:nth-child(4) { animation-delay: 0.3s; left: 30px; }
.fire-particle:nth-child(5) { animation-delay: 0.4s; left: 40px; }

/* Enhanced Card Animations */
.summary-card {
  animation: slideInUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation-fill-mode: both;
  opacity: 0;
}

.summary-card:nth-child(1) {
  animation-delay: 0.1s;
  opacity: 1;
}
.summary-card:nth-child(2) {
  animation-delay: 0.2s;
  opacity: 1;
}
.summary-card:nth-child(3) {
  animation-delay: 0.3s;
  opacity: 1;
}

/* Enhanced card hover effects */
.summary-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow:
    var(--shadow-elevated),
    0 0 0 1px rgba(0, 122, 255, 0.1);
}

.summary-card:active {
  transform: translateY(-4px) scale(1.01);
  transition: transform 0.1s ease-out;
}

.food-item {
  animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  animation-fill-mode: both;
}

.food-item:nth-child(1) { animation-delay: 0.05s; }
.food-item:nth-child(2) { animation-delay: 0.1s; }
.food-item:nth-child(3) { animation-delay: 0.15s; }
.food-item:nth-child(4) { animation-delay: 0.2s; }
.food-item:nth-child(5) { animation-delay: 0.25s; }

/* Enhanced Navigation Animations */
.nav-btn {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-btn.switching {
  opacity: 0.8;
}

/* Enhanced icon animations - Static */
.nav-icon {
  transition: color 0.3s ease, font-weight 0.3s ease;
}

.nav-btn:active .nav-icon {
  opacity: 0.7;
}

.nav-btn.active .nav-icon {
  color: var(--primary-color);
}

/* Tab Content - Static */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Enhanced Button Interactions */
.btn {
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* Micro-interactions */
.input-group input {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.input-group input:focus {
  animation: slideInDown 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Loading States */
.loading-shimmer {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ==========================================================================
   Calories Tab - iOS-Optimized Spherical Graph Styles
   ========================================================================== */

/* iOS-specific date display */
.calories-date {
  text-align: center;
  margin-bottom: 20px;
  padding: 12px 20px;
  background: rgba(0, 122, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(0, 122, 255, 0.1);
}

.calories-date span {
  font-size: 16px;
  font-weight: 600;
  color: var(--primary-color);
  letter-spacing: -0.02em;
}

/* Calories Header with Refresh Button */
.calories-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.calories-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.btn-refresh {
  background: rgba(0, 122, 255, 0.1);
  border: 1px solid rgba(0, 122, 255, 0.2);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  color: var(--primary-color);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

.btn-refresh::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
}

.btn-refresh:hover {
  background: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
}

.btn-refresh:active {
  transform: scale(0.95);
  background: rgba(0, 122, 255, 0.2);
}

.btn-refresh svg {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-refresh.spinning svg {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Calorie Goal Section - iOS Style */
.calorie-goal-section {
  background: var(--card-background);
  border-radius: 16px;
  padding: 24px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--separator-color);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.goal-input-group label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.goal-input-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--background-secondary);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--separator-color);
}

.goal-input-container input {
  flex: 1;
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  font-size: 17px;
  background: transparent;
  transition: var(--transition-smooth);
  -webkit-appearance: none;
  appearance: none;
}

.goal-input-container input:focus {
  outline: none;
  background: rgba(0, 122, 255, 0.05);
}

.goal-unit {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 15px;
  min-width: 40px;
  padding-right: 8px;
}

.btn-small {
  padding: 10px 16px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  min-height: 44px; /* iOS touch target */
}

/* Sphere Container - iOS Optimized */
.sphere-container {
  background: var(--card-background);
  border-radius: 20px;
  padding: 32px 20px 28px 20px;
  margin-bottom: 20px;
  border: 1px solid var(--separator-color);
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  position: relative;
  overflow: hidden;
}

.sphere-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

.sphere-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 28px;
  padding: 20px 0;
}

/* 3D Sphere - iOS Enhanced */
.sphere {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    rgba(0, 122, 255, 0.08) 0%,
    rgba(0, 122, 255, 0.03) 50%,
    rgba(0, 122, 255, 0.12) 100%);
  box-shadow:
    inset -12px -12px 24px rgba(0, 122, 255, 0.08),
    inset 12px 12px 24px rgba(255, 255, 255, 0.9),
    0 12px 36px rgba(0, 122, 255, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-style: preserve-3d;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* Goal Reached State */
.sphere.goal-reached {
  background: linear-gradient(135deg,
    rgba(255, 165, 0, 0.12) 0%,
    rgba(255, 165, 0, 0.06) 50%,
    rgba(255, 165, 0, 0.18) 100%);
  animation: pulseGlow 2s ease-in-out infinite;
}

/* Goal Exceeded State */
.sphere.goal-exceeded {
  background: linear-gradient(135deg,
    rgba(255, 69, 58, 0.12) 0%,
    rgba(255, 69, 58, 0.06) 50%,
    rgba(255, 69, 58, 0.18) 100%);
  box-shadow:
    inset -12px -12px 24px rgba(255, 69, 58, 0.15),
    inset 12px 12px 24px rgba(255, 255, 255, 0.9),
    0 12px 36px rgba(255, 69, 58, 0.25),
    0 4px 12px rgba(255, 69, 58, 0.1);
}

/* Celebration Animation */
.sphere.animate {
  animation: goalCelebration 1s ease-in-out;
}

/* Celebration state */
.sphere.celebrate {
  animation: goalCelebration 1s ease-in-out, pulseGlow 2s ease-in-out infinite;
  transform-origin: center;
}

.sphere:active {
  transform: scale(0.98);
  transition: transform 0.1s ease-out;
}

@media (hover: hover) {
  .sphere:hover {
    transform: rotateY(8deg) rotateX(4deg) scale(1.02);
    box-shadow:
      inset -16px -16px 28px rgba(0, 122, 255, 0.12),
      inset 16px 16px 28px rgba(255, 255, 255, 0.95),
      0 16px 44px rgba(0, 122, 255, 0.16),
      0 6px 16px rgba(0, 0, 0, 0.06);
  }
}

.sphere-inner {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0.85) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 6px 6px 12px rgba(0, 0, 0, 0.04),
    inset -6px -6px 12px rgba(255, 255, 255, 0.9);
}

.sphere-content {
  text-align: center;
  z-index: 2;
  padding: 8px;
}

.sphere-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.sphere-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

.sphere-goal {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  opacity: 0.9;
}

/* Animated Progress Ring - iOS Enhanced */
.sphere-progress {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 232px;
  height: 232px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    var(--primary-color) 0deg,
    var(--primary-color) var(--progress-angle, 0deg),
    rgba(0, 122, 255, 0.1) var(--progress-angle, 0deg),
    rgba(0, 122, 255, 0.1) 360deg
  );
  mask: radial-gradient(circle, transparent 95px, black 102px);
  -webkit-mask: radial-gradient(circle, transparent 95px, black 102px);
  opacity: 0.9;
  transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  filter: drop-shadow(0 2px 8px rgba(0, 122, 255, 0.2));
}

/* Progress Stats - iOS Cards */
.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-item {
  text-align: center;
  padding: 18px 12px;
  background: rgba(0, 122, 255, 0.04);
  border-radius: 14px;
  border: 1px solid rgba(0, 122, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.stat-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
}

.stat-item:active {
  transform: scale(0.96);
  background: rgba(0, 122, 255, 0.08);
}

@media (hover: hover) {
  .stat-item:hover {
    background: rgba(0, 122, 255, 0.06);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.1);
  }
}

.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  opacity: 0.8;
}

/* Recent Meals Section - iOS List Style */
.recent-meals {
  background: var(--card-background);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--separator-color);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.recent-meals h3 {
  margin: 0 0 16px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.calories-food-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calories-food-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--background-secondary);
  border-radius: 12px;
  border: 1px solid var(--separator-color);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
  min-height: 60px;
  -webkit-tap-highlight-color: transparent;
}

.calories-food-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}

.calories-food-item:active {
  transform: scale(0.98);
  background: rgba(0, 122, 255, 0.05);
}

@media (hover: hover) {
  .calories-food-item:hover {
    background: rgba(0, 122, 255, 0.03);
    border-color: rgba(0, 122, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.08);
  }
}

.calories-food-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.calories-food-emoji {
  font-size: 28px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 122, 255, 0.08);
  border-radius: 12px;
  flex-shrink: 0;
}

.calories-food-details {
  flex: 1;
  min-width: 0;
}

.calories-food-details h4 {
  margin: 0 0 3px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calories-food-details p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.8;
}

.calories-food-calories {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

/* iOS Mobile Responsive Design */
@media (max-width: 480px) {
  .sphere-container {
    padding: 20px 12px 16px 12px;
    margin-bottom: 16px;
    margin-left: 8px;
    margin-right: 8px;
    border-radius: 16px;
  }

  .sphere-wrapper {
    margin-bottom: 20px;
    padding: 12px 0;
  }

  .sphere {
    width: 160px;
    height: 160px;
    margin: 0 auto;
  }

  .sphere-inner {
    width: 130px;
    height: 130px;
  }

  .sphere-progress {
    width: 172px;
    height: 172px;
    top: -6px;
    left: -6px;
    mask: radial-gradient(circle, transparent 70px, black 76px);
    -webkit-mask: radial-gradient(circle, transparent 70px, black 76px);
  }

  .sphere-value {
    font-size: 24px;
    line-height: 1.2;
  }

  .sphere-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .sphere-goal {
    font-size: 13px;
  }

  .progress-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
  }

  .stat-item {
    padding: 14px 16px;
    min-height: 60px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .stat-value {
    font-size: 18px;
    margin-bottom: 0;
  }

  .stat-label {
    font-size: 11px;
    margin-left: 8px;
  }

  .goal-input-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .goal-input-container input {
    padding: 16px;
    font-size: 16px;
    text-align: center;
  }

  .goal-unit {
    text-align: center;
    padding-right: 0;
    font-size: 14px;
  }

  .btn-small {
    padding: 14px 20px !important;
    font-size: 16px !important;
    min-height: 48px !important;
    width: 100%;
  }

  .calories-food-item {
    padding: 12px;
    min-height: 64px;
  }

  .calories-food-emoji {
    width: 36px;
    height: 36px;
    font-size: 20px;
  }

  .calories-food-details h4 {
    font-size: 15px;
  }

  .calories-food-details p {
    font-size: 12px;
  }

  .calories-food-calories {
    font-size: 15px;
  }

  .recent-meals {
    padding: 16px;
    margin-left: 8px;
    margin-right: 8px;
  }

  .recent-meals h3 {
    font-size: 17px;
  }

  .calorie-goal-section {
    margin-left: 8px;
    margin-right: 8px;
    padding: 20px 16px;
  }

  .calories-header {
    margin-bottom: 12px;
  }

  .calories-header h2 {
    font-size: 24px;
  }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 375px) {
  .sphere-container {
    padding: 16px 8px 12px 8px;
    margin-left: 4px;
    margin-right: 4px;
  }

  .sphere {
    width: 140px;
    height: 140px;
  }

  .sphere-inner {
    width: 115px;
    height: 115px;
  }

  .sphere-progress {
    width: 152px;
    height: 152px;
    top: -6px;
    left: -6px;
    mask: radial-gradient(circle, transparent 62px, black 68px);
    -webkit-mask: radial-gradient(circle, transparent 62px, black 68px);
  }

  .sphere-value {
    font-size: 20px;
  }

  .sphere-label {
    font-size: 10px;
  }

  .sphere-goal {
    font-size: 12px;
  }

  .sphere-wrapper {
    padding: 12px 0;
    margin-bottom: 16px;
  }

  .stat-item {
    padding: 12px 14px;
    min-height: 56px;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-label {
    font-size: 10px;
  }

  .calorie-goal-section {
    padding: 16px 12px;
    margin-left: 4px;
    margin-right: 4px;
  }

  .recent-meals {
    padding: 14px;
    margin-left: 4px;
    margin-right: 4px;
  }

  .calories-header h2 {
    font-size: 22px;
  }

  /* Extra Small Navigation */
  .bottom-nav {
    padding: 4px 12px calc(4px + env(safe-area-inset-bottom));
  }

  .nav-container {
    border-radius: 18px;
    padding: 3px;
    gap: 1px;
  }

  .nav-btn {
    padding: 8px 10px 6px 10px;
    min-width: 55px;
    border-radius: 14px;
  }

  .nav-btn::before {
    border-radius: 12px;
  }

  .nav-icon {
    font-size: 16px;
    height: 18px;
    margin-bottom: 1px;
  }

  .nav-label {
    font-size: 9px;
  }
}

/* iOS-style Animations */
@keyframes sphereGlow {
  0% { box-shadow: 0 12px 36px rgba(0, 122, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04); }
  50% { box-shadow: 0 16px 44px rgba(0, 122, 255, 0.18), 0 6px 16px rgba(0, 0, 0, 0.06); }
  100% { box-shadow: 0 12px 36px rgba(0, 122, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.04); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.sphere.animate {
  animation: sphereGlow 2s ease-in-out infinite;
}

/* ==========================================================================
   Enhanced MFIT Styles - New Components
   ========================================================================== */

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.section-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  animation: iconPulse 2s ease-in-out infinite;
}

.section-icon-small {
  font-size: 1.2rem;
  margin-right: 8px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.1));
}

@keyframes iconPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Quick Add Section */
.quick-add-section {
  background: var(--card-background);
  padding: 24px;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 0.5px solid var(--separator-color);
}

.quick-add-section h3 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.quick-food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.quick-food-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: var(--fill-secondary);
  border: 1px solid var(--fill-tertiary);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  min-height: 80px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.quick-food-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  opacity: 0;
  transition: var(--transition);
}

.quick-food-btn:hover {
  background: var(--card-background);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--primary-color);
}

.quick-food-btn:hover::before {
  opacity: 1;
}

.quick-food-btn:active {
  transform: translateY(0);
  background: var(--primary-color);
  color: white;
}

.quick-food-btn .food-emoji {
  font-size: 2rem;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.quick-food-btn .food-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  letter-spacing: -0.01em;
}

.quick-food-btn:active .food-name {
  color: white;
}

/* Form Enhancements */
.form-header {
  margin-bottom: 24px;
  text-align: center;
}

.form-header h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.form-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 500;
}

/* Enhanced Input Groups */
.input-group label {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 16px;
  letter-spacing: -0.01em;
}

.label-icon {
  font-size: 1.1rem;
  margin-right: 8px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Enhanced Buttons */
.btn-large {
  padding: 20px 32px !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.btn-icon {
  font-size: 1.2rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Enhanced Summary Date */
.summary-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  margin-bottom: 24px;
  padding: 12px 20px;
  background: rgba(0, 122, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(0, 122, 255, 0.1);
}

.date-icon {
  font-size: 1.2rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Enhanced Summary Cards */
.summary-card {
  position: relative;
  overflow: hidden;
}

.card-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 1.5rem;
  opacity: 0.3;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.calories-card::before {
  background: linear-gradient(90deg, #FF6B35, #FF9F0A);
}

.weight-card::before {
  background: linear-gradient(90deg, #30D158, #28CD4F);
}

.items-card::before {
  background: linear-gradient(90deg, #007AFF, #5AC8FA);
}

/* Nutrition Overview */
.nutrition-overview {
  background: var(--card-background);
  padding: 24px;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 0.5px solid var(--separator-color);
}

.nutrition-overview h3 {
  margin: 0 0 20px 0;
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
}

.nutrition-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nutrition-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nutrition-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nutrition-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 15px;
}

.nutrition-value {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 15px;
}

.nutrition-bar {
  height: 8px;
  background: var(--fill-secondary);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.nutrition-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s ease-out;
  position: relative;
}

.nutrition-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

.protein-fill {
  background: linear-gradient(90deg, #FF6B35, #FF9F0A);
}

.carbs-fill {
  background: linear-gradient(90deg, #30D158, #28CD4F);
}

.fat-fill {
  background: linear-gradient(90deg, #007AFF, #5AC8FA);
}

/* History Enhancements */
.date-picker-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-background);
  padding: 8px 12px;
  border-radius: var(--border-radius);
  border: 1px solid var(--separator-color);
}

.date-picker-icon {
  font-size: 1.1rem;
  color: var(--text-secondary);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.date-input {
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 500;
}

.date-input:focus {
  outline: none;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-background);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-light);
  border: 0.5px solid var(--separator-color);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 1.8rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
  .input-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .quick-food-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .section-header {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .history-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .quick-food-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .quick-food-btn {
    min-height: 70px;
    padding: 12px 8px;
  }
  
  .quick-food-btn .food-emoji {
    font-size: 1.5rem;
    margin-bottom: 6px;
  }
  
  .quick-food-btn .food-name {
    font-size: 12px;
  }
  
  .section-icon {
    font-size: 2rem;
  }
  
  .btn-large {
    padding: 16px 24px !important;
    font-size: 16px !important;
  }
}

/* iOS-style tab content animations */
.tab-content {
  animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.tab-content.active {
  animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Navigation entrance animations */
.nav-container {
  animation: navSlideUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-btn {
  animation: navButtonFadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.nav-btn:nth-child(1) { animation-delay: 0.1s; }
.nav-btn:nth-child(2) { animation-delay: 0.15s; }
.nav-btn:nth-child(3) { animation-delay: 0.2s; }
.nav-btn:nth-child(4) { animation-delay: 0.25s; }

@keyframes navSlideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes navButtonFadeIn {
  from {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* iOS-style card entrance animations */
.sphere-container {
  animation: bounceIn 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-stats .stat-item {
  animation: slideInUp 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-stats .stat-item:nth-child(1) { animation-delay: 0.1s; }
.progress-stats .stat-item:nth-child(2) { animation-delay: 0.2s; }
.progress-stats .stat-item:nth-child(3) { animation-delay: 0.3s; }

.calories-food-item {
  animation: slideInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.calories-food-item:nth-child(1) { animation-delay: 0.1s; }
.calories-food-item:nth-child(2) { animation-delay: 0.15s; }
.calories-food-item:nth-child(3) { animation-delay: 0.2s; }
.calories-food-item:nth-child(4) { animation-delay: 0.25s; }
.calories-food-item:nth-child(5) { animation-delay: 0.3s; }

/* iOS-style focus states */
.goal-input-container input:focus {
  animation: pulse 0.3s ease-out;
}

/* Smooth transitions for all interactive elements */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* iOS-style safe area handling */
@supports (padding: max(0px)) {
  .main-content {
    padding-bottom: max(100px, env(safe-area-inset-bottom));
  }

  .bottom-nav {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .content-container {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .sphere-container {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  .sphere {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  .progress-stats {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Fix for iOS viewport units */
  .main-content {
    min-height: -webkit-fill-available;
  }
}

/* iOS device-specific breakpoints */
@media screen and (max-width: 428px) and (-webkit-min-device-pixel-ratio: 2) {
  /* iPhone 12 Pro Max, 13 Pro Max, 14 Plus */
  .sphere-container {
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media screen and (max-width: 414px) and (-webkit-min-device-pixel-ratio: 2) {
  /* iPhone 6/7/8 Plus, XR, 11 */
  .sphere-container {
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media screen and (max-width: 390px) and (-webkit-min-device-pixel-ratio: 3) {
  /* iPhone 12, 12 Pro, 13, 13 Pro, 14, 14 Pro */
  .sphere-container {
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media screen and (max-width: 375px) and (-webkit-min-device-pixel-ratio: 2) {
  /* iPhone 6/7/8, SE 2nd gen */
  .content-container {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media screen and (max-width: 320px) and (-webkit-min-device-pixel-ratio: 2) {
  /* iPhone SE 1st gen */
  .sphere-container {
    padding: 12px 6px 8px 6px;
    margin-left: 2px;
    margin-right: 2px;
  }

  .sphere {
    width: 120px;
    height: 120px;
  }

  .sphere-inner {
    width: 100px;
    height: 100px;
  }

  .sphere-value {
    font-size: 18px;
  }

  .content-container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Goal achievement effects */
.sphere.goal-reached {
  background: linear-gradient(135deg,
    rgba(48, 209, 88, 0.1) 0%,
    rgba(48, 209, 88, 0.05) 50%,
    rgba(48, 209, 88, 0.15) 100%);
  box-shadow:
    inset -10px -10px 20px rgba(48, 209, 88, 0.1),
    inset 10px 10px 20px rgba(255, 255, 255, 0.8),
    0 10px 30px rgba(48, 209, 88, 0.2);
}

.sphere.goal-reached .sphere-progress {
  background: conic-gradient(
    from 0deg,
    var(--secondary-color) 0deg,
    var(--secondary-color) 360deg
  );
}

.sphere.goal-reached .sphere-value {
  color: var(--secondary-color);
}

.sphere.goal-exceeded {
  background: linear-gradient(135deg,
    rgba(255, 149, 10, 0.1) 0%,
    rgba(255, 149, 10, 0.05) 50%,
    rgba(255, 149, 10, 0.15) 100%);
}

.sphere.goal-exceeded .sphere-progress {
  background: conic-gradient(
    from 0deg,
    var(--warning-color) 0deg,
    var(--warning-color) 360deg
  );
}

.sphere.goal-exceeded .sphere-value {
  color: var(--warning-color);
}

