/* === CSS VARIABLES === */
:root {
  --primary: #2d5a3d;
  --primary-light: #3d7a4d;
  --primary-dark: #1d3a2d;
  --secondary: #d4a574;
  --accent: #c85a54;
  --success: #4a9d5f;
  --danger: #c85a54;

  --bg-main: #fdfbf7;
  --bg-card: #ffffff;
  --bg-hover: #f5f3ef;
  --border: #e8e5df;

  --text-primary: #2c2c2c;
  --text-secondary: #6b6b6b;
  --text-light: #9b9b9b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-display: "Crimson Pro", serif;
  --font-body: "DM Sans", sans-serif;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === GLOBAL RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* === LAYOUT === */
#app {
  display: flex;
  min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.logo h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  padding: 2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.user-switch {
  padding: 1.5rem;
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.user-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.user-btn:hover {
  border-color: var(--primary-light);
  background: var(--bg-hover);
}

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

.nav-menu {
  list-style: none;
  padding: 1rem;
  flex: 1;
}

.nav-menu li {
  margin-bottom: 0.5rem;
}

.nav-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.nav-menu a:hover {
  background: var(--bg-hover);
  color: var(--primary);
}

.nav-menu li.active a {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  box-shadow: var(--shadow-sm);
}

.nav-menu .icon {
  font-size: 1.5rem;
}

.sidebar-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-light);
}

.sidebar-footer strong {
  color: var(--primary);
}

/* === MAIN CONTENT === */
.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 2.5rem;
  max-width: 1400px;
}

.view {
  animation: fadeIn 0.4s ease-out;
}

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

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-dark);
}

/* === BUTTONS === */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-icon {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
}

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

.btn-success:hover {
  background: #3d8a4f;
  transform: translateY(-2px);
}

