/* ======================================================
   RESET GLOBAL
   Elimina estilos por defecto del navegador para evitar
   comportamientos inconsistentes entre Chrome, Safari, etc.
====================================================== */
* {
  margin: 0; /* Elimina márgenes por defecto */
  padding: 0; /* Elimina rellenos por defecto */
  box-sizing: border-box; /* Hace que width/height incluyan padding y border */
}

/* ======================================================
   BODY GENERAL DE LA APP
   Define la base visual y tipográfica de toda la aplicación
====================================================== */
body {
  background: #ffffff; /* Fondo blanco limpio (estilo Instagram) */

  /* Stack de fuentes tipo San Francisco / iOS / Instagram */
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  color: #111; /* Color de texto oscuro, no negro puro */
}

/* ======================================================
   TOP BAR DEL FEED
   Barra superior fija con logo y buscador
====================================================== */
.feed-topbar {
  position: sticky; /* Permite que la barra se quede fija al hacer scroll */
  top: 0; /* Se ancla arriba del todo */
  z-index: 100; /* Asegura que esté por encima del contenido */

  display: flex; /* Layout flexible */
  align-items: center; /* Centrado vertical */
  justify-content: space-between; /* Logo izquierda, lupa derecha */

  height: 58px; /* Altura estándar mobile */
  padding: 0 16px; /* Espaciado lateral */

  background: #ffffff; /* Fondo blanco */
  border-bottom: 1px solid #eeeeee; /* Línea inferior sutil */
}

