/* CSS Stylesheet - Weight Loss Tracker */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=PingFang+SC:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f4f6f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f9fafb;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(16, 185, 129, 0.08);
  
  --primary: #10b981;
  --primary-hover: #059669;
  --primary-glow: rgba(16, 185, 129, 0.1);
  
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.08);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.08);
  
  --danger: #ef4444;
  --warning: #f59e0b;
  
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;
  
  --font-sans: 'Outfit', 'PingFang SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.08);
  
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  height: 100vh;
  display: flex;
}

/* App Layout */
.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* Desktop Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: transparent;
  border: none;
  text-align: left;
  font-size: 16px;
}

.nav-item:hover {
  color: var(--text-main);
  background-color: rgba(0, 0, 0, 0.04);
}

.nav-item.active {
  color: var(--text-inverse);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Mobile Bottom Navigation */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding-bottom: calc(8px + var(--safe-area-bottom));
  padding-top: 8px;
  z-index: 100;
  justify-content: space-around;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: none;
  border: none;
  flex: 1;
}

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

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Page Section (Hidden by default unless active) */
.page-section {
  display: none;
  flex-direction: column;
  gap: 28px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-section.active {
  display: flex;
}

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

/* Header & Profile Stats */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-title h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-title p {
  color: var(--text-muted);
  font-size: 14px;
}

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

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title .icon-badge {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dashboard Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
}

/* Target Progress Circle Card */
.progress-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  flex-wrap: wrap;
}

.circle-progress-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
}

.circle-progress-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.05);
  stroke-width: 12;
}

.circle-val {
  fill: none;
  stroke: url(#progressGrad);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 439.8; /* 2 * PI * r (r=70) */
  stroke-dashoffset: 439.8;
  transition: stroke-dashoffset 1s ease-in-out;
}

.circle-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.circle-number {
  font-size: 28px;
  font-weight: 700;
}

.circle-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-stats-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.stat-label {
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.stat-value.highlight {
  color: var(--primary);
}

/* Weight Tracker Card */
.weight-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.weight-sub-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.weight-sub-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.weight-sub-box.morning::before {
  background: var(--accent-blue);
}

.weight-sub-box.bedtime::before {
  background: var(--accent-purple);
}

.weight-box-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.weight-box-value {
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.weight-box-value span {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.weight-box-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  padding: 4px 0;
}

.weight-box-input:focus {
  outline: none;
  border-bottom-color: var(--primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--text-inverse);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
}

.btn-icon {
  padding: 8px;
  border-radius: 10px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

/* Modal Styling */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
}

.close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

label {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  height: 48px;
  box-sizing: border-box;
}

textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

select option {
  color: #111827 !important;
  background-color: #ffffff !important;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Dynamic Strategy Widget (一页式总结) */
.strategy-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.06), rgba(59, 130, 246, 0.06));
  border-left: 4px solid var(--primary);
}

.strategy-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strategy-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
}

.strategy-bullet {
  font-size: 16px;
}

.strategy-text p {
  color: var(--text-main);
}

.strategy-text span {
  color: var(--text-muted);
  font-size: 12px;
}

/* Meal Logger CSS */
.logger-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
}

.meal-tabs-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.meal-tab {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.meal-tab.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.parsed-food-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.parsed-food-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  animation: fadeIn 0.3s ease;
}

.food-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.food-name {
  font-size: 15px;
  font-weight: 600;
}

.food-details {
  font-size: 12px;
  color: var(--text-muted);
}

.food-cal-edit {
  display: flex;
  align-items: center;
  gap: 12px;
}

.food-weight-input {
  width: 60px;
  padding: 4px 8px;
  font-size: 13px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
}

.food-cal-display {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  min-width: 60px;
  text-align: right;
}

.delete-food-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.delete-food-btn:hover {
  opacity: 1;
}

/* Smart Recommendations Panel */
.snack-rec-panel {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(16, 185, 129, 0.05));
}

.rec-group {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.rec-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rec-group-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rec-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
}

.rec-food-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-cal-text {
  font-weight: 600;
  color: var(--warning);
}

/* Recipes Section */
.recipe-day-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 8px 16px;
}

.recipe-cards-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.recipe-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.recipe-meal-name {
  font-size: 16px;
  font-weight: 700;
}

.recipe-calories {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.recipe-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  flex-grow: 1;
}

.recipe-ingredient {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.recipe-ingredient span:first-child {
  color: var(--text-main);
}

.recipe-steps {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
  border-radius: 10px;
  padding: 12px;
  border-left: 2px solid var(--accent-blue);
  line-height: 1.6;
}

/* SVG Chart styling */
.chart-container {
  position: relative;
  width: 100%;
  height: 220px;
  margin-top: 16px;
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-path-morning {
  stroke: var(--accent-blue);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0px 4px 6px rgba(59, 130, 246, 0.2));
}

.chart-path-bedtime {
  stroke: var(--accent-purple);
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0px 4px 6px rgba(139, 92, 246, 0.2));
}

.chart-grid-line {
  stroke: rgba(0, 0, 0, 0.05);
  stroke-dasharray: 4;
}

.chart-axis-line {
  stroke: rgba(0, 0, 0, 0.1);
}

.chart-dot-morning {
  fill: var(--accent-blue);
  stroke: var(--bg-secondary);
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.2s;
}

.chart-dot-bedtime {
  fill: var(--accent-purple);
  stroke: var(--bg-secondary);
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.2s;
}

.chart-dot-morning:hover,
.chart-dot-bedtime:hover {
  r: 7;
}

.chart-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-sans);
}

.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  font-size: 12px;
  margin-top: 10px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.morning { background: var(--accent-blue); }
