/* ESTUDIO FITNESS - DESIGN SYSTEM v4 (DARK OBSIDIAN + NEON RED + WORKOUT LOGGER) */

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

:root {
  --bg-dark: #070709;
  --bg-card: rgba(20, 20, 26, 0.88);
  --bg-card-hover: rgba(30, 30, 38, 0.95);
  --bg-card-solid: #14141a;
  --border-color: rgba(255, 255, 255, 0.12);
  --border-highlight: rgba(255, 46, 46, 0.5);

  --red-primary: #ff2e2e;
  --red-dark: #b30000;
  --green-active: #10b981;
  --yellow-warning: #f59e0b;
  --blue-info: #3b82f6;
  --text-white: #ffffff;
  --text-gray: #a1a1aa;
  --text-muted: #71717a;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-glow: 0 0 25px rgba(255, 46, 46, 0.35);
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

#app {
  width: 100%;
  max-width: 1200px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 40px;
}

/* HEADER */
.app-header {
  background: rgba(7, 7, 9, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky; top: 0; z-index: 100;
  /* iOS: reservar el safe area superior (notch / Dynamic Island) sin parches
     por modelo. env(safe-area-inset-top) es 0 en Android/navegador normal,
     así que este mismo padding funciona en todas las plataformas. */
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}

/* Logo + título: PUEDE achicarse/truncar (min-width:0 + ellipsis) para
   cederle espacio a los botones de la derecha. El logo nunca se achica. */
.brand-wrapper {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  min-width: 0; flex-shrink: 1; overflow: hidden;
}

.brand-logo {
  height: 40px; width: auto; flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(255, 46, 46, 0.5));
}

.brand-title {
  font-size: 1.25rem; font-weight: 900; letter-spacing: 1px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

.brand-title span { color: var(--red-primary); }

/* Usuario + campanita + salir: ocupa el espacio restante (flex:1) y dentro
   de él, SOLO el badge de usuario puede achicarse/truncar. La campanita y
   "Salir" quedan con flex-shrink:0 -> NUNCA se salen de la pantalla, sin
   importar cuán largo sea el nombre del usuario ni el ancho del viewport. */
.header-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  flex: 1 1 auto; min-width: 0;
}

/* Badge de usuario dentro del header: único lugar donde el badge trunca
   (no afecta a los demás badges de la app, como "ACTIVA"/"INACTIVA"). */
.header-user-badge {
  min-width: 0; max-width: 150px; flex-shrink: 1;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  display: inline-block;
}

/* BOTÓN-ÍCONO CIRCULAR (campanita de notificaciones): tamaño táctil mínimo
   recomendado (~44px) para que quede fácil de tocar y completamente visible.
   flex-shrink:0 en header-actions garantiza que nunca se recorte. */
.btn-icon {
  width: 44px; height: 44px; padding: 0;
  border-radius: 50%;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.notif-bell-btn { position: relative; }

/* Punto/indicador de "push no activado todavía" (reemplaza al texto "Activar Push") */
.notif-bell-dot {
  position: absolute; top: 3px; right: 3px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--yellow-warning);
  border: 2px solid var(--bg-dark);
  pointer-events: none;
}

.header-logout-btn { flex-shrink: 0; }

/* BADGES */
.badge {
  padding: 5px 12px; border-radius: 20px;
  font-size: 0.78rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; display: inline-flex; align-items: center; gap: 6px;
}

