/* ============================================================
   MOBILE-FRICTION-FIX-1.0
   Pulido preventivo de fricción mobile.

   Alcance:
   - No cambia rutas, permisos, sesiones, SQL ni pagos.
   - Refuerza lectura, touch targets, tablas con scroll y formularios.
   - Aplica sobre navegación por rol, admin, públicas críticas,
     inscripción, resultados/rankings y paneles certificados.
   ============================================================ */

:root{
  --rh-mobile-safe-bottom: max(14px, env(safe-area-inset-bottom));
  --rh-mobile-touch: 44px;
  --rh-mobile-touch-large: 48px;
  --rh-mobile-radius: 18px;
  --rh-mobile-line: rgba(148,163,184,.20);
  --rh-mobile-surface: rgba(15,23,42,.72);
}

html{
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

body{
  overflow-x:hidden;
}

img,svg,video,canvas{
  max-width:100%;
}

input,select,textarea,button{
  font:inherit;
}

button,
a,
input,
select,
textarea,
[role="button"]{
  touch-action:manipulation;
}

:focus-visible{
  outline:3px solid rgba(103,232,249,.72);
  outline-offset:3px;
}

@media (max-width:900px){
  html{
    scroll-padding-top:76px;
  }

  body{
    min-width:0;
  }

  input,
  select,
  textarea{
    min-height:var(--rh-mobile-touch) !important;
    font-size:16px !important;
    line-height:1.3 !important;
  }

  textarea{
    min-height:96px !important;
  }

  button,
  .btn,
  .button,
  .ped-btn,
  .rh-btn,
  .rh-cta,
  .rh-public-events-btn,
  .rh-registration-btn,
  .rh-auth-btn,
  .rh-admin-side-action,
  .rh-pme-badge,
  .rh-pof-badge{
    min-height:var(--rh-mobile-touch) !important;
  }

  .ped-btn,
  .rh-public-events-btn,
  .rh-registration-btn,
  .rh-auth-btn{
    white-space:normal !important;
    text-align:center !important;
  }

  .rh-ath-mobile-toggle,
  .rh-team-mobile-toggle,
  .rh-admin-mobile-toggle,
  .rh-topbar-menu-btn{
    min-height:var(--rh-mobile-touch-large) !important;
    max-width:calc(100vw - 20px) !important;
  }

  .rh-ath-mobile-drawer,
  .rh-team-mobile-drawer,
  .rh-topbar-mobile-panel,
  .rh-admin-sidebar-v2{
    overscroll-behavior:contain !important;
    -webkit-overflow-scrolling:touch !important;
    padding-bottom:calc(18px + var(--rh-mobile-safe-bottom)) !important;
  }

  .rh-ath-mobile-body,
  .rh-team-mobile-body,
  .rh-topbar-mobile-body{
    padding-bottom:calc(22px + var(--rh-mobile-safe-bottom)) !important;
  }

  .rh-ath-sidebar-link,
  .rh-team-sidebar-link,
  .rh-ec-sidebar-link,
  .rh-admin-menu-link,
  .rh-topbar-mobile-link{
    min-height:46px !important;
  }

  .rh-admin-menu-summary{
    min-height:50px !important;
  }

  .rh-admin-side-nav,
  .rh-ath-sidebar-nav,
  .rh-team-sidebar-nav,
  .rh-ec-sidebar-nav{
    gap:8px !important;
  }

  .rh-mobile-table-frame,
  .table-wrap,
  .rh-table-wrap,
  .rh-pme-table-wrap,
  .rh-pof-table-wrap,
  .rh-admin-table-wrap,
  .ped-table-wrap,
  .classification-table-wrap,
  .rankings-table-wrap,
  .registration-table-wrap,
  .rh-registration-table-wrap,
  .rh-scroll-table,
  .rh-table-scroll,
  .table-responsive,
  .responsive-table{
    max-width:100% !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    -webkit-overflow-scrolling:touch !important;
    touch-action:pan-x pan-y !important;
    border-radius:var(--rh-mobile-radius) !important;
  }

  table{
    max-width:none;
  }

  .rh-mobile-scroll-hint,
  .rh-table-scroll-hint{
    display:block !important;
    margin:0 0 8px !important;
    color:#94a3b8 !important;
    font-size:12px !important;
    font-weight:800 !important;
  }

  .ped-mobile-cta{
    padding-bottom:var(--rh-mobile-safe-bottom) !important;
  }

  .ped-mobile-cta .ped-btn{
    min-height:46px !important;
  }

  .ped-hero__actions,
  .rh-public-events-actions,
  .rh-home-actions,
  .rh-registration-actions,
  .rh-auth-actions{
    gap:10px !important;
  }

  .ped-panel,
  .ped-side-card,
  .ped-conversion-card,
  .rh-public-events-card,
  .rh-registration-card,
  .rh-ath-card,
  .rh-team-card,
  .rh-ec-card,
  .rh-admin-card{
    overflow-wrap:anywhere;
  }

  .rh-pme-main,
  .rh-pof-main,
  .rh-admin-main{
    min-width:0 !important;
  }

  .rh-admin-shell,
  .rh-ec-organizer-layout,
  .rh-team-hub-shell,
  .athlete-shell,
  .account-page{
    max-width:100vw !important;
  }
}

@media (max-width:760px){
  body{
    padding-left:0;
    padding-right:0;
  }

  .ped-container,
  .rh-public-events-container,
  .rh-home-container,
  .rh-registration-container,
  .rh-classification-container,
  .rh-ranking-container{
    width:min(100% - 24px, 1180px) !important;
  }

  .ped-hero__actions .ped-btn,
  .rh-public-events-actions a,
  .rh-public-events-actions button,
  .rh-registration-actions a,
  .rh-registration-actions button{
    width:100% !important;
    justify-content:center !important;
  }

  .rh-admin-menu-items,
  .rh-ath-sidebar-nav,
  .rh-team-sidebar-nav,
  .rh-ec-sidebar-nav{
    grid-template-columns:1fr !important;
  }

  .rh-topbar-mobile-panel,
  .rh-ath-mobile-drawer,
  .rh-team-mobile-drawer,
  .rh-admin-sidebar-v2{
    width:min(360px,92vw) !important;
    max-width:92vw !important;
  }

  .rh-topbar-mobile-link,
  .rh-ath-sidebar-link,
  .rh-team-sidebar-link,
  .rh-ec-sidebar-link,
  .rh-admin-menu-link{
    font-size:13px !important;
  }

  .ped-modal__dialog{
    max-height:calc(100dvh - 24px) !important;
  }
}

@media (max-width:520px){
  .rh-ath-mobile-toggle,
  .rh-team-mobile-toggle,
  .rh-admin-mobile-toggle{
    min-width:44px !important;
    justify-content:center !important;
  }

  .ped-mobile-cta{
    gap:10px !important;
  }

  .ped-mobile-cta .ped-btn{
    min-width:126px !important;
    padding-inline:12px !important;
  }

  .rh-admin-side-brand,
  .rh-admin-side-current,
  .rh-admin-side-session,
  .rh-admin-menu-group,
  .rh-admin-priority-block,
  .rh-ath-sidebar-card,
  .rh-team-sidebar-card,
  .rh-ec-sidebar-section{
    border-radius:20px !important;
  }
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    scroll-behavior:auto !important;
  }
}
