/*
 * Nutrition Pro - Custom Styles
 * Mobile-first premium design
 */

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 16px 20px;
  display: flex;
  justify-content: flex-end;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: var(--bg-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
}

.icon-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow);
}

.add-btn {
  background: var(--primary-color);
  color: white;
  font-size: 24px;
  font-weight: 300;
}

/* Main Content */
.site-main {
  padding-top: 80px;
  min-height: 100vh;
}

/* Date Selector */
.date-selector {
  display: flex;
  gap: 12px;
  margin: 24px 0;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}

.date-item {
  min-width: 70px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

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

.date-item.active {
  background: var(--primary-color);
  color: white;
}

.date-item .month {
  display: block;
  font-size: 14px;
  opacity: 0.8;
}

.date-item .day {
  display: block;
  font-size: 24px;
  font-weight: 700;
  margin-top: 4px;
}

/* Meal Tabs */
.meal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 10px 20px;
  background: var(--bg-card);
  border: none;
  border-radius: 20px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  min-height: 44px;
}

.tab:hover {
  background: var(--bg-light);
}

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

/* Meal Cards */
.meal-card, .meal-card-detailed {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.meal-card:active {
  transform: scale(0.98);
}

.meal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.meal-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.meal-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-light);
}

.meal-info h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.calories {
  font-size: 14px;
  color: var(--text-light);
  margin: 4px 0 0 0;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  min-width: 44px;
  min-height: 44px;
}

/* Macro Stats */
.macro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.macro {
  text-align: center;
}

.macro .bar {
  height: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.macro .bar.protein {
  background: linear-gradient(90deg, #6BCF8E 0%, #4CAF50 100%);
}

.macro .bar.carbs {
  background: linear-gradient(90deg, #FFD93D 0%, #FFC107 100%);
}

.macro .bar.fat {
  background: linear-gradient(90deg, #B39DDB 0%, #9575CD 100%);
}

.macro span {
  display: block;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.macro label {
  display: block;
  font-size: 12px;
  color: var(--text-light);
}

/* Profile Selector */
.profile-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}

.profile-btn {
  padding: 16px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 80px;
}

.profile-btn span:first-child {
  display: block;
  font-size: 32px;
  margin-bottom: 8px;
}

.profile-btn span:nth-child(2) {
  display: block;
  font-weight: 700;
  font-size: 16px;
}

.profile-btn small {
  display: block;
  color: var(--text-light);
  font-size: 12px;
  margin-top: 4px;
}

.profile-btn.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(255, 140, 66, 0.1);
}

/* Days Swiper */
.days-swiper {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}

.day-tab {
  padding: 10px 20px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 20px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  min-height: 44px;
}

.day-tab:hover {
  background: var(--bg-light);
}

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

/* Day Summary */
.day-summary {
  margin-bottom: 24px;
}

.day-summary h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

.calories-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cal-box {
  background: linear-gradient(135deg, var(--primary-color) 0%, #ff6b42 100%);
  color: white;
  padding: 20px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  gap: 12px;
}

.cal-box:nth-child(2) {
  background: linear-gradient(135deg, var(--secondary-color) 0%, #4caf50 100%);
}

.cal-box .icon {
  font-size: 32px;
}

.cal-box strong {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.cal-box small {
  display: block;
  font-size: 12px;
  opacity: 0.9;
}

/* Meal Items */
.meal-items {
  list-style: none;
  margin: 16px 0 0 0;
}

.meal-items li {
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-light);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.meal-items li:last-child {
  border-bottom: none;
}

.food-emoji {
  flex-shrink: 0;
}

.item-name {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.item-portions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.portion-f, .portion-h {
  padding: 4px 12px;
  background: var(--bg-light);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-dark);
}

.portion-h {
  background: #e3f2fd;
  color: #1976d2;
}

.category-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--primary-color);
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Shopping List */
.summary-box {
  background: linear-gradient(135deg, var(--primary-color) 0%, #ff6b42 100%);
  color: white;
  padding: 24px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.summary-item .label {
  display: block;
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.summary-item .value {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.export-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-block {
  width: 100%;
}

.shopping-category {
  margin-bottom: 32px;
}

.shopping-category h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text-dark);
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 8px;
}

.shopping-items {
  list-style: none;
}

.shopping-item {
  margin-bottom: 8px;
}

.shopping-item label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 56px;
}

.shopping-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.shopping-item input[type="checkbox"]:checked + label {
  opacity: 0.5;
  text-decoration: line-through;
}

.item-name {
  flex: 1;
  font-weight: 600;
}

.item-qty {
  color: var(--text-light);
  font-size: 14px;
}

.item-price {
  font-weight: 700;
  color: var(--primary-color);
}

/* Settings */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text-dark);
}

.settings-group {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-light);
}

.setting-item:last-child {
  border-bottom: none;
}

.setting-item label {
  flex: 1;
  font-weight: 600;
}

.setting-input, .setting-select {
  padding: 8px 12px;
  border: 1px solid var(--bg-light);
  border-radius: 8px;
  font-size: 14px;
  min-width: 100px;
  min-height: 44px;
}

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

.unit {
  color: var(--text-light);
  font-weight: 700;
}

/* Bottom Navigation */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.3s ease;
  min-width: 80px;
  min-height: 56px;
  justify-content: center;
}

.nav-item:hover {
  color: var(--primary-color);
}

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

.nav-item svg {
  width: 24px;
  height: 24px;
}

.nav-item span {
  font-size: 12px;
  font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card, .meal-card, .meal-card-detailed {
  animation: fadeIn 0.3s ease;
}

/* Responsive Design */
@media (min-width: 768px) {
  .mobile-container {
    max-width: 768px;
  }

  .meal-tabs, .days-swiper {
    justify-content: center;
  }

  .macro-stats {
    gap: 20px;
  }
}

@media (min-width: 1024px) {
  .mobile-container {
    max-width: 1024px;
  }

  .bottom-nav {
    display: none;
  }

  .site-main {
    padding-bottom: 40px;
  }
}

/* Touch Optimization */
@media (hover: none) and (pointer: coarse) {
  .btn, .tab, .nav-item, .icon-btn {
    min-height: 48px;
  }

  .shopping-item label {
    min-height: 60px;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-light: #1a1a1a;
    --bg-card: #2d2d2d;
    --text-dark: #ffffff;
    --text-light: #b0b0b0;
  }

  .site-header, .site-footer {
    background: #1a1a1a;
  }
}
