/**
 * Fitness App - Apple Human Interface Guidelines (HIG) Design System
 * SF Pro Dynamic Optical Sizing Typography, Glassmorphism, Squircles & Spring Physics
 */

/* ==========================================================================
   Apple SF Pro Typography System (San Francisco Pro)
   Dynamic Optical Sizing: SF Pro Display (>=20px) & SF Pro Text (<20px)
   Official Apple Web Properties & HIG Font Engine
   ========================================================================== */

/* SF Pro Display - Grandes Titulares, Encabezados y Números de Impacto */
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 100;
  src: local('SF Pro Display Ultralight'), local('SFProDisplay-Ultralight'), local('.SFUIDisplay-Ultralight'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-ultralight-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 200;
  src: local('SF Pro Display Thin'), local('SFProDisplay-Thin'), local('.SFUIDisplay-Thin'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-thin-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 300;
  src: local('SF Pro Display Light'), local('SFProDisplay-Light'), local('.SFUIDisplay-Light'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-light-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 400;
  src: local('SF Pro Display Regular'), local('SF Pro Display'), local('SFProDisplay-Regular'), local('.SFUIDisplay-Regular'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 500;
  src: local('SF Pro Display Medium'), local('SFProDisplay-Medium'), local('.SFUIDisplay-Medium'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-medium-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 600;
  src: local('SF Pro Display Semibold'), local('SFProDisplay-Semibold'), local('.SFUIDisplay-Semibold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-semibold-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 700;
  src: local('SF Pro Display Bold'), local('SFProDisplay-Bold'), local('.SFUIDisplay-Bold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Display';
  font-style: normal;
  font-weight: 800;
  font-weight: 900;
  src: local('SF Pro Display Heavy'), local('SFProDisplay-Heavy'), local('.SFUIDisplay-Heavy'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-heavy-webfont.woff') format('woff');
  font-display: swap;
}

/* SF Pro Text - Cuerpo de Texto, Subtítulos, Botones, Inputs, Tablas y Captions */
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 300;
  src: local('SF Pro Text Light'), local('SFProText-Light'), local('.SFUIText-Light'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-light-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 400;
  src: local('SF Pro Text Regular'), local('SF Pro Text'), local('SFProText-Regular'), local('.SFUIText-Regular'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-regular-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 500;
  src: local('SF Pro Text Medium'), local('SFProText-Medium'), local('.SFUIText-Medium'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-medium-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 600;
  src: local('SF Pro Text Semibold'), local('SFProText-Semibold'), local('.SFUIText-Semibold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-semibold-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 700;
  src: local('SF Pro Text Bold'), local('SFProText-Bold'), local('.SFUIText-Bold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-bold-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro Text';
  font-style: normal;
  font-weight: 800;
  font-weight: 900;
  src: local('SF Pro Text Heavy'), local('SFProText-Heavy'), local('.SFUIText-Heavy'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-heavy-webfont.woff') format('woff');
  font-display: swap;
}

/* Fallback unificado SF Pro */
@font-face {
  font-family: 'SF Pro';
  font-style: normal;
  font-weight: 400;
  src: local('SF Pro Text Regular'), local('SF Pro'), local('SFProText-Regular'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-regular-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro';
  font-style: normal;
  font-weight: 600;
  src: local('SF Pro Text Semibold'), local('SFProText-Semibold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-semibold-webfont.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'SF Pro';
  font-style: normal;
  font-weight: 700;
  src: local('SF Pro Text Bold'), local('SFProText-Bold'),
       url('https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscotext-bold-webfont.woff') format('woff');
  font-display: swap;
}

:root {
  /* Jerarquía de Tipografías Apple HIG */
  --apple-font-text: "SF Pro Text", "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --apple-font-display: "SF Pro Display", "SF Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --apple-font: var(--apple-font-text);
  --apple-font-mono: "SF Mono", SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --apple-font-rounded: "SF Pro Rounded", "SF Pro", -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Paleta Apple Modo Claro */
  --bg-primary: #f5f5f7;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-solid: #ffffff;
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-focus: #0071e3;
  --text-primary: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #a1a1a6;
  
  /* Acentos Apple */
  --apple-blue: #0071e3;
  --apple-blue-hover: #0077ed;
  --apple-green: #34c759;
  --apple-red: #ff3b30;
  --apple-orange: #ff9500;
  --apple-purple: #af52de;
  --apple-cyan: #32ade6;
  
  /* Anillos de Actividad (Apple Watch Fitness Colors) */
  --ring-cardio: #ff2d55;
  --ring-fuerza: #5856d6;
  --ring-dieta: #30d158;
  --ring-agua: #00c7be;
  
  /* Sombras Apple */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-float: 0 20px 40px -8px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.03);
  
  /* Física Spring */
  --ease-apple-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: all 0.25s var(--ease-apple-spring);
}

/* Modo Oscuro Apple */
[data-theme="dark"] {
  --bg-primary: #000000;
  --bg-card: rgba(28, 28, 30, 0.82);
  --bg-card-solid: #1c1c1e;
  --bg-card-hover: rgba(44, 44, 46, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-focus: #2997ff;
  --text-primary: #f5f5f7;
  --text-secondary: #8e8e93;
  --text-tertiary: #636366;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
  --shadow-card: 0 8px 24px -4px rgba(0, 0, 0, 0.5), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-float: 0 20px 40px -8px rgba(0, 0, 0, 0.7);
}

/* Reseteo y Base Tipográfica Apple HIG */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-family: var(--apple-font-text);
  font-optical-sizing: auto;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--apple-font-text);
  font-optical-sizing: auto;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.47059; /* Razón áurea Apple HIG para texto legible (17px / 25px) */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 16px));
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* Dynamic Optical Sizing: SF Pro Display para titulares y grandes textos (>= 20px) */
h1, h2, h3, .font-display, .apple-display, .apple-title, .apple-hero-number {
  font-family: var(--apple-font-display);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Escala y Tracking Apple HIG */
h1, .text-3xl, .text-4xl, .apple-hero-title {
  font-family: var(--apple-font-display);
  letter-spacing: -0.025em; /* Apple Large Title Tracking */
}

h2, .text-2xl {
  font-family: var(--apple-font-display);
  letter-spacing: -0.021em; /* Apple Title 1 Tracking */
}

h3, .text-xl, .text-lg {
  font-family: var(--apple-font-display);
  letter-spacing: -0.017em; /* Apple Title 2 Tracking */
}

/* SF Pro Text para cuerpo, controles, botones, tablas y formularios (< 20px) */
p, span, div, a, button, input, textarea, select, label, li, td, th, h4, h5, h6,
.text-base, .text-sm, .text-xs, .apple-body {
  font-family: var(--apple-font-text);
  font-optical-sizing: auto;
}

/* Titulares pequeños y medianos (Headline / Subheadline) */
h4, .text-base {
  letter-spacing: -0.011em;
}

/* Cuerpo de texto estándar */
.text-sm {
  letter-spacing: -0.006em;
}

/* Captions y etiquetas pequeñas con tracking positivo Apple para máxima legibilidad */
.text-xs, .text-\[11px\], .text-\[10px\], .text-\[9px\], .pill-badge, .superserie-badge {
  letter-spacing: 0.012em;
}

/* Tipografía Monoespaciada Apple SF Mono */
code, kbd, samp, pre, .font-mono, [data-mono] {
  font-family: var(--apple-font-mono);
  font-feature-settings: "tnum" 1;
}

/* Números tabulares para métricas, repeticiones, calorías y temporizadores */
.tabular-nums, .stat-value, .metric-number {
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}

@media (min-width: 768px) {
  body {
    padding-bottom: 40px;
  }
}

/* Glassmorphism Frosted Glass */
.frosted-glass {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
}

.frosted-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-spring);
}

.frosted-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  backdrop-filter: blur(28px) saturate(210%);
  -webkit-backdrop-filter: blur(28px) saturate(210%);
  background: rgba(255, 255, 255, 0.88);
  border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
  padding-top: 6px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
  transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .frosted-tabbar {
  background: rgba(24, 24, 27, 0.88);
  border-top: 0.5px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
}

.frosted-tabbar .nav-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 6px;
  color: #8E8E93;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.frosted-tabbar .nav-tab-btn .tab-icon-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.frosted-tabbar .nav-tab-btn .apple-3d-icon {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
  opacity: 0.75;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.frosted-tabbar .nav-tab-btn svg.tab-icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
  transition: all 0.2s ease;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.frosted-tabbar .nav-tab-btn.active-nav {
  color: #0071E3;
  font-weight: 600;
}

[data-theme="dark"] .frosted-tabbar .nav-tab-btn.active-nav {
  color: #2997FF;
}

.frosted-tabbar .nav-tab-btn.active-nav .tab-icon-wrapper {
  transform: translateY(-2px) scale(1.1);
}

.frosted-tabbar .nav-tab-btn.active-nav .apple-3d-icon {
  opacity: 1;
  transform: translateY(-2px) scale(1.18);
  filter: drop-shadow(0 4px 10px rgba(0, 113, 227, 0.45));
}

.frosted-tabbar .nav-tab-btn.active-nav svg.tab-icon {
  stroke-width: 2.2;
  filter: drop-shadow(0 2px 8px rgba(0, 113, 227, 0.45));
}

.frosted-tabbar .nav-tab-btn:active {
  transform: scale(0.92);
}

#desktop-nav-links .nav-tab-btn.active-nav {
  background: var(--apple-blue);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.35);
}

/* ==========================================================================
   SISTEMA DE ICONOS 3D APPLE ORIGINALES (160x160 RETINA ASSETS)
   ========================================================================== */
.apple-3d-icon {
  display: inline-block;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.15));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
}

.apple-3d-icon:hover {
  transform: scale(1.08) translateY(-1px);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Tamaños proporcionales de icono 3D Apple */
.apple-3d-xs  { width: 16px; height: 16px; }
.apple-3d-sm  { width: 22px; height: 22px; }
.apple-3d-md  { width: 28px; height: 28px; }
.apple-3d-lg  { width: 38px; height: 38px; }
.apple-3d-xl  { width: 48px; height: 48px; }
.apple-3d-2xl { width: 56px; height: 56px; }

/* ==========================================================================
   SISTEMA DE ICONOGRAFÍA 3D APPLE (SF SYMBOLS & APPLE HEALTH/FITNESS)
   ========================================================================== */
.apple-icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  user-select: none;
}

.apple-icon-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.08) 40%, rgba(0, 0, 0, 0.12) 100%);
  pointer-events: none;
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1.5px 2px 0 rgba(0, 0, 0, 0.2);
}

.apple-icon-tile svg {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1.5px 2.5px rgba(0, 0, 0, 0.25));
}

/* Tamaños de Tile */
.apple-icon-tile-sm { width: 32px; height: 32px; border-radius: 9px; }
.apple-icon-tile-sm svg { width: 17px; height: 17px; }

.apple-icon-tile-md { width: 42px; height: 42px; border-radius: 12px; }
.apple-icon-tile-md svg { width: 22px; height: 22px; }

.apple-icon-tile-lg { width: 50px; height: 50px; border-radius: 14px; }
.apple-icon-tile-lg svg { width: 26px; height: 26px; }

.apple-icon-tile-xl { width: 60px; height: 60px; border-radius: 18px; }
.apple-icon-tile-xl svg { width: 32px; height: 32px; }

/* Paletas de Gradientes 3D Apple */
.tile-gradient-red {
  background: linear-gradient(145deg, #FF453A 0%, #FF3B30 45%, #D70015 100%);
  box-shadow: 0 4px 12px -2px rgba(255, 59, 48, 0.45);
}

.tile-gradient-orange {
  background: linear-gradient(145deg, #FF9F0A 0%, #FF9500 50%, #C93400 100%);
  box-shadow: 0 4px 12px -2px rgba(255, 149, 0, 0.45);
}

.tile-gradient-green {
  background: linear-gradient(145deg, #30D158 0%, #34C759 50%, #248A3D 100%);
  box-shadow: 0 4px 12px -2px rgba(52, 199, 89, 0.45);
}

.tile-gradient-mint {
  background: linear-gradient(145deg, #63E6E2 0%, #00C7BE 50%, #007D77 100%);
  box-shadow: 0 4px 12px -2px rgba(0, 199, 190, 0.4);
}

.tile-gradient-cyan {
  background: linear-gradient(145deg, #70D7FF 0%, #32ADE6 50%, #0071A4 100%);
  box-shadow: 0 4px 12px -2px rgba(50, 173, 230, 0.4);
}

.tile-gradient-blue {
  background: linear-gradient(145deg, #409CFF 0%, #0071E3 50%, #0040DD 100%);
  box-shadow: 0 4px 14px -2px rgba(0, 113, 227, 0.45);
}

.tile-gradient-indigo {
  background: linear-gradient(145deg, #7D7AFF 0%, #5856D6 50%, #3634A3 100%);
  box-shadow: 0 4px 12px -2px rgba(88, 86, 214, 0.45);
}

.tile-gradient-purple {
  background: linear-gradient(145deg, #DA8FFF 0%, #AF52DE 50%, #8944AB 100%);
  box-shadow: 0 4px 12px -2px rgba(175, 82, 222, 0.45);
}

.tile-gradient-pink {
  background: linear-gradient(145deg, #FF6482 0%, #FF2D55 50%, #D30F4B 100%);
  box-shadow: 0 4px 12px -2px rgba(255, 45, 85, 0.45);
}

.tile-gradient-gold {
  background: linear-gradient(145deg, #FFD60A 0%, #FFB340 50%, #D48800 100%);
  box-shadow: 0 4px 12px -2px rgba(255, 179, 64, 0.45);
}

.tile-gradient-slate {
  background: linear-gradient(145deg, #8E8E93 0%, #636366 50%, #3A3A3C 100%);
  box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.25);
}

.tile-gradient-dark {
  background: linear-gradient(145deg, #2C2C2E 0%, #1C1C1E 60%, #000000 100%);
  box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
}

/* Squircles Apple */
.rounded-squircle-sm { border-radius: 14px; }
.rounded-squircle-md { border-radius: 20px; }
.rounded-squircle-lg { border-radius: 28px; }
.rounded-full { border-radius: 9999px; }

/* Tarjetas Apple HIG */
.apple-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-spring);
}

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

.apple-card-static {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

/* Botones Apple con Tacto Háptico */
.apple-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  border-radius: 9999px;
  border: none;
  cursor: pointer;
  background: var(--apple-blue);
  color: #ffffff;
  transition: var(--transition-spring);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1.2;
}

.apple-btn:hover {
  background: var(--apple-blue-hover);
  transform: translateY(-1px);
}

.apple-btn:active {
  transform: scale(0.97);
}

.apple-btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  box-shadow: none;
}

[data-theme="dark"] .apple-btn-secondary {
  background: rgba(255, 255, 255, 0.1);
}

.apple-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .apple-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.apple-btn-success {
  background: var(--apple-green);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.25);
}

.apple-btn-danger {
  background: var(--apple-red);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
}

/* Campos de Entrada Apple */
.apple-input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  outline: none;
  transition: var(--transition-spring);
  box-shadow: var(--shadow-sm);
}

.apple-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.18);
}

/* Animación Apple Shake en errores de 2FA / formularios */
@keyframes apple-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.animate-apple-shake {
  animation: apple-shake 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Checkbox Toggle Táctil para Hábitos Diarios */
.habit-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-spring);
}

@media (min-width: 640px) {
  .habit-toggle {
    padding: 12px 18px;
  }
}

.habit-toggle:hover {
  border-color: rgba(0, 113, 227, 0.3);
  transform: translateY(-1px);
}

.habit-toggle.completed {
  background: rgba(52, 199, 89, 0.08);
  border-color: var(--apple-green);
}

[data-theme="dark"] .habit-toggle.completed {
  background: rgba(50, 215, 75, 0.12);
  border-color: var(--apple-green);
}

.habit-check-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 0, 0, 0.16);
  background: rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .habit-check-icon {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.habit-check-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 3.2;
  stroke: currentColor;
  transform: scale(0.6);
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.habit-toggle.completed .habit-check-icon {
  background: linear-gradient(135deg, #30D158 0%, #34C759 50%, #248A3D 100%);
  border-color: #34C759;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.habit-toggle.completed .habit-check-icon svg {
  transform: scale(1);
  opacity: 1;
}

/* Anillos de Actividad de Fitness Apple Watch */
.rings-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 190px;
  height: 190px;
  margin: 0 auto;
}

.ring-bg {
  fill: none;
  opacity: 0.18;
}

.ring-progress {
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* Insignias / Pills */
.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pill-blue { background: rgba(0, 113, 227, 0.1); color: var(--apple-blue); }
.pill-green { background: rgba(52, 199, 89, 0.12); color: var(--apple-green); }
.pill-orange { background: rgba(255, 149, 0, 0.12); color: var(--apple-orange); }
.pill-red { background: rgba(255, 59, 48, 0.12); color: var(--apple-red); }
.pill-purple { background: rgba(175, 82, 222, 0.12); color: var(--apple-purple); }

/* Calendario / Mapa de Calor de Constancia */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.heatmap-day {
  aspect-ratio: 1;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition-spring);
  border: 1px solid transparent;
}

[data-theme="dark"] .heatmap-day {
  background: rgba(255, 255, 255, 0.05);
}

.heatmap-day.score-4 {
  background: #34c759;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.4);
}

.heatmap-day.score-3 {
  background: rgba(52, 199, 89, 0.75);
  color: #ffffff;
}

.heatmap-day.score-2 {
  background: rgba(52, 199, 89, 0.45);
  color: #1d1d1f;
}

.heatmap-day.score-1 {
  background: rgba(52, 199, 89, 0.22);
}

.heatmap-day.today {
  border-color: var(--apple-blue);
  box-shadow: 0 0 0 2px var(--apple-blue);
}

/* Modales Flotantes Apple */
.apple-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.apple-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.apple-modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card-solid);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border-subtle);
  transform: scale(0.95);
  transition: transform 0.25s var(--ease-apple-spring);
}

.apple-modal-overlay.active .apple-modal {
  transform: scale(1);
}

/* Animaciones suaves para transiciones de vista */
.view-section {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.view-section.active {
  display: block;
}

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

/* Utilidades para responsive */
.max-w-content {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

@media (min-width: 640px) {
  .max-w-content {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* =====================================================================
 * ESTILOS PARA EL CONSTRUCTOR VISUAL DE ENTRENAMIENTO Y DIETA
 * ===================================================================== */
.day-selector-container {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.day-selector-container::-webkit-scrollbar {
  display: none;
}

.day-pill {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: var(--transition-spring);
}

[data-theme="dark"] .day-pill {
  background: rgba(255, 255, 255, 0.06);
}

.day-pill:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.08);
}

.day-pill.active {
  background: var(--apple-blue);
  color: #ffffff;
  border-color: var(--apple-blue);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.3);
}

/* =====================================================================
 * PESTAÑAS SEGMENTADAS VISTA ATLETA: EJERCICIOS vs DIETA vs SUPLEMENTOS
 * ===================================================================== */
.athlete-plan-segmented-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  max-width: 580px;
  margin: 0 auto 1.25rem auto;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .athlete-plan-segmented-tabs {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ath-plan-tab-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  border: none;
  outline: none;
  user-select: none;
}

.ath-plan-tab-btn .apple-3d-icon {
  width: 20px;
  height: 20px;
}

.ath-plan-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .ath-plan-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ath-plan-tab-btn.active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.06);
  font-weight: 700;
}

[data-theme="dark"] .ath-plan-tab-btn.active {
  background: #2c2c2e;
  color: #ffffff;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.ath-plan-tab-btn .tab-label-short {
  display: none;
}
.ath-plan-tab-btn .tab-label-full {
  display: inline;
}

@media (max-width: 639px) {
  .athlete-plan-segmented-tabs {
    padding: 3px;
    gap: 3px;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  .ath-plan-tab-btn {
    padding: 8px 6px;
    font-size: 12px;
    gap: 5px;
  }
  .ath-plan-tab-btn .apple-3d-icon {
    width: 17px;
    height: 17px;
  }
  .ath-plan-tab-btn .tab-label-short {
    display: inline;
  }
  .ath-plan-tab-btn .tab-label-full {
    display: none;
  }
}

.ath-plan-section {
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* =====================================================================
 * PESTAÑAS DE NAVEGACIÓN MODAL PERFIL ATLETA (APPLE SEGMENTED CONTROLS)
 * ===================================================================== */
.ath-profile-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 9999px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

[data-theme="dark"] .ath-profile-tabs {
  background: rgba(255, 255, 255, 0.06);
}

.ath-profile-tabs::-webkit-scrollbar {
  display: none;
}

.ath-tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  border: none;
  outline: none;
  user-select: none;
}

@media (max-width: 639px) {
  .ath-profile-tabs {
    gap: 4px;
    padding: 3px;
  }
  .ath-tab-btn {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }
  .ath-tab-btn .apple-3d-icon {
    width: 16px !important;
    height: 16px !important;
  }
}

@media (min-width: 640px) {
  .ath-tab-btn {
    flex: 1;
  }
}

.ath-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] .ath-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ath-tab-btn.active {
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  font-weight: 700;
}

[data-theme="dark"] .ath-tab-btn.active {
  background: #2c2c2e;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 0, 0, 0.1);
  color: #ff0000;
  text-decoration: none;
  transition: var(--transition-spring);
}

.yt-btn:hover {
  background: rgba(255, 0, 0, 0.18);
  transform: translateY(-1px);
}

.exercise-builder-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-spring);
  overflow: hidden;
  word-break: break-word;
}