/* ======================================================
   LOGO FRIENDS
   Texto con degradado corporativo
====================================================== */
.feed-logo {
  font-size: 22px; /* Tamaño del texto del logo */
  font-weight: 700; /* Peso fuerte para identidad */

  background: linear-gradient(135deg, #ff004f 0%, #ff5a12 52%, #ffb000 100%);

  /* Técnicas para que el degradado se aplique solo al texto */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ======================================================
   BOTÓN BUSCAR
   Contenedor del icono de lupa
====================================================== */
.feed-search {
  background: none; /* Elimina fondo por defecto del botón */
  border: none; /* Elimina borde */
  cursor: pointer; /* Cursor tipo botón */

  width: 44px; /* Área táctil accesible */
  height: 44px;

  display: flex; /* Centrado del icono */
  align-items: center;
  justify-content: center;
}

/* ======================================================
   ICONO LUPA (SVG)
   Estilo minimalista tipo Instagram
====================================================== */
.icon-search {
  width: 22px; /* Tamaño del icono */
  height: 22px;

  stroke: #111; /* Color del trazo */
  stroke-width: 1.8; /* Grosor del trazo */
  fill: none; /* Sin relleno */

  stroke-linecap: round; /* Extremos redondeados */
  stroke-linejoin: round; /* Uniones redondeadas */
}

/* ======================================================
   CREAR PUBLICACIÓN / HISTORIA
   Módulo para escribir un nuevo post
====================================================== */
.create-post {
  background: #ffffff; /* Fondo blanco */
  padding: 14px 16px; /* Espaciado interno */
  border-bottom: 1px solid #eeeeee; /* Separación visual */
}

/* ======================================================
   FILA SUPERIOR DEL CREAR POST
   Avatar + input falso
====================================================== */
.create-post-row {
  display: flex; /* Elementos en fila */
  align-items: center; /* Centrado vertical */
  gap: 12px; /* Espacio entre avatar e input */
}

/* ======================================================
   AVATAR DEL USUARIO
====================================================== */
.avatar {
  width: 42px; /* Tamaño del avatar */
  height: 42px;
  border-radius: 50%; /* Forma circular */
  object-fit: cover; /* Evita deformar la imagen */
}

/* ======================================================
   INPUT FALSO
   Simula un input, al hacer click abre el textarea real
====================================================== */
.create-post-placeholder {
  flex: 1; /* Ocupa todo el ancho restante */
  padding: 10px 14px; /* Espaciado interno */
  background: #f2f2f2; /* Fondo gris claro */
  border-radius: 20px; /* Bordes redondeados */
  font-size: 14px; /* Tamaño de texto */
  color: #666666; /* Color gris */
  cursor: text; /* Cursor de texto */
}

/* ======================================================
   COMPOSER REAL
   Textarea + botón publicar (oculto por defecto)
====================================================== */
.create-post-composer {
  display: none; /* Se muestra solo al hacer click */
  margin-top: 12px; /* Separación superior */
}

/* ======================================================
   TEXTAREA DEL POST
====================================================== */
.create-post-composer textarea {
  width: 100%; /* Ocupa todo el ancho */
  min-height: 90px; /* Altura mínima cómoda */
  padding: 10px; /* Espaciado interno */
  border-radius: 12px; /* Bordes suaves */
  border: 1px solid #dddddd; /* Borde sutil */
  font-family: inherit; /* Hereda la fuente del body */
  font-size: 14px; /* Tamaño de texto */
  resize: none; /* Evita redimensionar */
}

/* ======================================================
   BOTÓN PUBLICAR
====================================================== */
.create-post-composer button {
  margin-top: 8px; /* Separación del textarea */
  width: 100%; /* Botón a ancho completo */
  padding: 10px; /* Altura cómoda */
  border: none; /* Sin borde */
  border-radius: 20px; /* Forma redondeada */
  font-weight: 600; /* Texto destacado */
  cursor: pointer; /* Cursor botón */
  color: #ffffff; /* Texto blanco */

  background: #ff5a12;
}

/* ======================================================
   ACCIONES DEL POST
   Foto / Vídeo / Más
====================================================== */
.create-post-actions {
  display: flex; /* Elementos en fila */
  justify-content: space-around; /* Espaciado uniforme */
  margin-top: 10px; /* Separación superior */
  font-size: 13px; /* Tamaño pequeño */
  color: #444444; /* Gris oscuro */
}

/* Cada acción es clickable */
.create-post-actions span {
  cursor: pointer;
}

/* ======================================================
   PERSONAS CONECTADAS – SCROLL HORIZONTAL
====================================================== */
.online-users {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;

  overflow-x: auto;
  overflow-y: hidden;

  cursor: grab;

  /* Permite gesto horizontal (CLAVE) */
  touch-action: pan-x;

  /* Ocultar scrollbar */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.online-users::-webkit-scrollbar {
  display: none;
}

.online-users.dragging {
  cursor: grabbing;
}

/* ======================================================
   USUARIO ONLINE
====================================================== */
.online-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #444;
  flex-shrink: 0;
}

/* ======================================================
   AVATAR
====================================================== */
.avatar-online {
  position: relative;
  width: 66px;
  height: 66px;
}

/* Imagen del usuario */
.avatar-online img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;

  /* Evita arrastre de imagen SIN romper eventos */
  -webkit-user-drag: none;
  user-select: none;
}

/* ======================================================
   PUNTO ONLINE
====================================================== */
.online-dot {
  position: absolute;
  bottom: -3px;
  right: -3px;

  width: 16px;
  height: 16px;

  background: #2ecc71;
  border: 3px solid #ffffff;
  border-radius: 50%;
}

/* ======================================================
   BOTÓN AÑADIR (+)
====================================================== */
.avatar-add {
  border-radius: 50%;
  border: 3px solid transparent;

  background-image:
    linear-gradient(#ffffff, #ffffff),
    linear-gradient(135deg, #ff004f 0%, #ff5a12 52%, #ffb000 100%);
  background-origin: border-box;
  background-clip: content-box, border-box;

  display: flex;
  align-items: center;
  justify-content: center;
}

.plus-icon {
  font-size: 32px;
  font-weight: 500;
  color: #ff004f;
  line-height: 1;
}

/* ======================================================
   NOMBRE
====================================================== */
.avatar-name {
  text-align: center;
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ======================================================
   LINK LIMPIO
====================================================== */
.avatar-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
/* ======================================================
   EVITAR SUBRAYADO EN NOMBRES DE USUARIO
====================================================== */
.avatar-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.avatar-name {
  text-decoration: none;
}
/* ======================================================
   FIJAR CONTENIDO DURANTE EL DRAG 
====================================================== */

/* Evita selección de texto (nombres) */
.online-users,
.online-users * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* Evita arrastre fantasma de imágenes */
.avatar-online img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* Mantiene el enlace funcional */
.avatar-link {
  pointer-events: auto;
}
/* ======================================================
   FIJAR CONTENIDO DURANTE EL DRAG (INSTAGRAM UX)
====================================================== */

/* Evita selección de texto (nombres) */
.online-users,
.online-users * {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* Evita arrastre fantasma de imágenes */
.avatar-online img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* Mantiene el enlace funcional */
.avatar-link {
  pointer-events: auto;
}
/* ======================================================
   EVENTOS
====================================================== */
.events-section {
  padding: 14px 0;
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;
}

/* Cabecera */
.events-header {
  padding: 0 16px 10px;
}

.events-title {
  font-size: 16px;
  font-weight: 600;
  color: #111;
}

/* Lista horizontal */
.events-list {
  display: flex;
  gap: 14px;
  padding: 0 16px;

  overflow-x: auto;
  overflow-y: hidden;

  cursor: grab;
  touch-action: pan-x;

  -ms-overflow-style: none;
  scrollbar-width: none;
}

.events-list::-webkit-scrollbar {
  display: none;
}

.events-list.dragging {
  cursor: grabbing;
}

/* Tarjeta evento */
.event-card {
  width: 150px;
  height: 200px;

  border-radius: 14px;
  overflow: hidden;

  background: #f2f2f2;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  position: relative;
  flex-shrink: 0;

  user-select: none;
}

/* Imagen evento */
.event-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;

  -webkit-user-drag: none;
  user-select: none;
}

/* Nombre evento */
.event-name {
  position: relative;
  z-index: 2;

  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));

  color: #ffffff;
  font-size: 12px;
  font-weight: 500;

  padding: 8px;
}
/* ======================================================
   POD / PUBLICACIÓN
====================================================== */
.post {
  background: #ffffff;
  border-bottom: 1px solid #eeeeee;
  padding: 14px 16px;
}

/* ================= HEADER ================= */
.post-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

/* Botón sonido dentro de cada publicación (solo si hay vídeo) */
.post-sound-btn {
  position: absolute;
  right: 0;
  top: 0;

  width: 38px;
  height: 38px;
  border-radius: 14px;

  border: 0;
  cursor: pointer;

  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 16px;
  line-height: 38px;

  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.post-sound-btn:active {
  transform: translateY(1px);
}

.post-sound-btn.active {
  background: rgba(255, 106, 74, 0.35);
  box-shadow:
    0 8px 22px rgba(255, 122, 77, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

/* Avatar */
.post-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;

  -webkit-user-drag: none;
  user-select: none;
}

/* Info usuario */
.post-user-info {
  display: flex;
  flex-direction: column;
}

.post-username {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.post-meta {
  font-size: 12px;
  color: #777;
}

/* ================= TEXTO ================= */
.post-content {
  font-size: 14px;
  color: #222;
  line-height: 1.4;
  margin-bottom: 10px;
}

/* ================= MEDIA ================= */
.post-media {
  /* Estilo IG: full-bleed hasta los bordes laterales del post */
  --post-pad: 16px;
  width: calc(100% + (2 * var(--post-pad)));
  margin-left: calc(-1 * var(--post-pad));
  margin-right: 0;
  margin-bottom: 10px;
  background: #000;

  /* Más alto (+30%) sin romper el layout */
  height: clamp(468px, 75vh, 806px);
  overflow: hidden;
}

.post-media img,
.post-media video {
  width: 100%;
  height: 100%;
  /* Sin redondeo para que toque borde como Instagram */
  border-radius: 0;
  /* Instagram-style: llena el frame (puede recortar un poco) */
  object-fit: cover;

  -webkit-user-drag: none;
  user-select: none;
}

/* ================= ACCIONES ================= */
.post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;

  font-size: 13px;
  color: #444;
}

/* Likes */
.post-likes {
  font-weight: 500;
}

/* Comentarios / Compartidos */
.post-stats {
  display: flex;
  gap: 14px;
}

.post-stats span {
  cursor: pointer;
}
/* ======================================================
   TÍTULO SECCIÓN PUBLICACIONES
====================================================== */
.posts-header {
  padding: 14px 16px 6px;
  background: #ffffff;
}

.posts-title {
  font-size: 16px;
  font-weight: 600;
  color: #111;
}
/* ======================================================
   LIKE DOBLE TAP – ANIMACIÓN
====================================================== */
.post-media {
  position: relative;
}

/* Corazón */
.like-heart {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);

  font-size: 80px;
  opacity: 0;

  pointer-events: none;
  user-select: none;
}

/* Animación activa */
.like-heart.show {
  animation: like-pop 0.8s ease forwards;
}

@keyframes like-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.3);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }
}
/* ======================================================
   BLOQUEAR ZOOM / SELECCIÓN EN DOBLE TAP
====================================================== */

