/* ==============================================================
   GIMNASIA RÍTMICA CASTROVIEJO - SISTEMA DE DISEÑO LIGHT & MOBILE-FIRST
   ============================================================== */

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

:root {
  /* Paleta Oficial Club Gimnasia Rítmica Castroviejo (#fe6b23) */
  --primary: #fe6b23;
  --primary-hover: #e05510;
  --primary-dark: #c44305;
  --primary-light: #fff3ec;
  --primary-tint: #ffcca8;
  
  --secondary: #d97706;
  --secondary-hover: #b45309;
  --secondary-light: #fef3c7;

  --accent-gold: #f59e0b;
  --accent-gold-light: #fef3c7;

  /* Fondos y Superficies Modo Claro */
  --bg-app: #fcfbfa;
  --bg-page: #faf8f5;
  --bg-card: #ffffff;
  --bg-card-hover: #fffaf7;
  --bg-subtle: #f4f1ed;

  /* Tipografía y Textos */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;
  --text-inverse: #ffffff;

  /* Bordes y Sombras */
  --border-subtle: #e4e4e7;
  --border-focus: #fdba74;
  --shadow-sm: 0 1px 3px rgba(254, 107, 35, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 14px rgba(254, 107, 35, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(254, 107, 35, 0.14), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 12px 32px rgba(254, 107, 35, 0.22);

  /* Estados de Asistencia */
  --status-presente: #10B981;
  --status-falta: #EF4444;
  --status-retraso: #F59E0B;
  --status-enferma: #8B5CF6;
  --status-lesion: #EC4899;
  --status-justificada: #3B82F6;

  /* Radio de curvatura moderno */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Dimensiones Ergonomía Móvil */
  --header-height: 64px;
  --bottom-bar-height: 68px;
  --touch-target: 48px;

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

/* Reset Global & Ergonomía Táctil */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Estructura de la Aplicación */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Cabecera Superior */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-logo-img {
  width: auto;
  max-width: 52px;
  height: 38px;
  object-fit: contain;
  background: var(--primary);
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(254, 107, 35, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary) 0%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Indicador de Estado de Conexión (Offline/Online) */
.network-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  transition: var(--transition);
}

.network-indicator.online {
  background-color: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.network-indicator.offline {
  background-color: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  animation: pulse 2s infinite;
}

.network-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.network-indicator.online .network-dot {
  background-color: #10B981;
}

.network-indicator.offline .network-dot {
  background-color: #EF4444;
}

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

/* Contenido Principal */
.main-content {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--bottom-bar-height) + 24px) 16px;
}

@media (min-width: 768px) {
  .main-content {
    padding: 24px 24px calc(var(--bottom-bar-height) + 32px) 24px;
  }
}

/* Barra de Navegación Inferior (Mobile Thumb Bar) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px calc(env(safe-area-inset-bottom, 0px) + 2px);
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  gap: 4px;
  flex: 1;
  height: 100%;
  transition: var(--transition);
  border-radius: var(--radius-md);
  position: relative;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active svg {
  transform: translateY(-2px);
  stroke: var(--primary);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 16px;
  height: 3px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

.nav-item:active {
  transform: scale(0.92);
}

/* Notificación Flotante (Toast) */
.toast-container {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 400px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

.toast.success {
  border-left: 4px solid var(--status-presente);
}

.toast.error {
  border-left: 4px solid var(--status-falta);
}

.toast.info {
  border-left: 4px solid var(--primary);
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Banner de instalación PWA */
.pwa-install-banner {
  background: linear-gradient(135deg, #FFF3EC 0%, #FFF8F5 100%);
  border: 1px solid var(--primary-tint);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.pwa-install-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: white;
  border: 1px solid var(--primary-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(254, 107, 35, 0.15);
}

.pwa-icon-box img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.pwa-install-text h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pwa-install-text p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.btn-install {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(254, 107, 35, 0.35);
  transition: var(--transition);
}

.btn-install:active {
  transform: scale(0.95);
}