.exercise-builder-card:hover {
  border-color: rgba(0, 113, 227, 0.25);
}

/* =====================================================================
 * ESTILOS PARA SUPERSERIES Y EJERCICIOS COMBINADOS
 * ===================================================================== */
.superserie-container {
  border-left: 3px solid #ff9500;
  background: rgba(255, 149, 0, 0.03);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 14px;
  border-top: 1px solid rgba(255, 149, 0, 0.15);
  border-right: 1px solid rgba(255, 149, 0, 0.15);
  border-bottom: 1px solid rgba(255, 149, 0, 0.15);
  box-shadow: 0 2px 10px rgba(255, 149, 0, 0.05);
  overflow: hidden;
  word-break: break-word;
}

[data-theme="dark"] .superserie-container {
  background: rgba(255, 149, 0, 0.05);
  border-left-color: #ff9f0a;
  border-top-color: rgba(255, 159, 10, 0.2);
  border-right-color: rgba(255, 159, 10, 0.2);
  border-bottom-color: rgba(255, 159, 10, 0.2);
}

.superserie-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 149, 0, 0.15);
  color: #d97706;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  max-width: 100%;
}

[data-theme="dark"] .superserie-badge {
  background: rgba(255, 159, 10, 0.2);
  color: #ff9f0a;
}

