/* style.css - Premium Glassmorphism Design-System */

:root {
  /* Farbpalette */
  --bg-gradient-start: #09090e;
  --bg-gradient-end: #141324;
  
  --glass-bg: rgba(22, 21, 39, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #4b5563;
  
  --primary: #8b5cf6;
  --primary-glow: rgba(139, 92, 246, 0.4);
  --primary-dark: #7c3aed;
  
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.3);
  
  --protein: #f59e0b; /* Amber */
  --protein-glow: rgba(245, 158, 11, 0.3);
  
  --carbs: #3b82f6; /* Blue */
  --carbs-glow: rgba(59, 130, 246, 0.3);
  
  --fat: #f43f5e; /* Rose */
  --fat-glow: rgba(244, 63, 94, 0.3);

  --danger: #ef4444;
  --warning: #f59e0b;
  
  --font-title: 'Outfit', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
}

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

body {
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-gradient-start) 70%, var(--bg-gradient-end) 100%);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

/* Scrollbar-Design */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Layout Container */
.app-container {
  width: 100%;
  max-width: 960px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 85px; /* Platz für die Bottom-Navigation */
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(9, 9, 14, 0.7);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.current-date-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-lg);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.current-date-badge:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.current-date-badge svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

/* Main Content Area */
.app-main {
  flex: 1;
  padding: 1.5rem;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.glass-card:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.card-header h2 {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 var(--primary-glow);
  opacity: 0.95;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: rgba(139, 92, 246, 0.1);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-xs {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  border-radius: var(--border-radius-sm);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ==================== DASHBOARD TAB ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .calorie-ring-card {
    grid-column: span 1;
  }
}

/* Kalorien Ring */
.calorie-ring-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.calorie-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-svg {
  transform: rotate(-90deg);
  position: absolute;
  top: 0;
  left: 0;
}

.progress-ring-bar {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 0 6px var(--emerald-glow));
}

.calorie-ring-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.calories-left-num {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.calories-left-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: -2px;
}

.calorie-stats-row {
  display: flex;
  width: 100%;
  justify-content: space-around;
  margin-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.stat-val {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.stat-divider {
  width: 1px;
  background-color: rgba(255, 255, 255, 0.08);
}

.text-emerald {
  color: var(--emerald);
  text-shadow: 0 0 8px var(--emerald-glow);
}

/* Health Score */
.health-score-card {
  display: flex;
  flex-direction: column;
}

.health-score-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

@media (min-width: 500px) {
  .health-score-body {
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    width: 100%;
  }
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number-wrapper {
  display: flex;
  align-items: baseline;
  background: linear-gradient(135deg, #10b981 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.2));
}

.score-number {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 800;
}

.score-percent {
  font-size: 1.5rem;
  font-weight: 700;
  margin-left: 1px;
}

.score-rating {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--emerald);
  margin-top: 0.25rem;
}

.score-factors {
  width: 100%;
  max-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.factor-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.factor-row span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.factor-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  width: 100%;
  overflow: hidden;
}

.factor-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--emerald) 100%);
  border-radius: 2px;
  transition: width 0.8s ease;
}

.health-details-panel {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Makronährstoffe */
.macros-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.macro-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.macro-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.macro-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.bg-protein { background-color: var(--protein); }
.bg-carbs { background-color: var(--carbs); }
.bg-fat { background-color: var(--fat); }

.macro-values {
  color: var(--text-muted);
}

.macro-values strong {
  color: var(--text-main);
}

.progress-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  width: 100%;
}

.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-protein-glow {
  background: var(--protein);
  box-shadow: 0 0 8px var(--protein-glow);
}
.bg-carbs-glow {
  background: var(--carbs);
  box-shadow: 0 0 8px var(--carbs-glow);
}
.bg-fat-glow {
  background: var(--fat);
  box-shadow: 0 0 8px var(--fat-glow);
}

/* Wasser Tracker */
.water-tracker-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

@media (min-width: 500px) {
  .water-tracker-body {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
  }
}

.water-progress-wave-container {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(59, 130, 246, 0.3);
  overflow: hidden;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.water-wave-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.02);
}

.water-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.7) 0%, rgba(29, 78, 216, 0.9) 100%);
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 10px rgba(59, 130, 246, 0.5);
}

.water-display-text {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.water-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 160px;
}

/* ==================== TRACK/ERFASSUNG TAB ==================== */
.tab-sub-nav {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}

.sub-nav-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.65rem 0.5rem;
  border-radius: calc(var(--border-radius-md) - 4px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.sub-nav-btn svg {
  width: 14px;
  height: 14px;
}

.sub-nav-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.track-panel {
  display: none;
}

.track-panel.active {
  display: block;
}

/* Photo Scan Card */
.photo-scan-card {
  padding: 1.25rem;
}

.photo-upload-zone {
  position: relative;
  width: 100%;
  min-height: 280px;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.01);
  overflow: hidden;
  margin-bottom: 1rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.photo-upload-zone:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.02);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2rem;
  pointer-events: none;
}

