/* ==========================================================================
   KUHFSDIÄT DESIGN SYSTEM & CORE STYLES (v1.8.0)
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  
  --accent-primary: #10b981;
  --accent-hover: #059669;
  --accent-light: rgba(16, 185, 129, 0.15);
  
  --color-weight: #38bdf8;
  --color-calories: #f87171;
  --color-burned: #fb923c;
  --color-activity: #e879f9;
  --color-tdee: #38bdf8;
  --color-net: #34d399;
  --color-protein: #a78bfa;
  --color-carbs: #facc15;
  --color-fat: #f472b6;

  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
  
  --transition-fast: 0.2s ease;
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
}

/* App Container (Mobile-First 480px Max-Width) */
.app-container {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  padding-bottom: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: var(--glass-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.6rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.user-greeting {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Main Content */
.main-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards & Glassmorphism */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  border: var(--glass-border);
  box-shadow: var(--shadow-card);
}

/* Alert Banner */
.alert-banner {
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 16px;
  transition: var(--transition-fast);
}

.alert-banner.success {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.alert-banner.error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.verification-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
  padding: 10px 16px;
  margin: 0 16px 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

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

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  padding-right: 45px;
}

.input-with-unit .unit {
  position: absolute;
  right: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: var(--glass-border);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

.btn-full {
  width: 100%;
}

.text-button {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Auth Section Tabs */
.tab-header {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px;
  border-radius: var(--border-radius-md);
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Navigation Grid */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.nav-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.nav-card .nav-icon {
  font-size: 1.2rem;
}

.nav-card .nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
}

.nav-card.active {
  background: var(--accent-light);
  border-color: var(--accent-primary);
}

.nav-card.active .nav-label {
  color: var(--accent-primary);
}

/* Panels */
.panel-header {
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

.panel-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Logs List */
.recent-section {
  margin-top: 24px;
}

.recent-section h3 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.5);
  border: var(--glass-border);
  padding: 12px 14px;
  border-radius: var(--border-radius-md);
}

.log-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-value {
  font-weight: 700;
  font-size: 1rem;
}

.log-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.log-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.8;
}

.btn-delete-log {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition-fast);
  padding: 4px;
}

.btn-delete-log:hover {
  opacity: 1.0;
  transform: scale(1.15);
}

/* AI Buttons */
.ai-buttons-group {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.btn-ai {
  flex: 1;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: white;
  border: none;
  padding: 10px;
  font-size: 0.85rem;
}

.btn-ai-vision {
  background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
}

.btn-recipe {
  flex: 1;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border: none;
  padding: 10px;
  font-size: 0.85rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-content {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Image Upload Preview */
.image-upload-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.file-input-hidden {
  display: none;
}

.image-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.file-label-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.image-preview-container {
  width: 100%;
  height: 220px;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-bottom: 14px;
  border: var(--glass-border);
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Analytics & Chart */
.period-selector {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  padding: 4px;
  border-radius: var(--border-radius-md);
  margin-bottom: 14px;
}

.period-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
}

.period-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.metrics-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.chip {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: var(--glass-border);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip input {
  display: none;
}

.chip.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.chart-wrapper {
  height: 250px;
  position: relative;
  margin-bottom: 16px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.kpi-card {
  background: rgba(15, 23, 42, 0.5);
  border: var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.kpi-icon {
  font-size: 1.4rem;
}

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1rem;
  font-weight: 700;
}

.ai-feedback-box {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--border-radius-md);
  padding: 14px;
  margin-top: 14px;
}

.ai-feedback-header {
  font-weight: 700;
  color: #a78bfa;
  margin-bottom: 8px;
}

.ai-feedback-content {
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-line;
}

/* ==========================================================================
   KALENDER WIDGET & TAGES-DETAILS (NEU in v1.8.0)
   ========================================================================== */

.calendar-section {
  margin-top: 24px;
  border-top: var(--glass-border);
  padding-top: 20px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.calendar-nav-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius-sm);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: var(--transition-fast);
}

.calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.1);
}

.calendar-day-cell.other-month {
  opacity: 0.3;
}

.calendar-day-cell.today {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 700;
}

.calendar-day-cell.selected {
  background: var(--accent-primary) !important;
  color: white !important;
  font-weight: 700;
}

.day-dot {
  width: 4px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: 50%;
  position: absolute;
  bottom: 3px;
}

/* Day Summary Cards Container */
.day-summary-box {
  margin-top: 16px;
  background: rgba(15, 23, 42, 0.6);
  border: var(--glass-border);
  border-radius: var(--border-radius-md);
  padding: 14px;
}

.day-summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.day-metric-card {
  background: rgba(255, 255, 255, 0.04);
  border: var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.day-metric-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.dm-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dm-val {
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 2px;
}

/* Breakdown Modal List */
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.breakdown-item {
  background: rgba(15, 23, 42, 0.6);
  border: var(--glass-border);
  border-radius: var(--border-radius-sm);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
}