.superserie-item {
  position: relative;
  border-left: 2px dashed rgba(255, 149, 0, 0.35);
  margin-left: 6px;
  padding-left: 12px;
}

.superserie-item:last-child {
  border-left-color: transparent;
}

.food-builder-row {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition-spring);
}

@media (min-width: 640px) {
  .food-builder-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.macro-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .macro-tag {
  background: rgba(255, 255, 255, 0.08);
}

.builder-modal-dialog {
  width: 96%;
  max-width: 940px;
  max-height: 94vh;
  padding: 24px;
}

#modal-athlete-profile {
  z-index: 150;
}

#modal-past-plans {
  z-index: 180;
}

#modal-assign-plan {
  z-index: 200;
}

#modal-pick-exercise,
#modal-pick-food {
  z-index: 210;
}

#modal-view-plan-detail {
  z-index: 220;
}

#modal-exercise-detail {
  z-index: 230;
}

.day-pill-count {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.08);
  margin-left: 5px;
  font-weight: 700;
}

.day-pill.active .day-pill-count {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

[data-theme="dark"] .day-pill-count {
  background: rgba(255, 255, 255, 0.15);
}

.embedded-indexer-panel {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.25s var(--ease-apple-spring);
}

[data-theme="dark"] .embedded-indexer-panel {
  background: rgba(255, 255, 255, 0.03);
}

/* =====================================================================
   ESTILOS DE FOTOS DE EVOLUCIÓN CORPORAL & PROGRESIÓN (APPLE HIG)
   ===================================================================== */
.photo-thumb-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  aspect-ratio: 3 / 4;
}