.btn-warning {
  background: #ff9800;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-warning:hover {
  background: #f57c00;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-icon {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

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

.btn-delete {
  padding: 0.25rem 0.75rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-delete:hover {
  background: #a83d37;
}

.btn-delete-small {
  padding: 0.25rem 0.5rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* === MEAL PLAN VIEW === */
.week-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.week-display {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary);
  min-width: 200px;
  text-align: center;
}

.meal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1rem;
}

.day-column {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.day-column:hover {
  box-shadow: var(--shadow-md);
}

.day-column h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.meal-slot {
  margin-bottom: 1rem;
}

.meal-type-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.meal-card {
  background: linear-gradient(135deg, var(--secondary) 0%, #e4b584 100%);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  position: relative;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.meal-card-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.meal-card p {
  padding-right: 1.5rem;
  font-size: 0.9rem;
  flex: 1;
}

.meal-indicators {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.meal-indicators .indicator {
  font-size: 1rem;
  opacity: 0.9;
}

.meal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.btn-favorite {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: white;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-favorite:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: white;
  transform: scale(1.1);
}

.btn-favorite.is-favorite {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  animation: pulse-favorite 0.5s;
}

@keyframes pulse-favorite {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

.meal-card .btn-delete {
  background: rgba(200, 90, 84, 0.9);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.meal-card .btn-delete:hover {
  background: var(--danger);
  transform: rotate(90deg) scale(1.1);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.detail-header h3 {
  margin: 0;
}

.detail-header .btn-delete-small {
  background: var(--danger);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.detail-header .btn-delete-small:hover {
  background: #a83d37;
  transform: translateY(-2px);
}

.meal-detail-section {
  margin: 1.5rem 0;
}

.upload-section {
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--bg-hover);
}

.upload-label-inline {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

.upload-label-inline:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

.url-input-section {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.url-input-section .input {
  flex: 1;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.meal-empty {
  padding: 0.75rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--text-light);
}

/* === RUNNING VIEW === */
/* === RUNNING VIEW === */
.view-mode-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  background: var(--bg-hover);
  padding: 0.5rem;
  border-radius: var(--radius-md);
}

.view-mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.view-mode-btn:hover {
  background: rgba(45, 90, 61, 0.1);
}

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

/* Week Overview */
.week-overview {
  margin-top: 2rem;
}

.week-stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.week-stat-item {
  background: var(--bg-hover);
  padding: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.week-stat-item .label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.week-stat-item .value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.week-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.week-day-card {
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-height: 120px;
}

.day-name {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.day-runs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mini-run-card {
  background: var(--secondary);
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mini-time {
  opacity: 0.8;
}

.no-run {
  text-align: center;
  color: var(--text-light);
  padding: 1rem;
}

/* Month Overview */
.month-overview {
  margin-top: 2rem;
}

.month-stats-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.month-stat-card {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 2.5rem;
}

.stat-info {
  flex: 1;
}

.stat-value-large {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 0.25rem;
}

/* KM Tracker */
.km-tracker {
  margin-top: 2rem;
}

.km-goal-section {
  background: var(--bg-hover);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.km-goal-section label {
  font-weight: 600;
  color: var(--text-primary);
}

.km-goal-input {
  max-width: 150px;
}

.km-progress-section {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  padding: 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.progress-bar {
  background: rgba(255, 255, 255, 0.3);
  height: 30px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  color: white;
  font-weight: 700;
}

.progress-info {
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.9;
}

.km-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.km-stat-box {
  background: var(--bg-hover);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.km-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.km-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stats {
  display: flex;
  gap: 1rem;
}

.stat-card {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
}

.stat-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.stopwatch-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 3rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  display: flex;
  justify-content: center;
}

.stopwatch {
  text-align: center;
}

.time-display {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 2rem;
  letter-spacing: 2px;
}

.stopwatch-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* === GPS TRACKING === */
.gps-status {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gps-indicator {
  font-size: 0.9rem;
  color: var(--success);
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.gps-error {
  font-size: 0.85rem;
  color: var(--danger);
  background: rgba(200, 90, 84, 0.1);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.selected-runners-display {
  text-align: center;
  margin: 1rem 0;
  padding: 0.75rem;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border-radius: 8px;
  font-weight: 600;
}

.runners-label {
  color: #1976d2;
  margin-right: 0.5rem;
}

.runners-names {
  color: #0d47a1;
}

.gps-live-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  border-radius: var(--radius-md);
}

.gps-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
}

.gps-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gps-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.gps-value {
  font-size: 1.25rem;
  color: white;
  font-weight: 700;
}

.map-button-container {
  margin-top: 1rem;
}

.btn-map {
  width: 100%;
  padding: 1rem;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-map:hover {
  background: #c49464;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* === MAP MODAL === */
.map-modal {
  max-width: 900px;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--danger);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.modal-close-btn:hover {
  transform: rotate(90deg) scale(1.1);
  background: #a83d37;
}

.map-stats-summary {
  display: flex;
  gap: 2rem;
  padding: 1rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.map-stat {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.map-stat .label {
  font-weight: 600;
  color: var(--text-secondary);
}

.map-stat .value {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
}

.map-hint {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.map-hint p {
  margin: 0.25rem 0;
}

/* Fix Leaflet in modal */
#run-map {
  z-index: 1;
}

.leaflet-container {
  font-family: var(--font-body);
}

/* === GPS STATS === */
.gps-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.gps-label {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gps-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* === MAP SECTION === */
.map-section {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.map-header h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--primary);
  margin: 0;
}

.run-map {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  z-index: 1;
}

.runs-list {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.runs-list h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.run-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.run-card:hover {
  background: var(--secondary);
  color: white;
  transform: translateX(5px);
}

.run-date {
  font-weight: 600;
  font-size: 1.05rem;
}

.run-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.run-stat {
  font-size: 0.9rem;
  font-weight: 500;
}

.run-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-view-map {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-view-map:hover {
  background: var(--primary-light);
}

.run-time {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  margin-right: 1rem;
}

/* === PROTEIN VIEW === */
/* === PROTEIN VIEW === */
.header-buttons {
  display: flex;
  gap: 0.5rem;
}

.body-weight-section {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  padding: 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  color: white;
}

.weight-input-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.weight-input-container label {
  font-weight: 600;
  font-size: 1.1rem;
}

.weight-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.weight-input {
  max-width: 100px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.weight-unit {
  font-size: 1.2rem;
  font-weight: 600;
}

.protein-recommendation {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
}

.rec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rec-label {
  font-size: 0.95rem;
}

.rec-value {
  font-size: 2rem;
  font-weight: 700;
}

.rec-hint {
  font-size: 0.85rem;
  opacity: 0.9;
  font-style: italic;
}

/* Daily Protein Tracking */
.daily-protein-tracking {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.daily-protein-tracking h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.protein-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.protein-stat-card {
  background: var(--bg-hover);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.protein-stat-card.highlight {
  background: linear-gradient(135deg, var(--accent) 0%, #f4a261 100%);
  color: white;
}

.protein-stat-card.negative {
  background: rgba(200, 90, 84, 0.1);
}

.protein-stat-card .stat-icon {
  font-size: 2rem;
}

.protein-stat-card .stat-content {
  flex: 1;
}

.protein-stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.protein-stat-card.highlight .stat-label {
  color: rgba(255, 255, 255, 0.9);
}

.protein-stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.protein-stat-card.highlight .stat-value {
  color: white;
}

.daily-progress-bar {
  height: 40px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.5rem;
  position: relative;
}

.progress-fill-protein {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  transition: width 0.5s ease;
}

.meal-protein-breakdown {
  background: var(--bg-hover);
  padding: 1.5rem;
  border-radius: var(--radius-sm);
}

.meal-protein-breakdown h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.meals-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.meal-protein-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: white;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
}

.meal-name {
  font-weight: 500;
}

.meal-protein {
  font-weight: 700;
  color: var(--accent);
}

.no-meals {
  text-align: center;
  color: var(--text-light);
  font-style: italic;
}

/* Weekly Protein Score */
.weekly-protein-score {
  background: white;
  padding: 2rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.weekly-protein-score h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.score-display {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.score-circle {
  position: relative;
  width: 200px;
  height: 200px;
}

.score-circle svg {
  transform: rotate(-90deg);
}

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

.score-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.score-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.score-info {
  flex: 1;
}

.score-info p {
  margin: 0.5rem 0;
}

.score-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.week-protein-details {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day-protein-bar {
  display: grid;
  grid-template-columns: 40px 1fr 60px;
  align-items: center;
  gap: 1rem;
}

.day-label {
  font-weight: 600;
  color: var(--text-primary);
}

.day-bar {
  height: 30px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.day-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
  transition: width 0.5s ease;
}

.day-value {
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

/* === PROTEIN MEAL MODAL === */
.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.input-group small.recipe-hint {
  display: block;
  margin-top: 0.5rem;
  color: var(--accent);
  font-style: italic;
}

.protein-total-preview {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
}

.protein-total-preview strong {
  font-size: 2rem;
  font-weight: 700;
}

/* === RECIPE GRID === */
.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.recipe-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.recipe-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.recipe-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-content {
  padding: 1.5rem;
}

.recipe-content h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.servings {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.protein-info {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  border-radius: var(--radius-sm);
}

.protein-total,
.protein-per-serving {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.protein-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
}

.protein-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recipe-content button {
  width: 100%;
  margin-top: 0.5rem;
}

/* === FAVORITES VIEW === */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.favorite-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.favorite-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.fav-category {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  font-weight: 600;
  text-transform: uppercase;
}

.add-favorite-section {
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.add-favorite-section h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* === FORM INPUTS === */
.input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  margin-bottom: 1rem;
  transition: var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.1);
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.input-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  font-style: italic;
}

.recipe-info-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
}

.recipe-info-section h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.file-input {
  display: none;
}

.upload-label {
  display: inline-block;
  padding: 0.875rem 1.5rem;
  background: var(--secondary);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  margin-bottom: 1rem;
}

.upload-label:hover {
  background: #c49464;
  transform: translateY(-2px);
}

.upload-label-small {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
  font-size: 0.9rem;
}

.upload-label-small:hover {
  background: var(--primary-light);
}

.image-preview {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.image-preview-small {
  max-width: 100%;
  max-height: 250px;
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.image-preview-container {
  margin-top: 1rem;
  position: relative;
}

.btn-remove-image {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-remove-image:hover {
  background: #a83d37;
}

/* === MODALS === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease-out;
}

.modal-large {
  max-width: 700px;
}

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

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--primary-dark);
  margin-bottom: 1.5rem;
}

.modal h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--primary);
  margin: 1.5rem 0 1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.modal-actions button {
  flex: 1;
}

/* === INGREDIENT ROWS === */
.ingredient-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ingredient-row .input {
  margin-bottom: 0;
}

.ingredient-row-enhanced {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.8fr 0.8fr 0.8fr auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.ingredient-row-enhanced .input {
  margin-bottom: 0;
}

.ingredient-headers {
  display: grid;
  grid-template-columns: 2fr 0.8fr 0.8fr 0.8fr 0.8fr auto;
  gap: 0.5rem;
  padding: 0.75rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
}

.ingredient-headers .header-name {
  text-align: left;
}

.protein-total {
  text-align: center;
  padding: 0.5rem;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-weight: 700;
}

.ingredients-info-box {
  background: linear-gradient(135deg, #e3f2fd 0%, #e8f5e9 100%);
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

.ingredients-info-box p {
  margin: 0;
  color: var(--text-primary);
}

.recipe-total-box {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  color: white;
}

.total-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.total-item:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 0.5rem;
}

.total-label {
  font-size: 1rem;
  font-weight: 500;
}

.total-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.total-value.highlight {
  font-size: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ingredient-help {
  background: #f5f5f5;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.ingredient-help h4 {
  margin: 0 0 1rem 0;
  color: var(--primary);
  font-size: 1.1rem;
}

.help-examples {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.help-example {
  background: white;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--secondary);
}

.help-example strong {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-size: 0.95rem;
}

.example-values {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}

.example-values span {
  font-size: 0.9rem;
}

.help-example code {
  background: var(--bg-hover);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-weight: 600;
  color: var(--accent);
}

.help-example small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-light);
  font-style: italic;
  line-height: 1.4;
}

.btn-add-ingredient {
  width: 100%;
  margin: 1rem 0;
}

/* === RECIPE DETAILS === */
.recipe-detail-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.ingredients-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.ingredients-table th,
.ingredients-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.ingredients-table th {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--primary);
}

.recipe-summary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-light) 100%
  );
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  color: white;
}

.recipe-summary p {
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

.recipe-summary strong {
  font-weight: 700;
}

/* === EMPTY STATES === */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-light);
  font-style: italic;
}

/* === MEAL DETAILS MODAL === */
.meal-detail-info {
  background: var(--bg-hover);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.meal-detail-info p {
  margin: 0.5rem 0;
}

.meal-detail-image,
.meal-detail-link {
  margin-bottom: 1.5rem;
}

.meal-detail-image h3,
.meal-detail-link h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.recipe-detail-image {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  transition: var(--transition);
}

.recipe-detail-image.clickable {
  cursor: zoom-in;
}

.recipe-detail-image.clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.recipe-image-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.image-zoom-hint {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.recipe-image-container:hover .image-zoom-hint {
  opacity: 1;
}

.zoom-icon {
  font-size: 1.2rem;
}

.zoom-text {
  font-weight: 500;
}

.recipe-link {
  display: block;
  padding: 1rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: var(--transition);
  word-break: break-all;
}

.recipe-link:hover {
  background: var(--primary-light);
  transform: translateX(5px);
}

.link-hint {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  font-style: italic;
}

.no-recipe-info {
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}

/* === IMAGE LIGHTBOX === */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-out;
  cursor: zoom-out;
  padding: 2rem;
}

.lightbox-container {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(95vh - 100px);
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
  animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lightbox-close {
  position: absolute;
  top: -3rem;
  right: 0;
  background: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  z-index: 2001;
}

.lightbox-close:hover {
  background: var(--danger);
  color: white;
  transform: rotate(90deg) scale(1.1);
}

.lightbox-hint {
  color: white;
  font-size: 0.9rem;
  opacity: 0.8;
  text-align: center;
  margin-top: 1rem;
}

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .meal-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: 240px;
  }

  .main-content {
    margin-left: 240px;
    padding: 1.5rem;
  }

  .meal-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .meal-grid {
    grid-template-columns: 1fr;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .time-display {
    font-size: 3rem;
  }

  .ingredient-row {
    grid-template-columns: 1fr;
  }

  /* Lightbox mobile optimizations */
  .lightbox-overlay {
    padding: 1rem;
  }

  .lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    font-size: 1.75rem;
  }

  .lightbox-image {
    max-height: calc(100vh - 120px);
  }

  .lightbox-hint {
    font-size: 0.8rem;
  }

  .image-zoom-hint {
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }

  .zoom-icon {
    font-size: 1rem;
  }
}

/* === INGREDIENTS DATABASE & MANAGEMENT === */
.ingredients-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.ingredients-header-row h3 {
  margin: 0;
}

.btn-manage-ingredients {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-manage-ingredients:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.manage-ingredients-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.add-ingredient-section {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 1.5rem;
  border-radius: 12px;
}

.add-ingredient-section h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary);
}

.add-ingredient-form {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr auto;
  gap: 0.75rem;
  align-items: center;
}

.custom-ingredients-list h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary);
}

.no-custom-ingredients {
  text-align: center;
  padding: 2rem;
  color: #999;
  font-style: italic;
}

.ingredients-table {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.ingredient-table-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr auto;
  gap: 1rem;
  padding: 1rem;
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.ingredient-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1.5fr auto;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #e0e0e0;
  align-items: center;
  transition: background 0.2s ease;
}

.ingredient-table-row:hover {
  background: #f8f9fa;
}

.ingredient-table-row:last-child {
  border-bottom: none;
}

.ingredient-name {
  font-weight: 500;
  color: var(--text);
}

.ingredient-protein {
  color: var(--accent);
  font-weight: 600;
}

.ingredient-category {
  color: #666;
  font-size: 0.9rem;
}

/* Dropdown styling for ingredients */
.ingredient-row-enhanced select.input-name {
  background: white;
  cursor: pointer;
  font-size: 0.95rem;
}

.ingredient-row-enhanced select.input-name option {
  padding: 0.5rem;
}

.ingredient-row-enhanced select.input-name optgroup {
  font-weight: 700;
  color: var(--primary);
  background: #f5f7fa;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .add-ingredient-form {
    grid-template-columns: 1fr;
  }

  .ingredient-table-header,
  .ingredient-table-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .ingredient-table-header {
    display: none;
  }

  .ingredient-table-row {
    position: relative;
    padding: 1rem;
    padding-right: 3rem;
  }

  .ingredient-table-row > span {
    display: block;
  }

  .ingredient-table-row > span:before {
    content: attr(class) ": ";
    font-weight: 600;
    text-transform: capitalize;
  }

  .ingredient-name:before {
    content: "Name: ";
  }

  .ingredient-protein:before {
    content: "Protein: ";
  }

  .ingredient-category:before {
    content: "Kategorie: ";
  }

  .ingredient-table-row .btn-delete-small {
    position: absolute;
    top: 1rem;
    right: 1rem;
  }
}

/* === BARCODE SCANNER === */
.scanner-overlay {
  z-index: 10000;
}

.modal-scanner {
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.scanner-container {
  margin-top: 1rem;
}

.scanner-area {
  text-align: center;
}

.barcode-reader {
  width: 100%;
  max-width: 500px;
  min-height: 300px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: #000;
}

.barcode-reader video {
  width: 100% !important;
  height: auto !important;
  display: block !important;
}

.barcode-reader canvas {
  display: none !important;
}

.scanner-hint {
  margin-top: 1rem;
  color: #666;
  font-size: 0.9rem;
  text-align: center;
}

.scanner-hint.scanner-active {
  color: var(--accent);
  font-weight: 600;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.scanner-error {
  color: #e74c3c;
  font-weight: 600;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fee;
  border-radius: 8px;
}

.scanner-error-box {
  margin-top: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fee 0%, #fdd 100%);
  border-radius: 12px;
  text-align: center;
}

.scanner-error-box .error-icon {
  font-size: 3rem;
  margin: 0 0 0.5rem 0;
}

.scanner-error-box .error-text {
  color: #c0392b;
  font-weight: 600;
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

.btn-retry {
  margin-top: 0.5rem;
}

.scanner-loading {
  text-align: center;
  padding: 3rem 1rem;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.product-preview {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 12px;
  padding: 1.5rem;
}

.product-preview-header h3 {
  margin: 0 0 1.5rem 0;
  color: var(--primary);
  text-align: center;
}

.product-preview-content {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  background: white;
  padding: 1rem;
  border-radius: 8px;
}

.product-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
  padding: 0.5rem;
  border: 1px solid #e0e0e0;
}

.product-info {
  flex: 1;
}

.product-info h4 {
  margin: 0 0 1rem 0;
  color: var(--text);
  font-size: 1.1rem;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 6px;
}

.detail-label {
  font-weight: 600;
  color: #666;
}

.detail-value {
  color: var(--accent);
  font-weight: 600;
}

.product-preview-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.btn-apply {
  flex: 1;
  max-width: 200px;
}

.scanner-error-state {
  text-align: center;
  padding: 2rem;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Scan Button */
.ingredient-name-with-scan {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  grid-column: 1;
}

.ingredient-name-with-scan select {
  flex: 1;
}

.btn-scan {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 45px;
  height: 45px;
}

.btn-scan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-scan:active {
  transform: translateY(0);
}

/* Update ingredient row grid */
.ingredient-row-enhanced {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto auto;
  gap: 0.5rem;
  align-items: start;
  padding: 0.75rem;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

/* === AUTOCOMPLETE === */
.ingredient-input-wrapper {
  position: relative;
  flex: 1;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
}

.suggestion-item:hover {
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
}

.suggestion-item:first-child {
  border-radius: 8px 8px 0 0;
}

.suggestion-item:last-child {
  border-radius: 0 0 8px 8px;
}

.suggestion-name {
  font-weight: 500;
  color: var(--text);
}

.suggestion-protein {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(45, 90, 61, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.protein-warning {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  cursor: help;
  animation: warningPulse 2s infinite;
}

@keyframes warningPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* === RUN USER SELECTION === */
.user-selection-container {
  padding: 1rem 0;
}

.selection-hint {
  color: #666;
  margin-bottom: 1rem;
  text-align: center;
}

.user-selection-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.user-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-option:hover {
  background: #e8eef5;
}

.user-option.selected {
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-color: var(--accent);
}

.user-checkbox {
  font-size: 1.5rem;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ccc;
  border-radius: 50%;
  background: white;
  transition: all 0.3s ease;
}

.user-option.selected .user-checkbox {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.selection-info {
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 8px;
  font-weight: 600;
  color: var(--primary);
}

/* Mobile responsive for scanner */
@media (max-width: 768px) {
  .modal-scanner {
    width: 95%;
    margin: 1rem;
  }

  .product-preview-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .product-image {
    width: 150px;
    height: 150px;
  }

  .detail-item {
    flex-direction: column;
    gap: 0.25rem;
    text-align: center;
  }

  .ingredient-name-with-scan {
    grid-column: 1 / -1;
  }

  .ingredient-row-enhanced {
    grid-template-columns: 1fr;
  }

  .autocomplete-dropdown {
    max-height: 150px;
  }

  .suggestion-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
  }
}
/* === FINANCES === */
.finances-view {
  padding: 2rem;
}

.finance-overview {
  display: grid;
  gap: 2rem;
}

.quick-add-section {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
}

.quick-add-section h3 {
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.info-text {
  color: #666;
  margin-bottom: 1.5rem;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
  min-width: 280px;
}

.receipt-preview {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.receipt-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.recent-receipts {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #eee;
}

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

.receipt-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.receipt-date {
  font-weight: 600;
  color: var(--text);
}

.receipt-category {
  font-size: 0.9rem;
  color: #666;
}

.receipt-amount {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Receipts List */
.receipts-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 1rem;
  flex: 1;
}

.receipts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.receipt-card {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.3s ease;
}

.receipt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-delete-small {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

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

.receipt-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.receipt-thumbnail {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.receipt-thumbnail:hover {
  opacity: 0.8;
}

.receipt-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.receipt-category-badge {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.receipt-total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

/* Categories View */
.categories-view {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-stats {
  display: grid;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.category-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.category-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.category-count {
  font-size: 0.9rem;
  color: #666;
}

.category-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.category-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.category-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
  transition: width 0.5s ease;
}

.category-percentage {
  font-size: 0.9rem;
  color: #666;
  font-weight: 600;
}

/* Receipt Modal */
.receipt-confirm-container {
  padding: 1rem 0;
}

.receipt-preview-small {
  margin-bottom: 1.5rem;
}

.receipt-preview-small img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.input-large {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .receipts-grid {
    grid-template-columns: 1fr;
  }

  .receipts-filters {
    flex-direction: column;
  }

  .btn-large {
    min-width: 100%;
  }
}
