/* CSS VARIABLES & TOKENS */
:root {
  --font-title: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  
  --bg-main: #060913;
  --card-bg: rgba(14, 20, 38, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  
  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.35);
  
  --accent-green: #10b981;
  --accent-green-glow: rgba(16, 185, 129, 0.35);
  
  --accent-orange: #f97316;
  --accent-orange-glow: rgba(249, 115, 22, 0.35);
  
  --accent-red: #ef4444;
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-main: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* GENERAL RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.4;
  padding-top: 60px; /* Spacer for top sticky bar */
  padding-bottom: 80px; /* Spacer for mobile bottom nav */
}

/* GLOWING BACKGROUND DECORATIONS */
.glow-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow-bg .circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
}

.circle-1 {
  width: 450px;
  height: 450px;
  background: var(--accent-blue);
  top: -100px;
  left: -100px;
}

.circle-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-green);
  bottom: -150px;
  right: -100px;
}

.circle-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-orange);
  top: 25%;
  left: 55%;
}

/* STICKY SUMMARY BAR */
.sticky-summary-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 54px;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
  z-index: 999;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.summary-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.summary-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.summary-value {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
}

.summary-divider {
  width: 1px;
  height: 24px;
  background-color: var(--card-border);
}

.text-blue { color: #60a5fa; text-shadow: 0 0 8px rgba(96, 165, 250, 0.2); }
.text-green { color: #34d399; text-shadow: 0 0 8px rgba(52, 211, 153, 0.2); }
.text-orange { color: #fdba74; text-shadow: 0 0 8px rgba(253, 186, 116, 0.2); }

/* APP CONTAINER */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 0 16px;
}

/* HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}

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

.logo-icon {
  font-size: 26px;
  color: var(--accent-blue);
  text-shadow: 0 0 12px var(--accent-blue-glow);
}

.header-logo h1 {
  font-family: var(--font-title);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-logo h1 span {
  color: var(--accent-blue);
}

.header-logo .subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

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

.save-indicator {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
  padding: 5px 10px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.save-indicator.saving {
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.2);
  color: var(--accent-orange);
}

.current-date-badge {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

/* NAVIGATION TABS (Navbar) */
.app-nav {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 6px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-tab.active {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 4px 15px var(--accent-blue-glow);
}

/* CALENDAR SECTION */
.calendar-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-main);
}

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

.calendar-header h3 {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.days-remaining {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.calendar-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px 2px;
  scroll-behavior: smooth;
  scrollbar-width: none; /* Hide scrollbar for clean UI */
}

.calendar-container::-webkit-scrollbar {
  display: none;
}

.calendar-day {
  flex: 0 0 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

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

.calendar-day.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.06) 100%);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue-glow);
}

.calendar-day.completed {
  border-color: var(--accent-green);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.02) 100%);
}

.calendar-day.rest {
  opacity: 0.6;
}

.day-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.day-number {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  margin: 1px 0;
}

.day-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
}

.calendar-day.completed .day-indicator {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.calendar-day.active .day-indicator {
  background: var(--accent-blue);
}

/* TAB PANELS HIDE/SHOW */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}

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

/* CARDS STYLING */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-main);
  margin-bottom: 20px;
}

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

.card-header h2 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* BALANCE CARD */
.balance-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-top: 6px;
}

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

.balance-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.balance-num {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 800;
  margin: 2px 0;
}

.balance-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.balance-sign {
  font-size: 14px;
  color: var(--text-muted);
}

/* GRID LAYOUTS */
.dashboard-grid-1col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* HABITS LIST */
.habits-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.habit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.habit-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.habit-checkbox {
  display: none;
}

.habit-custom-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  margin-top: 1px;
}

.habit-checkbox:checked + .habit-custom-box {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue-glow);
}

.habit-checkbox:checked + .habit-custom-box::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: white;
  font-size: 10px;
}

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

.habit-title {
  font-size: 13px;
  font-weight: 600;
}

.habit-desc {
  font-size: 10px;
  color: var(--text-secondary);
}