.photo-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.photo-thumb-remove:hover {
  background: #ff3b30;
  transform: scale(1.1);
}

.photo-thumb-angle-select {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: #1d1d1f;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
  padding: 2px 4px;
  border: none;
  backdrop-filter: blur(8px);
}

[data-theme="dark"] .photo-thumb-angle-select {
  background: rgba(44, 44, 46, 0.92);
  color: #f5f5f7;
}

.evolution-photo-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  transition: transform 0.28s var(--ease-apple-spring), box-shadow 0.28s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.evolution-photo-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.evolution-photo-card .photo-aspect-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #00000008;
}

.evolution-photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.evolution-photo-card:hover img {
  transform: scale(1.05);
}

.evolution-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.0) 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  color: #ffffff;
}

.comparison-card {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow: hidden;
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.comparison-card-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  object-fit: cover;
  background: #00000008;
}

/* =====================================================================
   OPTIMIZACIONES MÓVILES RESPONSIVE & EXPERIENCIA DE USUARIO (APPLE HIG)
   ===================================================================== */
@media (max-width: 640px) {
  /* Evitar auto-zoom en iOS Safari al tocar inputs */
  .apple-input, select.apple-input, textarea.apple-input {
    font-size: 16px !important;
  }

  /* Modales optimizados para pantallas estrechas */
  .apple-modal {
    width: 95% !important;
    max-width: 95% !important;
    padding: 20px 16px !important;
    border-radius: 24px !important;
    max-height: 92vh !important;
  }

  .builder-modal-dialog {
    width: 95% !important;
    max-width: 95% !important;
    padding: 16px 14px !important;
    max-height: 94vh !important;
  }

  /* Tarjetas con espaciado móvil equilibrado y cero desbordamientos */
  .apple-card {
    padding: 14px 12px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    word-break: break-word !important;
  }

  .exercise-builder-card {
    padding: 12px 12px !important;
    border-radius: 14px !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
    word-break: break-word !important;
  }

  .superserie-container {
    padding: 10px 10px 12px 10px !important;
    border-radius: 14px !important;
    margin-bottom: 10px !important;
    overflow: hidden !important;
    word-break: break-word !important;
  }

  .superserie-container .exercise-builder-card {
    padding: 10px 10px !important;
    border-radius: 12px !important;
  }

  .superserie-badge {
    font-size: 9px !important;
    padding: 2.5px 7px !important;
  }

  /* Botones que nunca se deforman ni desbordan texto */
  .apple-btn {
    font-size: 12px !important;
    padding: 8px 14px !important;
    min-height: 38px !important;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Barra de navegación inferior móvil */
  .frosted-tabbar {
    padding-top: 4px;
    padding-bottom: env(safe-area-inset-bottom, 6px);
  }

  .frosted-tabbar .nav-tab-btn {
    padding: 3px 2px !important;
    font-size: 9px !important;
  }

  .frosted-tabbar .nav-tab-btn .tab-icon-wrapper {
    width: 24px !important;
    height: 24px !important;
  }

  .frosted-tabbar .nav-tab-btn .apple-3d-icon {
    width: 22px !important;
    height: 22px !important;
  }

  .frosted-tabbar .nav-tab-btn svg.tab-icon {
    width: 20px !important;
    height: 20px !important;
  }

  /* Evitar desbordamiento en selectores de pestañas de dos o tres botones */
  .rounded-full > button {
    font-size: 11px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}

/* ==========================================================================
   Visualizador Anatómico Muscular Interactivo (ExerciseDB)
   ========================================================================== */
.muscle-map-container {
  position: relative;
  width: 100%;
  max-width: 220px;
  height: 290px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 20px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

[data-theme="dark"] .muscle-map-container {
  background: rgba(255, 255, 255, 0.02);
}

.muscle-map-svg {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: 270px;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.08));
}

.muscle-part {
  transition: fill 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              stroke 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.muscle-part:hover {
  filter: brightness(1.25) drop-shadow(0 0 6px rgba(255, 55, 95, 0.75)) !important;
}

@keyframes cardioPulse {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.18); opacity: 1; }
}