.badge-active { background: rgba(16, 185, 129, 0.18); color: var(--green-active); border: 1px solid rgba(16, 185, 129, 0.4); }
.badge-warning { background: rgba(245, 158, 11, 0.18); color: var(--yellow-warning); border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-expired { background: rgba(255, 46, 46, 0.18); color: var(--red-primary); border: 1px solid rgba(255, 46, 46, 0.4); }
.badge-info { background: rgba(59, 130, 246, 0.18); color: var(--blue-info); border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-role { background: rgba(255, 255, 255, 0.08); color: var(--text-gray); border: 1px solid var(--border-color); }

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

.btn-primary {
  background: linear-gradient(135deg, var(--red-primary), var(--red-dark));
  color: #fff; box-shadow: var(--shadow-glow);
}

.btn-primary:hover, .btn-primary:active {
  transform: translateY(-2px); box-shadow: 0 0 35px rgba(255, 46, 46, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08); color: var(--text-white); border: 1px solid var(--border-color);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* LOGIN */
.login-container {
  max-width: 430px; margin: 30px auto; width: 92%;
  background: var(--bg-card); backdrop-filter: blur(20px);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  padding: 32px 24px; text-align: center; box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  animation: fadeIn 0.4s ease;
}

.login-logo { width: 170px; margin-bottom: 20px; }
.login-title { font-size: 1.5rem; font-weight: 900; margin-bottom: 6px; }
.login-subtitle { color: var(--text-gray); font-size: 0.92rem; margin-bottom: 24px; }

.form-group { margin-bottom: 18px; text-align: left; }
.form-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--text-gray); margin-bottom: 6px; text-transform: uppercase; }
.form-input {
  width: 100%; padding: 14px 16px; background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: #fff; font-size: 1rem; transition: border-color var(--transition-fast);
}

.form-input:focus { outline: none; border-color: var(--red-primary); box-shadow: 0 0 12px rgba(255, 46, 46, 0.3); }

/* SISTEMA PROFESIONAL DE ENTRENAMIENTO POR SERIES */
.workout-session-container {
  padding: 16px; max-width: 800px; margin: 0 auto; width: 100%;
}

.exercise-block {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 18px; margin-bottom: 20px;
}

.target-box {
  background: rgba(255, 46, 46, 0.1); border-left: 4px solid var(--red-primary);
  padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 12px 0 16px;
}

.target-title { font-size: 0.78rem; text-transform: uppercase; font-weight: 800; color: var(--red-primary); margin-bottom: 4px; }
.target-stats { font-size: 1rem; font-weight: 800; color: #fff; }

.sets-table-header {
  display: grid; grid-template-columns: 80px 1fr 1fr; gap: 10px;
  padding: 8px 12px; background: rgba(0, 0, 0, 0.4); border-radius: 6px;
  font-size: 0.75rem; font-weight: 800; text-transform: uppercase; color: var(--text-gray); margin-bottom: 8px; text-align: center;
}

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

.set-label { font-weight: 800; font-size: 0.9rem; color: var(--text-gray); }

.set-input {
  width: 100%; padding: 10px; background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color); border-radius: 8px; color: #fff;
  font-size: 1.05rem; font-weight: 800; text-align: center;
}

.set-input:focus { border-color: var(--green-active); }

/* MULTILINE TEXTAREA PARA COMENTARIOS */
.exercise-textarea {
  width: 100%; min-height: 80px; padding: 12px; background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm);
  color: #fff; font-size: 0.9rem; resize: vertical; margin-top: 10px;
}

.exercise-textarea:focus { outline: none; border-color: var(--red-primary); }

/* BANNER DE NOTIFICACIÓN PROMPT */
.push-prompt-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(20, 20, 26, 0.9));
  border: 1px solid rgba(59, 130, 246, 0.4); border-radius: var(--radius-md);
  padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 14px; flex-wrap: wrap;
}

/* HISTORIAL DESPLEGABLE */
.history-item-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px; margin-bottom: 14px;
}

/* NUEVA NAVEGACIÓN MOBILE-FIRST POR TARJETAS GRANDES */
.client-dashboard, .trainer-dashboard {
  width: 100%; max-width: 650px; margin: 0 auto;
  padding: 16px; box-sizing: border-box;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.nav-breadcrumb-btn {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text-gray); font-size: 0.92rem; font-weight: 800;
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-color);
  padding: 8px 14px; border-radius: 20px; cursor: pointer;
  margin-bottom: 16px; transition: all var(--transition-fast);
}