/* VITALS INPUT CODES */
.vitals-inputs-compact {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.input-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-inline-btn {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-inline-btn input {
  flex: 1;
}

.steps-target-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.btn-inline-add {
  background-color: var(--accent-blue);
  color: white;
  padding: 9px 14px;
}

.activity-quick-form {
  display: flex;
  gap: 6px;
}

.activity-quick-form select {
  flex: 1.5;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 12px;
}

.activity-quick-form input {
  flex: 0.8;
  padding: 8px;
}

.logged-activities-container {
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
}

.logged-activities-container h5 {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.activity-list-item .act-kcal {
  color: var(--accent-orange);
  font-weight: 700;
}

.activity-list-item .btn-delete-act {
  background: transparent;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  padding: 2px;
}

/* WORKOUT PANEL - MODO ENTRENO */
.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.exercise-item {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.exercise-title {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
}

/* Visual boxes for set/rep/RIR targets below title */
.exercise-scheme-boxes {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.scheme-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.scheme-box-blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.scheme-box-orange { background: rgba(249, 115, 22, 0.15); color: #fdba74; }

.exercise-instructions {
  background: rgba(255, 255, 255, 0.01);
  border-left: 2px solid var(--accent-blue);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Workout Sets Table Grid */
.sets-grid-header {
  display: grid;
  grid-template-columns: 0.6fr 1fr 1.2fr 1.2fr 0.6fr;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
}

.set-row {
  display: grid;
  grid-template-columns: 0.6fr 1fr 1.2fr 1.2fr 0.6fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  text-align: center;
}

.set-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 0 auto;
}

.prev-val {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.set-row input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
}

.set-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-green);
  cursor: pointer;
  margin: 0 auto;
}

/* NUTRITION & FOOD SEARCH */
.search-food-container {
  position: relative;
  width: 100%;
}

.search-food-container input {
  width: 100%;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.suggestion-item {
  padding: 10px 14px;
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.suggestion-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.suggestion-item .food-portion-lbl {
  color: var(--text-muted);
  font-size: 11px;
}

.search-portion-selector {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.portion-details {
  display: flex;
  flex-direction: column;
}

.portion-details strong {
  font-size: 13px;
}

.portion-details span {
  font-size: 11px;
  color: var(--text-secondary);
}

.portion-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portion-inputs label {
  font-size: 11px;
  color: var(--text-secondary);
}

.btn-add-food-search { background-color: var(--accent-green); color: white; padding: 6px 12px; font-size: 11px; }
.btn-cancel-food-search { background-color: transparent; color: var(--text-secondary); border: 1px solid var(--card-border); padding: 6px 12px; font-size: 11px; }

/* Custom details collapsible */
.custom-food-details {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 8px;
  background: rgba(255, 255, 255, 0.01);
}

.custom-food-summary {
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
  user-select: none;
}

/* HISTORIAL NUTRICIÓN */
#nutrition-history-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-history-food {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-history-food:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: var(--text-secondary);
}

/* CHAT CARD & BURBLES */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 480px;
}

.chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}

.message {
  display: flex;
  width: 100%;
}

.message.assistant {
  justify-content: flex-start;
}

.message.user {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.message.assistant .msg-bubble {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  border-bottom-left-radius: 2px;
}

.message.user .msg-bubble {
  background-color: var(--accent-blue);
  color: white;
  border-bottom-right-radius: 2px;
  box-shadow: 0 4px 12px var(--accent-blue-glow);
}

/* Chat Quick Action Card */
.chat-action-panel {
  padding: 8px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid var(--accent-blue);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  animation: slideUp 0.2s ease-out;
}

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

.action-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.action-desc {
  font-size: 12px;
  font-weight: 700;
}

.action-buttons {
  display: flex;
  gap: 6px;
}

.btn-action-confirm { background-color: var(--accent-green); color: white; padding: 6px 12px; font-size: 11px; }
.btn-action-cancel { background-color: rgba(255, 255, 255, 0.05); color: var(--text-secondary); border: 1px solid var(--card-border); padding: 6px 12px; font-size: 11px; }

.chat-input-bar {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--card-border);
  padding-top: 10px;
  margin-top: 6px;
}

.chat-input-bar input {
  flex: 1;
}

.btn-send-chat {
  background-color: var(--accent-blue);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 0;
}

/* SEGUIMIENTO CORPORAL HISTÓRICO */
.checkin-logger-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.section-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.tracking-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-orange);
  margin-top: 4px;
}

/* FLOATING ACTION BUTTON (Mobile Plus button) */
.floating-action-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-orange) 0%, #ea580c 100%);
  color: white;
  border: none;
  box-shadow: 0 5px 20px rgba(249, 115, 22, 0.4);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  cursor: pointer;
  transition: var(--transition);
}

.floating-action-btn:hover {
  transform: scale(1.08) rotate(90deg);
}