.legend-color.bedtime { background: var(--accent-purple); }

/* Quick Action Floater (for Mobile standard look) */
.fab {
  position: fixed;
  bottom: calc(76px + var(--safe-area-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  border: none;
  cursor: pointer;
  z-index: 99;
}

.fab svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* History logs inside page */
.log-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.log-item-row:last-child {
  border-bottom: none;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .recipe-cards-container {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 850px) {
  .summary-grid, .logger-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  .sidebar {
    display: none;
  }
  
  .mobile-nav {
    display: flex;
  }
  
  .main-content {
    padding: 20px 16px calc(90px + var(--safe-area-bottom)) 16px;
  }
  
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .fab {
    display: flex;
  }
}

/* Milestone & Excel Table Styles */
.sheet-stage-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
}

.sheet-stage-card:hover {
  transform: translateY(-2px);
}

.sheet-stage-card.starting {
  border-left: 4px solid var(--text-muted);
}

.sheet-stage-card.completed {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, var(--bg-card), rgba(16, 185, 129, 0.04));
}

.sheet-stage-card.in-progress {
  border-left: 4px solid var(--warning);
}

#sheetTableWrapper {
  margin-top: 10px;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 900px;
}

.sheet-table th, 
.sheet-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  font-size: 13px;
  vertical-align: middle;
}

.sheet-table th:last-child, 
.sheet-table td:last-child {
  border-right: none;
}

.sheet-table th {
  background: #f3f4f6;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-top: 1px solid var(--border-color);
}

.sheet-row {
  cursor: pointer;
  transition: background-color 0.2s;
}

.sheet-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.sheet-row.selected-row {
  background: rgba(16, 185, 129, 0.08);
}

.sheet-row.selected-row td:first-child {
  box-shadow: inset 4px 0 0 var(--primary);
}

.meal-cell, 
.text-cell {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.sheet-row:hover .meal-cell,
.sheet-row:hover .text-cell {
  color: var(--text-main);
}

.sheet-cell-merged {
  text-align: center;
  background: rgba(0, 0, 0, 0.01);
  font-weight: 700;
  color: var(--text-main);
  border-left: 1px solid var(--border-color);
}

.sheet-cell-merged.week-avg {
  color: var(--primary);
}

.sheet-cell-merged.week-pct {
  font-size: 14px;
}

.text-success {
  color: var(--primary) !important;
}

.text-danger {
  color: var(--danger) !important;
}

/* Auth Screen Styles */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-primary);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(10px);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  width: 100%;
  max-width: 400px;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  animation: modalScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-logo img {
  width: 64px;
  height: 64px;
}

.auth-logo h2 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-tabs {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab-btn.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 10px var(--primary-glow);
}

/* Disable native number input spin buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}
input[type=number] {
  -moz-appearance: textfield !important;
  appearance: none !important;
}

/* Stepper Custom Controls Styling */
.stepper-container {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
}

.stepper-container input {
  border: none !important;
  background: transparent !important;
  text-align: center;
  padding: 12px 4px !important;
  flex: 1;
  width: 40px;
  box-shadow: none !important;
  color: var(--text-main) !important;
  font-weight: 600;
}

.stepper-btn {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: var(--text-main) !important;
  width: 44px;
  height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: opacity 0.2s, transform 0.1s;
}

.stepper-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  pointer-events: none;
}

.stepper-btn:hover {
  opacity: 0.7;
  transform: scale(1.1);
}

.stepper-btn:active {
  transform: scale(0.9);
}

/* AI Connection Test Modal Styles */
.test-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.test-step.pending {
  color: var(--text-muted);
  opacity: 0.6;
}
.test-step.running {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.3);
  font-weight: 500;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.1);
}
.test-step.success {
  color: var(--primary);
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.3);
}
.test-step.failed {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.3);
  font-weight: 500;
}
.test-step-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: testSpin 0.8s linear infinite;
  display: inline-block;
}
@keyframes testSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Custom Checkboxes styling */
.meal-selectors-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.custom-checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  user-select: none;
}

.custom-checkbox-container:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
}

.custom-checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.custom-checkbox-container input[type="checkbox"]:checked + .custom-checkbox-label {
  color: var(--primary);
  font-weight: 600;
}

/* Alert warning card style */
.alert-card {
  padding: 16px;
  border-radius: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.warning-alert {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--warning);
}

/* Fasting Window Card styling */
.fasting-window-card {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 20px;
  padding: 20px;
}

.recipe-info-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px;
}

/* Cuisine Switcher & Pills */
.cuisine-switch-container {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cuisine-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.cuisine-pill:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-main);
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.cuisine-pill.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.cuisine-pill:active {
  transform: translateY(1px);
}

/* Community / Post Styles */
.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.post-user-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-username {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.post-badge.me {
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}

.post-badge.coach {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.post-badge.expert {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.post-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.post-content {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.post-attachment-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.post-attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.post-attachment-item strong {
  color: var(--text-main);
}

.post-actions {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 0;
  margin-bottom: 12px;
}

.post-action-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
  font-size: inherit;
  transition: color 0.2s;
}

.post-action-btn:hover {
  color: var(--primary);
}

.post-action-btn.liked {
  color: #ef4444;
}

.post-comments-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  padding: 12px;
}

.post-comment-item {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-main);
}

.post-comment-user {
  font-weight: 600;
  color: var(--text-main);
  margin-right: 4px;
}

.post-comment-user-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 4px;
}

.post-comment-user-badge.coach {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue);
}

.post-comment-user-badge.expert {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.post-comment-text {
  color: var(--text-muted);
}