.nav-breadcrumb-btn:active {
  background: rgba(255, 255, 255, 0.15); color: #fff;
}

.routine-select-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px; margin-bottom: 16px;
  cursor: pointer; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.routine-select-card:active {
  transform: scale(0.98);
  border-color: var(--border-highlight);
}

.routine-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}

.routine-card-title {
  font-size: 1.35rem; font-weight: 900; color: #fff; line-height: 1.25;
}

.routine-card-subtitle {
  font-size: 0.88rem; color: var(--text-gray);
}

.routine-card-days-count {
  font-size: 0.85rem; font-weight: 800; color: var(--red-primary);
  display: flex; align-items: center; gap: 6px;
}

.day-select-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px; margin-bottom: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.day-select-card:active {
  transform: scale(0.98);
  border-color: var(--red-primary);
}

.day-card-info {
  display: flex; flex-direction: column; gap: 4px;
}

.day-card-number {
  font-size: 0.78rem; font-weight: 800; text-transform: uppercase; color: var(--red-primary); letter-spacing: 0.5px;
}

.day-card-name {
  font-size: 1.1rem; font-weight: 900; color: #fff;
}

.day-card-arrow {
  font-size: 1.2rem; color: var(--text-gray); font-weight: 900;
}

/* MODALES RESPONSIVOS MOBILE-FIRST */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow-y: auto;
}

.modal-content {
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 24px 20px;
  width: 100%; max-width: 650px; max-height: 90vh; overflow-y: auto; overflow-x: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; border-bottom: 1px solid var(--border-color); padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 1.25rem; font-weight: 900; color: #fff;
}

.close-btn {
  background: transparent; border: none; color: var(--text-gray);
  font-size: 1.8rem; cursor: pointer; line-height: 1; padding: 0 6px;
}

.close-btn:hover { color: #fff; }

/* REGISTRO DE SERIES DE ENTRENAMIENTO CON COMENTARIO POR SERIE */
.sets-table-header {
  display: grid; grid-template-columns: 55px 75px 85px 1fr; gap: 8px;
  padding: 8px 10px; background: rgba(0, 0, 0, 0.5); border-radius: 6px;
  font-size: 0.72rem; font-weight: 800; text-transform: uppercase; color: var(--text-gray); margin-bottom: 8px; text-align: center;
}

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

.set-label { font-weight: 800; font-size: 0.85rem; color: var(--text-gray); white-space: nowrap; }

.set-input {
  width: 100%; padding: 10px 6px; background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color); border-radius: 8px; color: #fff;
  font-size: 0.95rem; font-weight: 800; text-align: center; box-sizing: border-box;
}

.set-input:focus { border-color: var(--green-active); outline: none; }

.set-comment-input {
  text-align: left; font-size: 0.82rem; font-weight: 400; padding: 8px 10px;
}

/* NAVBAR Y TABS */
.tabs-container {
  display: flex; gap: 8px; background: rgba(0, 0, 0, 0.4);
  padding: 4px; border-radius: 30px; border: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1; padding: 10px 14px; border: none; border-radius: 24px;
  background: transparent; color: var(--text-gray); font-weight: 800;
  font-size: 0.88rem; cursor: pointer; transition: all var(--transition-fast);
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}

.tab-btn.active {
  background: var(--red-primary); color: #fff; box-shadow: var(--shadow-glow);
}

/* TOOLBAR Y DASHBOARD PROFESOR */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  padding: 14px 10px; border-radius: var(--radius-md); text-align: center;
}

.stat-card .val { font-size: 1.5rem; font-weight: 900; }
.stat-card .label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-gray); font-weight: 700; margin-top: 2px; }

.toolbar-section {
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px;
}

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

.alumnos-grid {
  display: grid; grid-template-columns: 1fr; gap: 14px;
  width: 100%; box-sizing: border-box;
}

.alumno-card-clickable {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px; cursor: pointer;
  transition: transform var(--transition-fast);
  width: 100%; box-sizing: border-box;
}