/* QUICK ADD MODAL */
.quick-add-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 14, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1001;
  display: flex;
  align-items: flex-end; /* Slides from bottom */
  justify-content: center;
}

.quick-add-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-main);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
  animation: slideFromBottom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideFromBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

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

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
}

.modal-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 16px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: var(--transition);
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-blue);
}

.modal-btn i {
  font-size: 20px;
  color: var(--accent-blue);
}

.modal-btn span {
  font-size: 12px;
  font-weight: 600;
}

/* UNDO TOAST */
.undo-toast {
  position: fixed;
  bottom: 84px; /* Placed above bottom nav bar */
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--accent-blue);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1002;
  animation: slideToastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideToastIn {
  from { bottom: 64px; opacity: 0; }
  to { bottom: 84px; opacity: 1; }
}

.toast-message {
  font-size: 12px;
  font-weight: 600;
}

.btn-undo-action {
  background: transparent;
  border: none;
  color: #60a5fa;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* INPUTS EN TIEMPO REAL CODES */
.input-group input,
.input-group select,
.custom-food-form input,
.checkin-form input {
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition);
}

/* COMPATIBILITY & RESPONSIVE LAYOUTS */
/* Desktop styling override for Nav */
@media (min-width: 1025px) {
  /* Keep Nav at the top, style it beautifully */
  .app-nav {
    max-width: 600px;
    margin: 0 auto 20px auto;
  }
}

/* Mobile responsive styles */
@media (max-width: 1024px) {
  body {
    padding-bottom: 74px; /* More bottom padding for nav bar */
  }

  .app-container {
    padding: 12px 12px 0 12px;
  }

  /* Bottom nav bar configuration for Mobile */
  .app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    margin-bottom: 0;
    border-radius: 0;
    border-top: 1px solid var(--card-border);
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: rgba(8, 12, 24, 0.95);
    padding: 4px 8px;
    z-index: 1000;
  }

  .nav-tab {
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    font-size: 10px;
  }

  .nav-tab i {
    font-size: 16px;
  }

  .dashboard-2col {
    grid-template-columns: 1fr;
  }

  .floating-action-btn {
    bottom: 70px; /* Stay clear of bottom nav bar */
  }
}

/* UTILITY CLASSES */
.hidden {
  display: none !important;
}

/* PREMIUM NUTRITION GRID LAYOUT */
.nutrition-layout-2col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: start;
}

