/* ============================================================
   mobile.css — Responsive completo para dispositivos móviles
   Breakpoints: 1100px (tablet), 680px (mobile)
   ============================================================ */

/* ══════════════════════════════════════════════════════════════
   TABLET — 1100px y menos
   Sidebar colapsado a íconos + feed central
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  #appScreen.active {
    grid-template-columns: 72px 1fr;
    max-width: 100%;
  }
  .sr { display: none; }

  /* Sidebar: solo íconos */
  .nl, .sl-section, .place-name, .fstar, .sl-logo-txt { display: none; }
  .sl-logo { display: flex; justify-content: center; padding: 12px 0; }
  .sl-logo-img { width: 40px; height: 40px; }
  .mod-badge-nav { display: none; }
  .nav-item { padding: 12px; justify-content: center; }
  .sl-user { flex-direction: column; padding: 8px; justify-content: center; }
  .u-name, .u-sub, .u-out { display: none; }
  .sl-post-btn { margin: 10px 6px 4px; padding: 13px; font-size: 0; width: 44px; height: 44px; }
  .sl-post-btn::before { content: '✏️'; font-size: 18px; }
  .sl-search-wrap { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE — 680px y menos
   Layout 1 columna + barra de navegación inferior
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 680px) {

  /* ── Layout principal ── */
  #appScreen.active {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    max-width: 100%;
    min-height: 100dvh;
  }

  /* Ocultar sidebar izquierdo y derecho */
  .sl, .sr { display: none !important; }

  /* Feed central ocupa todo el ancho */
  .fc {
    border-left: none;
    border-right: none;
    flex: 1;
    min-height: 0;
    padding-bottom: 60px; /* espacio para la bottom nav */
  }

  /* ── Login pantalla ── */
  .login-wrap { padding: 28px 20px; }
  .login-logo { font-size: 36px; margin-bottom: 28px; }
  .login-h1 { font-size: 24px; }

  /* ── Cabecera del feed ── */
  .fc-head-top { padding: 10px 12px 0; }
  .fc-title { font-size: 17px; }
  .fc-sort { gap: 4px; }
  .sort-pill { padding: 4px 10px; font-size: 12px; }
  .fc-tab { padding: 12px 8px; font-size: 14px; }

  /* ── Composer ── */
  .composer { padding: 10px 12px; }
  .comp-ta { font-size: 16px; min-height: 60px; } /* 16px evita zoom en iOS */
  .comp-av { width: 36px; height: 36px; }

  /* ── Posts / tarjetas ── */
  .post-card { padding: 12px 12px 10px; }
  .post-av { width: 36px; height: 36px; }

  /* Evitar zoom en inputs en iOS */
  .comp-ta,
  .modal-field input,
  .modal-field textarea,
  .modal-field select,
  .ch-input,
  .sr-search input,
  .sl-search-input,
  #srSearch,
  #slSearchInput,
  .req-field input,
  .req-field textarea,
  .req-field select,
  .edit-ta {
    font-size: 16px !important;
  }

  /* ── Modales: full screen en mobile ── */
  .moverlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 92dvh;
    padding: 20px 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .modal-wide { max-width: 100%; }
  .modal-title { font-size: 18px; }
  .modal-foot { flex-direction: column; gap: 8px; }
  .modal-foot button { width: 100%; padding: 12px; font-size: 15px; }

  /* Pill de arrastre para modales tipo sheet */
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border2);
    border-radius: 9999px;
    margin: -8px auto 14px;
  }

  /* ── Perfil ── */
  .prof-cover { height: 120px; }
  .prof-body { padding: 16px 12px 24px; }
  .prof-info-body { padding: 52px 16px 18px; }
  .prof-full-name { font-size: 18px; }
  .prof-contact-grid { grid-template-columns: 1fr; }
  .prof-stats-row { flex-wrap: wrap; }
  .prof-stat { min-width: 33%; }
  .prof-hdr { padding: 0 12px; height: 50px; }

  /* Avatar: reposicionar para cover más corto */
  .prof-avatar-wrap { bottom: -40px; left: 16px; }
  .prof-avatar { width: 80px; height: 80px; font-size: 30px; }

  /* ── Muro de lugar ── */
  .place-wall-hero { height: 160px; }

  /* ── Chat ── */
  #fcChat { height: 100dvh; }
  .ch-body { height: calc(100dvh - 114px); }
  .ch-input { font-size: 16px !important; }
  .ch-input-bar {
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  /* ── Notificaciones ── */
  .np-item { padding: 10px 12px; }

  /* ── Post acciones: targets táctiles mínimos ── */
  .post-action-btn,
  .react-btn,
  .comment-btn,
  .share-btn-post {
    min-height: 44px;
    min-width: 44px;
  }

  /* ── Botones en general: tamaño mínimo touch ── */
  .btn-save, .btn-cancel, .btn-danger,
  .prof-action-btn, .sort-pill, .fstar,
  .fc-head-action-btn, .prof-back {
    min-height: 44px;
  }
  .prof-back { font-size: 20px; padding: 0 10px; }
  .fc-head-action-btn { width: 40px; height: 40px; }

  /* ── Dropdown de usuario: reposicionar ── */
  .user-dd { left: auto; right: 0; min-width: 240px; bottom: auto; top: calc(100% + 6px); }

  /* ── Share grid en modal: 1 columna ── */
  .share-grid { grid-template-columns: 1fr; }

  /* ── Tendencias / Widgets: ocultos, se muestran en bottom sheet ── */
  .sr-sticky, .widget { /* solo aplica cuando .sr esté visible */ }

  /* ── Texto del feed: tamaños legibles ── */
  .post-text { font-size: 15px; line-height: 1.55; }
  .trend-tag { font-size: 13px; }

  /* ── Tabs del feed: sin overflow ── */
  .fc-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .fc-tabs::-webkit-scrollbar { display: none; }
  .fc-tab { white-space: nowrap; flex: none; padding: 12px 16px; }

  /* ── Solicitud redactor ── */
  .req-panel-wrap { padding: 14px 12px 80px; }

  /* ── Admin oculto en mobile (solo desktop) ── */
  /* Si se accede, se adapta con overflow */
  .adm-body { padding: 12px 8px; }

  /* ── Safe area inferior ── */
  .fc { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
}

/* ══════════════════════════════════════════════════════════════
   BARRA DE NAVEGACIÓN INFERIOR (mobile)
   ══════════════════════════════════════════════════════════════ */
#mobileBottomNav {
  display: none; /* oculta en desktop */
}

