/* ==========================================================================
   SISTEMA DE DISEÑO - CALCULADORA DE TERRONES DE AZÚCAR E ÍNDICE GLUCÉMICO
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);
  --bg-elevated: #334155;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-light: rgba(56, 189, 248, 0.15);
  
  --sugar-cube: #f1f5f9;
  --sugar-glow: rgba(241, 245, 249, 0.3);
  
  /* Status Colors */
  --gi-low: #10b981;        /* Verde low IG < 55 */
  --gi-low-bg: rgba(16, 185, 129, 0.15);
  --gi-medium: #f59e0b;     /* Amarillo medium IG 56-69 */
  --gi-medium-bg: rgba(245, 158, 11, 0.15);
  --gi-high: #f43f5e;       /* Rojo high IG >= 70 */
  --gi-high-bg: rgba(244, 63, 94, 0.15);

  --accent-purple: #a855f7;
  --accent-purple-bg: rgba(168, 85, 247, 0.15);

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.4);
  
  --glass-border: 1px solid rgba(255, 255, 255, 0.1);
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  outline: none;
  transition: var(--transition-fast);
}

input, select {
  font-family: inherit;
  outline: none;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Navbar */
.app-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: var(--glass-border);
  padding: 1rem 0;
}

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

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-icon {
  font-size: 2rem;
  background: var(--primary-light);
  padding: 0.4rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.logo-title {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-actions {
  display: flex;
  gap: 1rem;
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: var(--glass-border);
}

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

/* Hero Section */
.hero-section {
  padding: 2.5rem 0 1.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero-title span {
  color: var(--primary);
  background: linear-gradient(135deg, #38bdf8 0%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 780px;
  margin: 0 auto 1.5rem;
}

.formula-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  text-align: left;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.formula-step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  width: 2rem;
  height: 2rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.step-content h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.step-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   BIOMETRIC PROFILE SECTION
   ========================================================================== */
.biometric-section {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(88, 28, 135, 0.25) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.biometric-header {
  margin-bottom: 1.25rem;
}

.biometric-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
  background: rgba(15, 23, 42, 0.5);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: var(--glass-border);
}

.bio-computed-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.bio-metric-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bio-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.bio-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #ffffff;
}

.bio-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   METABOLIC SCHEDULE & WORKOUT CURVE SECTION
   ========================================================================== */
.metabolic-schedule-section {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.schedule-header {
  margin-bottom: 1.25rem;
}

.schedule-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.schedule-icon {
  font-size: 1.8rem;
  background: rgba(56, 189, 248, 0.15);
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.schedule-title-group h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.schedule-title-group p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.schedule-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: var(--glass-border);
}

.control-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-box label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-box input, .control-box select {
  background: var(--bg-secondary);
  border: var(--glass-border);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
}

.control-box input:focus, .control-box select:focus {
  border-color: var(--primary);
}

.chart-container {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-md);
  border: var(--glass-border);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.green { background: var(--gi-low); box-shadow: 0 0 8px rgba(16, 185, 129, 0.6); }
.legend-dot.yellow { background: var(--gi-medium); }
.legend-dot.red { background: var(--gi-high); }

.metabolic-chart-wrapper {
  width: 100%;
  height: 220px;
  position: relative;
}

#metabolic-svg-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.meal-timeline-container {
  border-top: var(--glass-border);
  padding-top: 1.25rem;
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.timeline-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.meal-time-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.meal-time-card {
  background: var(--bg-secondary);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.meal-time-card.active-meal-card {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.08);
}

.meal-time-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.meal-time-name {
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.meal-time-input {
  background: rgba(15, 23, 42, 0.6);
  border: var(--glass-border);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  width: 100%;
}

.meal-example-box {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.meal-example-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.meal-example-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.meal-example-sum-badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.meal-example-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.meal-example-details {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.meal-card-btn-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-choose-4-menus {
  flex: 1;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.btn-choose-4-menus:hover {
  background: var(--primary);
  color: #0f172a;
}

.btn-edit-library {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: var(--glass-border);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

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

/* Additional Workouts & Multi-Session Fitness Instructors */
.additional-workout-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.additional-workout-card:hover {
  border-color: rgba(0, 245, 212, 0.45);
  box-shadow: 0 4px 15px rgba(0, 245, 212, 0.08);
}

.additional-workout-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.additional-workout-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.additional-workout-field label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.additional-workout-field input,
.additional-workout-field select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.btn-remove-workout {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #f43f5e;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-remove-workout:hover {
  background: rgba(244, 63, 94, 0.3);
}

.recovery-meal-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #00f5d4;
  font-weight: 600;
  cursor: pointer;
}

.meal-alignment-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-full);
  text-align: center;
}

.meal-alignment-badge.green {
  background: var(--gi-low-bg);
  color: var(--gi-low);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.meal-alignment-badge.yellow {
  background: var(--gi-medium-bg);
  color: var(--gi-medium);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.meal-alignment-badge.red {
  background: var(--gi-high-bg);
  color: var(--gi-high);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.waiting-times-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}

.wait-timer-card {
  background: rgba(15, 23, 42, 0.6);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wait-timer-icon {
  font-size: 1.4rem;
  color: var(--primary);
  background: var(--primary-light);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wait-timer-info h5 {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.wait-timer-duration {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}

/* ==========================================================================
   MI MENÚ DEL DÍA
   ========================================================================== */
.menu-builder-section {
  margin-bottom: 2.5rem;
}

.menu-panel-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.menu-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 1rem;
  border-bottom: var(--glass-border);
  margin-bottom: 1rem;
}

.menu-panel-title {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.meal-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.meal-tab {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  border: var(--glass-border);
}

.meal-tab.active {
  background: var(--primary);
  color: #0f172a;
  border-color: var(--primary);
}

.menu-items-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  min-height: 90px;
}

.empty-menu-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  border: 1px stroke rgba(255, 255, 255, 0.05);
}

.empty-menu-state p {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.menu-item-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.menu-item-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.menu-item-name {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.portion-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.portion-controls input {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
}

.portion-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-remove-item {
  color: var(--text-muted);
  background: transparent;
  padding: 0.3rem;
  border-radius: 4px;
}

.btn-remove-item:hover {
  color: var(--gi-high);
  background: rgba(244, 63, 94, 0.1);
}

.menu-summary-box {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  border: var(--glass-border);
}

.summary-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.total-cube-counter {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.total-cube-number {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--sugar-cube);
  text-shadow: 0 0 10px var(--sugar-glow);
}

.total-cube-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.risk-meter-bar {
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0.75rem 0 0.5rem;
  display: flex;
}

.risk-meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease, background-color 0.4s ease;
}

.risk-level-badge {
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Catalog Gallery Section */
.catalog-section {
  margin-bottom: 4rem;
}

.catalog-header {
  margin-bottom: 1.5rem;
}

.search-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--bg-secondary);
  border: var(--glass-border);
  color: var(--text-primary);
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.category-select, .gi-filter-select {
  background: var(--bg-secondary);
  border: var(--glass-border);
  color: var(--text-primary);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
}

.category-select:focus, .gi-filter-select:focus {
  border-color: var(--primary);
}

.category-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-top: 1rem;
  scrollbar-width: thin;
}

.tab-btn {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  border: var(--glass-border);
}

.tab-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--primary);
  color: #0f172a;
  font-weight: 700;
}

.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

.food-card {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-fast);
  position: relative;
}

.food-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255, 255, 255, 0.2);
}

.food-card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.food-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.05);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.food-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.2rem;
}

.food-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.badge-gi {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-gi.low {
  background: var(--gi-low-bg);
  color: var(--gi-low);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-gi.medium {
  background: var(--gi-medium-bg);
  color: var(--gi-medium);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-gi.high {
  background: var(--gi-high-bg);
  color: var(--gi-high);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.sugar-cube-metric {
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.75rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cube-count-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cube-number {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
}

.cube-icon-stack {
  display: flex;
  gap: 0.15rem;
  font-size: 1rem;
}

.serving-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: right;
}

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

.btn-add-food {
  flex: 1;
  background: var(--primary);
  color: #0f172a;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.btn-add-food:hover {
  background: #7dd3fc;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.btn-info-food {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.btn-info-food:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.four-menus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.menu-option-card {
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: 14px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.menu-option-card:hover {
  border-color: #38bdf8;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(56, 189, 248, 0.25);
}

/* ==========================================================================
   VENTANAS EMERGENTES MODALES (POPUPS FLOTANTES)
   ========================================================================== */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(9, 6, 16, 0.88) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  display: none;
  align-items: flex-start !important;
  justify-content: center !important;
  z-index: 10000 !important;
  padding: 1.5rem 1rem !important;
  box-sizing: border-box !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.modal-overlay.active {
  display: flex !important;
  animation: fadeInModalOverlay 0.2s ease-out forwards;
}

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

.modal-content {
  background: #0f172a !important;
  border: 1.5px solid rgba(56, 189, 248, 0.45) !important;
  border-radius: 18px !important;
  padding: 1.8rem !important;
  width: 100% !important;
  max-width: 920px !important;
  max-height: calc(100vh - 3rem) !important;
  margin: auto !important;
  overflow-y: auto !important;
  position: relative !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.2) !important;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.93);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-close {
  position: absolute !important;
  top: 1rem !important;
  right: 1.25rem !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #fff !important;
  font-size: 1.5rem !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  line-height: 1 !important;
  z-index: 10 !important;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
  transform: scale(1.1) !important;
}

.printable-document-container {
  display: none;
}

/* ==========================================================================
   CONFIGURACIÓN NATIVA DE IMPRESIÓN Y PDF - AHORRO DE TINTA Y 1 SOLA CARA A4
   ========================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0.4cm 0.6cm;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
  }

  body > *:not(#printable-summary-document) {
    display: none !important;
  }

  #printable-summary-document {
    display: block !important;
    visibility: visible !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }
}