.nutrition-column-left,
.nutrition-column-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* CARD HEADERS & COMPACT HEADERS */
.card-header-compact {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-header-compact h3 {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* CALORIES RADIAL PROGRESS DISPLAY */
.calories-radial-display {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 26px 0;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 16px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
}

.kcal-values {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.kcal-number-val {
  font-family: var(--font-title);
  font-size: 34px;
  font-weight: 900;
  color: var(--accent-green);
  text-shadow: 0 0 15px rgba(16, 185, 129, 0.25);
  letter-spacing: -1px;
}

.kcal-unit-lbl {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: -2px;
}

/* MACROS PILL GRID */
.macros-pill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.macro-pill-card-item {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition);
}

.macro-pill-card-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}

.macro-pill-title {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.macro-pill-val {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

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

.pill-progress-fill {
  height: 100%;
  border-radius: 2px;
}

.prot-fill { background-color: var(--accent-blue); box-shadow: 0 0 6px var(--accent-blue-glow); }
.carbs-fill { background-color: var(--accent-orange); box-shadow: 0 0 6px var(--accent-orange-glow); }
.fat-fill { background-color: #facc15; box-shadow: 0 0 6px rgba(250, 204, 21, 0.35); }

/* LOGGED FOODS LIST */
.logged-foods-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logged-foods-header h3 {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-clear-foods {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--accent-red);
  padding: 6px 12px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.btn-clear-foods:hover {
  background: rgba(239, 68, 68, 0.2);
}

.logged-foods-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.empty-list-notice {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 12px;
  border: 1px dashed var(--card-border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.005);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-list-notice i {
  font-size: 20px;
}

.logged-food-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.logged-food-card-item:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateX(2px);
}

.food-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.food-card-details {
  flex: 1;
  margin-left: 12px;
  display: flex;
  flex-direction: column;
}

.food-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.food-card-macros {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 1px;
}

.food-card-macros strong {
  color: var(--text-secondary);
}

.food-card-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.food-card-kcal {
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-green);
}

.btn-delete-food {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-delete-food:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.08);
}

.btn-favorite-food, .btn-edit-food {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: var(--transition);
}

.btn-favorite-food:hover {
  color: #3b82f6; /* bright blue */
  background: rgba(59, 130, 246, 0.08);
}

.btn-edit-food:hover {
  color: #f97316; /* bright orange */
  background: rgba(249, 115, 22, 0.08);
}

/* PREMIUM NUTRITION TOOLBOX SEARCH */
.search-food-container-premium {
  position: relative;
  width: 100%;
}

.search-field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.search-food-container-premium input {
  width: 100%;
  padding-left: 36px !important;
  font-size: 13px;
  height: 42px;
}

.search-food-container-premium input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue-glow);
}

.portion-action-btns {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}

.portion-action-btns button {
  flex: 1;
}

/* SUB-TAB NAV */
.nutrition-subtabs-nav {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  padding: 4px;
  border-radius: var(--radius-md);
  margin: 16px 0;
}

.subtab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.subtab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.subtab-btn.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.subtab-help-text {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.subtab-panel {
  display: none;
}

.subtab-panel.active {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

/* MANUAL FORM BOX GRID */
.macro-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.macro-input-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.macro-input-item label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
}

.macro-input-item input {
  text-align: center;
  padding: 8px 4px !important;
}

.btn-add-food-manual {
  width: 100%;
  background-color: var(--accent-blue);
  color: white;
  padding: 10px;
  font-weight: 700;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-add-food-manual:hover {
  background-color: #2563eb;
  box-shadow: 0 4px 12px var(--accent-blue-glow);
}

/* RESPONSIVE LAYOUT NUTRITION */
@media (max-width: 900px) {
  .nutrition-layout-2col {
    grid-template-columns: 1fr;
  }
}

/* DAY SWAPPING BUTTON */
.btn-swap-day {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-swap-day:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--accent-blue);
  box-shadow: 0 0 10px var(--accent-blue-glow);
}

/* SWAP MODAL BUTTONS LIST */
.modal-buttons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.swap-option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.swap-option-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-blue);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.swap-option-btn i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* TABLE CONTAINER FOR HORIZONTAL SCROLL ON MOBILE */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 10px;
  border-radius: var(--radius-sm);
}

/* VITALS GRID (Check-in and Weight) */
.vitals-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

/* HIDE UNNECESSARY HEADER ELEMENTS GLOBALLY */
.save-indicator,
.current-date-badge {
  display: none !important;
}

/* HIGHLY OPTIMIZED MOBILE STYLING (max-width: 600px) */
@media (max-width: 600px) {
  /* Header clean horizontal bar */
  .app-header {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0 !important;
    padding-bottom: 12px;
  }
  .header-status {
    width: auto !important;
  }

  /* Card Header stack */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  
  /* Balance card vertical stacking with sign rotation */
  .balance-container {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }
  .balance-sign {
    transform: rotate(90deg);
    margin: 2px 0;
  }

  /* Vitals grid stack (2 columns) */
  .vitals-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  /* Exercise badges/buttons 2x2 grid */
  .exercise-scheme-boxes {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    width: 100% !important;
    margin-top: 8px;
  }
  .scheme-box {
    text-align: center;
    font-size: 11px;
    padding: 6px 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }

  /* Modal buttons grid spanning last button */
  .modal-buttons-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .modal-buttons-grid button:last-child {
    grid-column: span 2;
  }

  /* Navigation bottom bar styling adjustments */
  .nav-tab {
    padding: 6px 2px;
    font-size: 9px;
  }
  .nav-tab i {
    font-size: 14px;
  }

  /* Food card item title clamping to prevent overflowing the row */
  .food-card-title {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Macros Pill Grid optimization */
  .macros-pill-grid {
    gap: 6px;
  }
  .macro-pill-card-item {
    padding: 8px 4px;
  }
  .macro-pill-val {
    font-size: 11px !important;
  }

  /* Workout Set rows adjustments for narrow screens */
  .sets-grid-header,
  .set-row {
    grid-template-columns: 0.6fr 1fr 1.2fr 1.2fr 0.6fr !important;
    gap: 4px !important;
  }
  .set-row input {
    padding: 6px 4px !important;
    font-size: 11px !important;
  }
  .prev-val {
    font-size: 9px !important;
  }
  
  /* Reduce general padding inside cards on mobile to save space */
  .card {
    padding: 14px;
  }
}