.pulsing-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  animation: pulse 2.5s infinite;
}

.pulsing-circle svg {
  color: var(--primary);
  width: 24px;
  height: 24px;
}

.upload-prompt h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.upload-prompt p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.upload-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Scanning Line Animation */
.scanner-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, transparent, var(--primary), var(--emerald), var(--primary), transparent);
  box-shadow: 0 0 12px 2px var(--primary);
  animation: scan 2s linear infinite;
  z-index: 20;
}

.delete-photo-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(239, 68, 68, 0.8);
  border-color: rgba(239, 68, 68, 0.4);
  z-index: 30;
}

.delete-photo-btn:hover {
  background: rgb(239, 68, 68);
}

.api-status-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--border-radius-md);
  font-size: 0.75rem;
  line-height: 1.4;
  margin-bottom: 1rem;
}

.api-status-banner.warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbd38d;
}

.api-status-banner.warning svg {
  color: var(--warning);
  flex-shrink: 0;
}

.api-status-banner.error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #feb2b2;
}

.api-status-banner.error svg {
  color: var(--danger);
  flex-shrink: 0;
}

.demo-meals-section {
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1.25rem;
}

.demo-meals-section h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.demo-meals-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.demo-meal-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.demo-meal-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.demo-meal-card img {
  width: 100%;
  height: 60px;
  object-fit: cover;
}

.demo-meal-info {
  padding: 0.4rem;
}

.demo-meal-info h5 {
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-meal-info span {
  font-size: 0.6rem;
  color: var(--text-muted);
}

/* Forms general */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input, 
.form-group select, 
.form-group textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 0.65rem 0.85rem;
  color: white;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all 0.2s ease;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.04);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.15);
  outline: none;
}

/* Sichtbarer Fokus-Indikator für Tastaturnavigation auf interaktiven Elementen */
button:focus-visible,
a:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-row {
  display: flex;
  gap: 0.75rem;
}

.form-row .col {
  flex: 1;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-dark);
  line-height: 1.3;
}

.input-with-button {
  display: flex;
  gap: 0.5rem;
}

.input-with-button input {
  flex: 1;
}

.input-with-button button {
  flex-shrink: 0;
  border-radius: var(--border-radius-sm);
}

/* ==================== PREVIEW OVERLAY / MODAL ==================== */
.preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 9, 14, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.preview-modal {
  width: 100%;
  max-width: 550px;
  max-height: 85vh;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
}

.preview-meta-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  padding: 0.75rem;
  border-radius: var(--border-radius-md);
}

.preview-meta-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.preview-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin: 0.5rem 0;
}

.preview-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-item-top-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.preview-item-top-row .field-name {
  flex: 1;
}

.preview-item-top-row .field-weight {
  width: 90px;
}

.preview-item-top-row .btn-delete-row {
  color: var(--danger);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 35px;
  align-self: flex-start;
  margin-top: 0;
}

.preview-item-bottom-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.preview-item-card input {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: white;
  border-radius: 6px;
  width: 100%;
}

.preview-item-card input:focus {
  border-color: var(--primary);
  outline: none;
}

.preview-item-card .input-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.preview-totals-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: var(--border-radius-md);
  margin: 1.25rem 0;
}

.total-calories-box {
  display: flex;
  flex-direction: column;
}

.total-cal-val {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--emerald);
  text-shadow: 0 0 8px var(--emerald-glow);
}

.total-cal-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.total-macros-row {
  display: flex;
  gap: 0.75rem;
}

