/* ================================================================
   KLINIK STUDIO — pwa-mobile.css
   UI premium tipo app nativa. Solo mobile (<768px).
   NO modifica estilos existentes. Solo agrega.
   ================================================================ */

/* ── BOTTOM NAV (reemplaza navbar en mobile) ── */
.pwa-bottom-nav {
  display: none;
}
@media (max-width: 768px) {
  /* Ocultar navbar top en mobile cuando hay bottom nav */
  body.pwa-view .navbar {
    display: none !important;
  }

  /* Espacio para bottom nav */
  body.pwa-view {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .pwa-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 10, 14, 0.96);
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(64px + env(safe-area-inset-bottom));
    align-items: flex-start;
    padding-top: 0;
  }

  .pwa-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 10px 0 8px;
    color: rgba(255,255,255,.35);
    font-size: 10px;
    letter-spacing: .04em;
    text-decoration: none;
    transition: color .2s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 64px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font, 'Outfit', sans-serif);
  }

  .pwa-nav-item.active {
    color: #00d4d4;
  }

  .pwa-nav-item svg,
  .pwa-nav-item i {
    font-size: 22px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .pwa-nav-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #00d4d4;
    margin: 0 auto;
    opacity: 0;
    transition: opacity .2s;
  }
  .pwa-nav-item.active .pwa-nav-dot {
    opacity: 1;
  }

  /* ── APP HEADER (reemplaza navbar en mobile) ── */
  .pwa-header {
    position: sticky;
    top: 0;
    z-index: 500;
    background: rgba(6, 6, 8, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,.07);
    padding: env(safe-area-inset-top) 0 0;
  }

  .pwa-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    min-height: 52px;
  }

  .pwa-header-title {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.01em;
  }

  .pwa-header-back {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00d4d4;
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    margin-left: -8px;
  }

  .pwa-header-action {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.55);
    font-size: 20px;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── TABS HORIZONTAL SCROLL ── */
  .pwa-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
    padding: 0 12px;
    background: rgba(6,6,8,.97);
  }
  .pwa-tabs::-webkit-scrollbar { display: none; }

  .pwa-tab {
    flex-shrink: 0;
    padding: 11px 14px;
    font-size: 13px;
    color: rgba(255,255,255,.4);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    transition: color .2s, border-color .2s;
    -webkit-tap-highlight-color: transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font, 'Outfit', sans-serif);
  }
  .pwa-tab.active {
    color: #00d4d4;
    border-bottom-color: #00d4d4;
    font-weight: 600;
  }

  /* ── SUBTABS TIPO PILLS ── */
  .pwa-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 12px 16px;
  }
  .pwa-pills::-webkit-scrollbar { display: none; }

  .pwa-pill {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: rgba(255,255,255,.5);
    cursor: pointer;
    transition: all .2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    font-family: var(--font, 'Outfit', sans-serif);
    display: flex;
    align-items: center;
    gap: 5px;
  }
  .pwa-pill.active {
    background: rgba(0,212,212,.15);
    border-color: rgba(0,212,212,.45);
    color: #00d4d4;
  }

  /* ── SECTION LABEL ── */
  .pwa-section-label {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 16px 16px 8px;
    font-weight: 600;
  }

  /* ── CLASE ROW CARD (como la imagen) ── */
  .pwa-clase-row {
    display: flex;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    gap: 12px;
    cursor: pointer;
    transition: background .15s;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    color: inherit;
  }
  .pwa-clase-row:active {
    background: rgba(255,255,255,.04);
  }

  .pwa-clase-info {
    flex: 1;
    min-width: 0;
  }

  .pwa-clase-nombre {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .pwa-clase-meta {
    font-size: 12px;
    color: rgba(255,255,255,.4);
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .pwa-clase-meta .sep {
    opacity: .4;
  }

  .pwa-clase-chevron {
    color: rgba(255,255,255,.2);
    font-size: 16px;
    flex-shrink: 0;
  }

  /* Badge de "Ganancia" / nivel */
  .pwa-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    flex-shrink: 0;
  }
  .pwa-badge-teal {
    background: rgba(0,212,212,.15);
    color: #00d4d4;
    border: 1px solid rgba(0,212,212,.3);
  }
  .pwa-badge-mag {
    background: rgba(233,30,140,.12);
    color: #e91e8c;
    border: 1px solid rgba(233,30,140,.25);
  }
  .pwa-badge-gold {
    background: rgba(245,200,66,.12);
    color: #f5c842;
    border: 1px solid rgba(245,200,66,.25);
  }
  .pwa-badge-green {
    background: rgba(34,197,94,.1);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,.2);
  }

  /* ── CARD AGRUPADA (con shadow) ── */
  .pwa-card-group {
    margin: 0 16px 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 14px;
    overflow: hidden;
  }

  .pwa-card-group .pwa-clase-row {
    padding-left: 0;
    padding-right: 0;
    margin: 0 16px;
  }
  .pwa-card-group .pwa-clase-row:last-child {
    border-bottom: none;
  }

  /* ── HERO COMPACT MOBILE ── */
  .pwa-hero-compact {
    padding: 24px 16px 20px;
    text-align: left;
  }

  .pwa-hero-title {
    font-family: var(--display, 'Bebas Neue', sans-serif);
    font-size: 36px;
    letter-spacing: .04em;
    line-height: 1;
    color: #fff;
    margin-bottom: 8px;
  }

  .pwa-hero-sub {
    font-size: 13px;
    color: rgba(255,255,255,.5);
    margin-bottom: 16px;
    line-height: 1.5;
  }

  /* ── STAT ROW HORIZONTAL ── */
  .pwa-stats-row {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .pwa-stats-row::-webkit-scrollbar { display: none; }

  .pwa-stat-mini {
    flex-shrink: 0;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 12px 14px;
    min-width: 90px;
    text-align: center;
  }
  .pwa-stat-mini-val {
    font-family: var(--display, 'Bebas Neue', sans-serif);
    font-size: 26px;
    color: #00d4d4;
    line-height: 1;
    margin-bottom: 4px;
  }
  .pwa-stat-mini-label {
    font-size: 10px;
    color: rgba(255,255,255,.35);
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  /* ── PERFIL MINI HEADER ── */
  .pwa-profile-mini {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .pwa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0,212,212,.15);
    border: 2px solid rgba(0,212,212,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display, 'Bebas Neue', sans-serif);
    font-size: 18px;
    color: #00d4d4;
    flex-shrink: 0;
    overflow: hidden;
  }
  .pwa-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .pwa-profile-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
  }
  .pwa-profile-sub {
    font-size: 12px;
    color: rgba(255,255,255,.4);
    margin-top: 1px;
  }

  /* ── LISTA MENU (settings style) ── */
  .pwa-menu-row {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,.05);
    gap: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s;
    text-decoration: none;
    color: inherit;
  }
  .pwa-menu-row:active { background: rgba(255,255,255,.03); }
  .pwa-menu-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0,212,212,.12);
    color: #00d4d4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
  }
  .pwa-menu-label {
    flex: 1;
    font-size: 15px;
    color: #fff;
  }
  .pwa-menu-value {
    font-size: 13px;
    color: rgba(255,255,255,.35);
  }

  /* ── CONTENT WRAPPER con padding correcto ── */
  .pwa-content {
    padding-bottom: 16px;
  }

  /* ── FAB BUTTON ── */
  .pwa-fab {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 20px;
    width: 52px;
    height: 52px;
    border-radius: 26px;
    background: linear-gradient(135deg, #00d4d4, #008080);
    color: #060608;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,212,212,.4);
    z-index: 400;
    cursor: pointer;
    border: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform .15s;
  }
  .pwa-fab:active { transform: scale(.94); }

  /* ── SEARCH BAR MOBILE ── */
  .pwa-search {
    padding: 10px 16px;
    background: rgba(6,6,8,.97);
    border-bottom: 1px solid rgba(255,255,255,.06);
  }
  .pwa-search-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.07);
    border-radius: 10px;
    padding: 9px 14px;
  }
  .pwa-search-inner i {
    color: rgba(255,255,255,.3);
    font-size: 16px;
    flex-shrink: 0;
  }
  .pwa-search-inner input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 15px;
    min-height: unset;
    padding: 0;
    width: 100%;
  }
  .pwa-search-inner input::placeholder {
    color: rgba(255,255,255,.25);
  }

  /* ── ANIMACIONES ── */
  .pwa-fade-in {
    animation: pwaFadeIn .25s ease both;
  }
  @keyframes pwaFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
  }

  /* ── FIX: ocultar elementos desktop en mobile pwa ── */
  body.pwa-view .hamburger,
  body.pwa-view .nav-links {
    display: none !important;
  }
}

/* Desktop: bottom nav nunca visible */
@media (min-width: 769px) {
  .pwa-bottom-nav { display: none !important; }
  .pwa-header { display: none !important; }
}

/* ── ADMIN MOBILE FIX ── */
@media (max-width: 768px) {
  .admin-sidebar,
  .admin-sidebar.open,
  #adminSidebar {
    display: none !important;
    width: 0 !important;
    transform: translateX(-100%) !important;
  }
  .admin-main {
    margin-left: 0 !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 8px !important;
    padding-bottom: 80px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .sidebar-toggle,
  .sidebar-overlay { display: none !important; }
  .admin-topbar {
    padding-top: .75rem !important;
  }
  /* Ocultar título largo en mobile */
  .page-title { font-size: 22px !important; }
}