/* Evita zoom por doble tap */
html,
body {
  touch-action: manipulation;
}

/* Evita selección accidental */
body {
  -webkit-user-select: none;
  user-select: none;
}

/* Permitimos selección SOLO donde se escribe */
textarea,
input {
  -webkit-user-select: text;
  user-select: text;
}
/* ======================================================
   MENÚ INFERIOR – ULTRAMODERNO / PREMIUM
====================================================== */
.pill-nav {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 320;

  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;

  height: 74px;
  padding: 8px;

  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 28px;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);

  box-shadow:
    0 22px 55px rgba(15, 23, 42, 0.16),
    0 8px 22px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.pill-nav::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 27px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.08)
  );
  pointer-events: none;
}
.pill-item {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  height: 100%;
  border-radius: 22px;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;

  text-decoration: none;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;

  transition:
    transform 0.18s ease,
    background 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
}
.pill-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition:
    transform 0.22s ease,
    stroke 0.22s ease;
}
.pill-item .pill-text {
  white-space: nowrap;
}
.pill-item:hover {
  background: rgba(15, 23, 42, 0.05);
}
.pill-item:active {
  transform: translateY(1px) scale(0.97);
}
.pill-item.active {
  background: #17171a;
  color: #ffffff;
  box-shadow:
    0 12px 24px rgba(17, 17, 17, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.pill-item.active svg {
  stroke: #ffffff;
  transform: translateY(-1px) scale(1.02);
}
.pill-item.active .pill-dot {
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16);
}
.pill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #111111;
}
body {
  padding-bottom: 118px;
}
@media (min-width: 769px) {
  .pill-nav {
    left: 50%;
    right: auto;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(760px, calc(100vw - 44px));
    max-width: 760px;
    min-width: 520px;
    height: 82px;
    padding: 10px;
    border-radius: 32px;
  }
  .pill-nav::before {
    border-radius: 31px;
  }
  .pill-item {
    font-size: 13px;
    gap: 7px;
    border-radius: 24px;
  }
  .pill-item svg {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 420px) {
  .pill-nav {
    left: 10px;
    right: 10px;
    height: 70px;
    padding: 7px;
    border-radius: 24px;
  }
  .pill-nav::before {
    border-radius: 23px;
  }
  .pill-item {
    border-radius: 19px;
    font-size: 10.5px;
  }
  .pill-item svg {
    width: 21px;
    height: 21px;
  }
}

/* ======================================================
   EFECTO CRISTAL AL HOVER / TAP (APPLE STYLE)
====================================================== */

/* Estado hover (desktop) */
.pill-item:hover {
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Estado tap (móvil) */
.pill-item:active {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  transform: scale(0.96);
}