.alumno-card-clickable:active { transform: scale(0.99); }

/* CLASES UI FALTANTES */
.notif-drawer {
  position: fixed; top: calc(64px + env(safe-area-inset-top)); right: 12px;
  width: 330px; max-width: calc(100vw - 24px);
  background: var(--bg-card-solid); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 14px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85); z-index: 999;
  max-height: 75vh; overflow-y: auto; overflow-x: hidden;
  backdrop-filter: blur(12px);
}

.notif-item {
  padding: 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px; font-size: 0.85rem; margin-bottom: 6px;
  word-wrap: break-word; overflow-wrap: anywhere;
}

.notif-item.unread {
  background: rgba(255, 46, 46, 0.12);
  border-left: 3px solid var(--red-primary);
}

.demo-hints {
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); padding: 14px; margin-top: 18px;
  text-align: left; font-size: 0.82rem; color: var(--text-gray); line-height: 1.5;
}

.demo-hints code {
  background: rgba(255, 255, 255, 0.1); padding: 2px 6px;
  border-radius: 4px; color: #fff; font-family: monospace;
}

.routine-banner {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); padding: 16px; display: flex;
  align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; width: 100%; box-sizing: border-box;
}

.search-box { width: 100%; }

/* REGLAS MOBILE-FIRST PREVENCION ESTRICTA DE SCROLL HORIZONTAL (320px, 360px, 375px, 390px) */
@media (max-width: 600px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0; padding: 0;
  }

  #app {
    padding-bottom: 24px;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
  }

  .app-header { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; gap: 6px; }
  .header-actions { gap: 6px; }
  .header-user-badge { max-width: 92px; font-size: 0.68rem; padding: 4px 8px; }
  .header-logout-label { display: none; }
  #btnLogout { padding: 8px 10px; }
  .brand-title { font-size: 1.05rem; max-width: 120px; }
  .brand-logo { height: 32px; }
  .login-container { width: 94%; padding: 20px 14px; margin: 16px auto; }
  
  .workout-session-container { padding: 10px 6px; width: 100%; max-width: 100%; }
  .exercise-block { padding: 12px 10px; width: 100%; }

  .sets-table-header {
    grid-template-columns: 42px 55px 65px 1fr;
    gap: 4px; padding: 6px 4px; font-size: 0.62rem; width: 100%; box-sizing: border-box;
  }
  
  .set-row {
    grid-template-columns: 42px 55px 65px 1fr;
    gap: 4px; width: 100%; box-sizing: border-box;
  }
  
  .set-label { font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; }
  .set-input { padding: 6px 2px; font-size: 0.82rem; min-width: 0; }
  .set-comment-input { font-size: 0.75rem; padding: 6px 4px; min-width: 0; }
  
  .btn:not(.btn-icon):not(.header-logout-btn) { width: 100%; min-height: 46px; font-size: 0.92rem; }
  .header-logout-btn { width: auto; }
  .btn-sm { width: auto; min-height: 36px; padding: 6px 10px; font-size: 0.8rem; }
  
  .modal-overlay { padding: 8px; }
  .modal-content { padding: 16px 10px; width: 100%; max-width: 100vw; box-sizing: border-box; }
}

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

/* BOTTOM NAVIGATION BAR (mobile-first, estilo apps nativas) */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(14, 14, 18, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  max-width: 1200px;
  margin: 0 auto;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--text-gray);
  opacity: 0.65;
  transition: all var(--transition-fast);
}

.bottom-nav-item:active {
  opacity: 1;
}

.bottom-nav-item.active {
  color: var(--red-primary);
  opacity: 1;
}

.bottom-nav-icon {
  position: relative;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}

.bottom-nav-icon svg {
  width: 22px; height: 22px;
}

.bottom-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.bottom-nav-badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--red-primary);
  color: #fff;
  border-radius: 50%;
  width: 16px; height: 16px;
  font-size: 0.62rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}