.cardio-symbol {
  transform-origin: 50px 50px;
  animation: cardioPulse 1.3s ease-in-out infinite;
}

@media (max-width: 640px) {
  .muscle-map-container {
    max-width: 175px !important;
    height: 245px !important;
    padding: 6px !important;
  }
  .muscle-map-svg {
    max-height: 230px !important;
  }
}

/* ==========================================================================
   Subida de Fotos por Postura (Frontal, Perfil, Espalda)
   ========================================================================== */
.posture-slot-card {
  position: relative;
  aspect-ratio: 3 / 4;
  min-height: 105px;
  border-radius: 16px;
  border: 1.5px dashed rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

[data-theme="dark"] .posture-slot-card {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.posture-slot-card:hover {
  border-color: #0071e3;
  background: rgba(0, 113, 227, 0.04);
}

.posture-slot-card.filled {
  border-style: solid;
  border-color: rgba(48, 209, 88, 0.4);
  padding: 0;
  cursor: default;
}

.posture-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.posture-slot-badge {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.posture-slot-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 10;
}

.posture-slot-remove:hover {
  background: #ff375f;
  transform: scale(1.1);
}

/* Ocultar terminantemente la barra de navegación inferior en PC / Vista escritorio */
@media (min-width: 768px) {
  #mobile-tabbar,
  .frosted-tabbar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ==========================================================================
   Visor y Láser del Escáner de Códigos de Barras
   ========================================================================== */
@keyframes barcodeLaser {
  0% { top: 8%; opacity: 0.85; }
  50% { top: 88%; opacity: 1; }
  100% { top: 8%; opacity: 0.85; }
}

.barcode-laser-line {
  position: absolute;
  left: 4%;
  right: 4%;
  height: 2.5px;
  background: linear-gradient(90deg, transparent, #ff3b30, #ff453a, #ff3b30, transparent);
  box-shadow: 0 0 14px rgba(255, 59, 48, 0.95), 0 0 4px #ffffff;
  border-radius: 2px;
  animation: barcodeLaser 2.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 15;
}

#html5-barcode-scanner-view video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 14px !important;
}

#html5-barcode-scanner-view {
  border: none !important;
}

#html5-barcode-scanner-view__scan_region {
  min-height: 220px !important;
}