.total-macro {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.total-macro .lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.total-macro .val {
  font-weight: 700;
  font-size: 0.85rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* ==================== JOURNAL TAB ==================== */
.journal-navigator-card {
  padding: 1.25rem;
}

.journal-date-selector {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.journal-date-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.journal-date-display h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
}

.hidden-datepicker {
  position: absolute;
  opacity: 0;
  width: 36px;
  height: 36px;
  right: 0;
  cursor: pointer;
  z-index: 10;
}

.journal-day-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.j-summary-item {
  display: flex;
  flex-direction: column;
}

.j-summary-item .lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.j-summary-item .val {
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.journal-categories-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.journal-category-group {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.j-cat-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.j-cat-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.j-cat-title svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.j-cat-kcal {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.j-cat-items {
  display: flex;
  flex-direction: column;
}

.j-empty-state {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-dark);
  font-size: 0.8rem;
}

.journal-item-card {
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background-color 0.2s ease;
}

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

.journal-item-card:hover {
  background: rgba(255, 255, 255, 0.02);
}

.j-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 70%;
}

.j-item-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.j-item-weight {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.j-item-macros {
  font-size: 0.7rem;
  color: var(--text-dark);
}

.j-item-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.j-item-kcal {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-delete-j-item {
  background: transparent;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-delete-j-item:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==================== TRENDS TAB ==================== */
.trends-range-selector {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 0.25rem;
  margin-bottom: 1.5rem;
  max-width: 250px;
}

.trends-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .trends-grid {
    grid-template-columns: 2fr 1fr;
  }
  .chart-card {
    grid-column: span 1;
  }
  .consistency-card {
    grid-column: span 2;
  }
}

.chart-container {
  width: 100%;
  height: 220px;
  position: relative;
  margin-top: 1rem;
}

.trend-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.line-target {
  background: rgba(255, 255, 255, 0.25);
  border-top: 2px dashed rgba(255, 255, 255, 0.4);
}

.line-actual {
  background: linear-gradient(90deg, var(--primary) 0%, var(--emerald) 100%);
}

.trend-stats-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  justify-content: center;
}

.t-stat-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 0.75rem;
}

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

.t-stat-row .lbl {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.t-stat-row .val {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
}

/* Consistency / Heatmap */
.heatmap-container {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.4rem;
  margin-top: 1.25rem;
}

@media (min-width: 480px) {
  .heatmap-container {
    grid-template-columns: repeat(15, 1fr);
  }
}

.heatmap-cell {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.heatmap-cell:hover {
  transform: scale(1.15);
  z-index: 10;
}

.heatmap-cell.cell-empty { background: rgba(255, 255, 255, 0.05); }
.heatmap-cell.cell-low { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.2); }
.heatmap-cell.cell-mid { background: rgba(16, 185, 129, 0.45); border-color: rgba(16, 185, 129, 0.5); }
.heatmap-cell.cell-high { background: rgba(16, 185, 129, 0.8); border-color: rgba(16, 185, 129, 1); box-shadow: 0 0 6px var(--emerald-glow); }

.heatmap-cell .tooltip {
  visibility: hidden;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  white-space: nowrap;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.heatmap-cell:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.heatmap-legend {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.7rem;
  color: var(--text-dark);
}

.legend-cells {
  display: flex;
  gap: 0.25rem;
}

.legend-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-cell.cell-empty { background: rgba(255, 255, 255, 0.05); }
.legend-cell.cell-low { background: rgba(16, 185, 129, 0.2); }
.legend-cell.cell-mid { background: rgba(16, 185, 129, 0.5); }
.legend-cell.cell-high { background: rgba(16, 185, 129, 0.8); }

/* ==================== EINSTELLUNGEN TAB ==================== */
.settings-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-macro-calculation {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1rem 0;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.admin-card {
  border-color: rgba(239, 68, 68, 0.15);
}

.settings-admin-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 500px) {
  .settings-admin-row {
    flex-direction: row;
  }
  .settings-admin-row button {
    flex: 1;
  }
}

/* ==================== BOTTOM NAV BAR ==================== */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 960px;
  height: 70px;
  background: rgba(13, 12, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding: 0 0.5rem;
}

.nav-item {
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

.nav-item.active {
  color: var(--primary);
  filter: drop-shadow(0 0 4px var(--primary-glow));
}

.nav-item.active svg {
  transform: translateY(-4px) scale(1.15);
}

/* ==================== PAGE LOGIC STUFF ==================== */
.tab-content {
  display: none;
  animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(139, 92, 246, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
  }
}

@keyframes scan {
  0% {
    top: 0%;
  }
  50% {
    top: 98%;
  }
  100% {
    top: 0%;
  }
}

/* Responsive Vollbild-Modal auf Mobilgeräten */
@media (max-width: 576px) {
  .preview-overlay {
    padding: 0;
  }
  
  .preview-modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    border: none;
    margin: 0;
    padding: 1.25rem;
  }

  .preview-items-list {
    flex: 1;
    max-height: none;
  }
}

/* ==================== AUTH OVERLAY ==================== */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1e1b4b 0%, var(--bg-gradient-start) 70%, var(--bg-gradient-end) 100%);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 40px var(--glass-shadow);
  padding: 2rem;
  border-radius: var(--border-radius-lg);
  display: flex;
  flex-direction: column;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-logo .logo-text {
  font-family: var(--font-title);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-logo .logo-icon {
  display: flex;
  align-items: center;
}

.auth-logo .logo-icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

#auth-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}

#auth-subtitle {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-toggle-wrapper {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity 0.2s;
}

.btn-link:hover {
  text-decoration: underline;
  opacity: 0.8;
}