@media (max-width: 680px) {
  #mobileBottomNav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 500;
    background: var(--bg);
    border-top: 1px solid var(--border);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    align-items: stretch;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  body:not(.light) #mobileBottomNav { background: rgba(0,0,0,.88); }
  body.light #mobileBottomNav       { background: rgba(247,249,250,.95); }

  .mbn-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text2);
    font-size: 10px;
    font-weight: 600;
    padding: 8px 4px 4px;
    position: relative;
    transition: color .15s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mbn-btn.active { color: var(--accent); }
  .mbn-btn:active { opacity: .7; }

  .mbn-icon {
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
  }

  .mbn-label { font-size: 10px; letter-spacing: .01em; }

  /* Badge en botones de bottom nav */
  .mbn-badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 4px);
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    border-radius: 9999px;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--bg);
    pointer-events: none;
  }
  .mbn-badge.visible { display: flex; }

  /* Botón de publicar en bottom nav */
  .mbn-btn--post {
    color: #fff;
  }
  .mbn-btn--post .mbn-icon-wrap {
    background: var(--accent);
    border-radius: 14px;
    width: 46px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background .15s, transform .1s;
  }
  .mbn-btn--post:active .mbn-icon-wrap { transform: scale(.93); background: var(--accent-h); }
}

/* ══════════════════════════════════════════════════════════════
   PANTALLAS MUY PEQUEÑAS — 375px y menos (iPhone SE)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 375px) {
  .login-h1 { font-size: 20px; }
  .login-logo { font-size: 30px; }
  .fc-title { font-size: 15px; }
  .sort-pill { padding: 3px 8px; font-size: 11px; }
  .mbn-label { display: none; } /* Solo íconos en SE */
  .mbn-icon { font-size: 24px; }
  .modal { padding: 16px 12px; }
  .prof-avatar { width: 68px; height: 68px; }
}