/* 5 ítems en el Bottom Nav del alumno (Rutinas / Mías / Ranking / Historial / Avisos) */
@media (max-width: 420px) {
  .bottom-nav-label { font-size: 0.6rem; }
  .bottom-nav-icon { width: 20px; height: 20px; }
  .bottom-nav-icon svg { width: 19px; height: 19px; }
  .bottom-nav-item { padding: 6px 2px; }

  .header-user-badge { max-width: 68px; font-size: 0.64rem; padding: 4px 6px; }
  .brand-title { max-width: 88px; font-size: 0.95rem; }
}

/* Refuerzo para pantallas extremadamente angostas (iPhone SE 1ra gen, 320px) */
@media (max-width: 340px) {
  .header-user-badge { max-width: 46px; }
  .brand-title { max-width: 64px; font-size: 0.88rem; }
  .brand-logo { height: 28px; }
  .app-header { padding-left: 8px; padding-right: 8px; }
  .header-actions { gap: 4px; }
}

/* BANNER DE CUENTA PENDIENTE (feature "Mis Rutinas": ya no bloquea el acceso) */
.pending-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(20, 20, 26, 0.9));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--text-gray);
  line-height: 1.5;
}

.pending-banner strong { color: #fff; }

/* BANNER "INSTALAR APLICACIÓN" (beforeinstallprompt) */
.install-pwa-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(135deg, rgba(255, 46, 46, 0.14), rgba(20, 20, 26, 0.9));
  border: 1px solid rgba(255, 46, 46, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 0 16px 16px;
}
.install-pwa-text { min-width: 0; }
.install-pwa-title { font-weight: 800; font-size: 0.92rem; color: #fff; }
.install-pwa-subtitle { font-size: 0.78rem; color: var(--text-gray); margin-top: 2px; line-height: 1.4; }
.install-pwa-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.install-pwa-actions .btn-sm { padding: 8px 14px; white-space: nowrap; }
.install-pwa-actions .btn-icon { width: 32px; height: 32px; padding: 0; font-size: 0.85rem; }

@media (max-width: 420px) {
  .install-pwa-banner { flex-direction: column; align-items: stretch; margin: 0 10px 14px; }
  .install-pwa-actions { justify-content: flex-end; }
}

/* FEATURE VIDEOS EXPLICATIVOS EN EJERCICIOS */
.btn-video-demo {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: var(--blue-info);
  font-weight: 800; font-size: 0.82rem;
  padding: 8px 14px; border-radius: 20px;
  text-decoration: none; margin-top: 4px;
  transition: all var(--transition-fast);
}

.btn-video-demo:hover, .btn-video-demo:active {
  background: rgba(59, 130, 246, 0.28);
  transform: translateY(-1px);
}

/* FEATURE "MIS RUTINAS": variante de tarjeta auto-gestionada */
.routine-propia-card {
  border-color: rgba(59, 130, 246, 0.3);
}

/* FEATURE RANKING EN TIEMPO REAL */
.ranking-list {
  display: flex; flex-direction: column; gap: 10px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.ranking-pos {
  font-size: 1.3rem; font-weight: 900; text-align: center;
}

.ranking-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.ranking-name {
  font-size: 0.98rem; font-weight: 800; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ranking-streak {
  font-size: 0.75rem; color: var(--yellow-warning); font-weight: 700;
}

.ranking-points {
  font-size: 1rem; font-weight: 900; color: var(--red-primary);
  white-space: nowrap;
}

.ranking-row-me {
  border-color: var(--red-primary);
  box-shadow: 0 0 0 1px var(--red-primary) inset;
}

.ranking-row-top1 {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), var(--bg-card));
  border-color: rgba(245, 158, 11, 0.5);
}

.ranking-row-top2 {
  background: linear-gradient(135deg, rgba(161, 161, 170, 0.16), var(--bg-card));
  border-color: rgba(161, 161, 170, 0.5);
}

.ranking-row-top3 {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.16), var(--bg-card));
  border-color: rgba(180, 83, 9, 0.5);
}