:root {
  --azul: #0b3b8f;
  --azul-claro: #4a90e2;
  --rojo-cuba: #c8102e;
  --bg: #e5e7eb;
  --texto: #1a1a1a;
  --gris: #333;
  --borde: #e5e7eb;
  --header-h: 56px;
  --footer-h: 60px;
  --verde: #22c55e;
  --safe-area-top: env(safe-area-inset-top);
  --safe-area-bottom: env(safe-area-inset-bottom);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: var(--actual-vh, 100vh);
  overflow: hidden;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #fff;
  color: var(--texto);
  overscroll-behavior-y: none;
  overflow-x: hidden;
}

* {
  max-width: 100vw;
  box-sizing: border-box;
}

/* Status bar background (PWA iOS) */
.status-bar-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top);
  background: var(--azul);
  z-index: 101;
  transition: opacity 0.25s ease;
}

.status-bar-bg.oculto {
  opacity: 0;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 14px;
  padding-right: 14px;
  z-index: 100;
  transition: transform 0.25s ease, opacity 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.header.oculto {
  transform: translateY(-100%);
  opacity: 0;
}

.header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  text-decoration: none;
  color: #fff;
}

.header .logo img {
  height: 42px;
  width: 42px;
  border-radius: 9px;
  object-fit: cover;
  background: #fff;
}

.header .logo .marca {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.header .acciones {
  display: flex;
  gap: 18px;
}

.header .acciones button {
  background: none;
  border: none;
  color: #fff;
  font-size: 21px;
  cursor: pointer;
  padding: 6px;
}

/* Feed scrolleable */
.feed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: scroll;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 8px) 0 calc(var(--footer-h) + env(safe-area-inset-bottom) + 8px) 0;
  background: var(--bg);
  /* Fix iOS scroll glitch */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Post */
.post {
  background: #fff;
  margin: 0;
  border-radius: 0;
  overflow: visible;
  border-bottom: 6px solid #6b7280;
  position: relative;
}

.post::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  pointer-events: none;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 8px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-meta {
  flex: 1;
  min-width: 0;
}

.post-meta .nombre {
  font-weight: 600;
  font-size: 21px;
  cursor: pointer;
}

.post-meta .nombre:hover {
  text-decoration: underline;
}

.post-meta .tiempo {
  font-size: 13px;
  color: var(--gris);
}

/* Menú de opciones del post */
.post-menu-container {
  position: relative;
  margin-left: auto;
}

.post-menu-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--gris);
  border-radius: 50%;
  transition: background 0.2s;
}

.post-menu-btn:hover {
  background: var(--bg);
}

.post-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 150px;
  z-index: 100;
  overflow: hidden;
  display: none;
}

.post-menu-dropdown.visible {
  display: block;
}

.post-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--texto);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.post-menu-item:hover {
  background: var(--bg);
}

.post-menu-item.danger {
  color: #dc2626;
}

.post-menu-item .ico {
  font-size: 21px;
}

.post-titulo {
  padding: 0 14px 6px;
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
}

.post-contenido {
  padding: 0 14px 4px;
  font-size: 21px;
  line-height: 1.2;
  color: #111;
  white-space: pre-wrap;
}

.post-contenido.truncado {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.leer-mas {
  color: var(--azul);
  font-size: 15px;
  font-weight: 600;
  background: none;
  border: none;
  padding: 0 14px 8px;
  cursor: pointer;
}

.post-imagen {
  width: 100%;
  display: block;
  background: linear-gradient(90deg, #e8e8e8 25%, #f2f2f2 50%, #e8e8e8 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  aspect-ratio: 4/5;
  object-fit: cover;
  cursor: pointer;
}
.post-imagen.loaded {
  background: none;
  animation: none;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Video container */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  cursor: pointer;
}

.post-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-sound-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.video-sound-btn:hover {
  background: rgba(0,0,0,0.8);
}

.post-acciones {
  display: flex;
  padding: 8px 14px;
  border-top: 1px solid var(--borde);
}

.accion {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--gris);
  font-weight: 500;
  user-select: none;
  position: relative;
}

.accion .ico {
  font-size: 15px;
}

.accion.activa {
  color: var(--azul);
  font-weight: 600;
}
/* Botón Me gusta inactivo: emoji en gris */
.accion-like:not(.activa) .ico {
  filter: grayscale(1);
  opacity: 0.5;
}
.accion-like.activa .ico {
  filter: none;
  opacity: 1;
}

/* Selector de reacciones */
.reaccion-picker {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  transform: scale(0);
  background: #fff;
  border-radius: 30px;
  padding: 6px 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  display: flex;
  gap: 4px;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: bottom center;
  z-index: 50;
}

.reaccion-picker.visible {
  transform: scale(1);
}

.reaccion-picker span {
  font-size: 23px;
  padding: 4px 6px;
  cursor: pointer;
  transition: transform 0.15s;
}

.reaccion-picker span:hover {
  transform: scale(1.3);
}

.reaccion-picker span:active {
  transform: scale(1.4);
}

/* Footer nav */
.footer-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--footer-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  display: flex;
  align-items: flex-start;
  padding-top: 5px;
  border-top: 1px solid var(--borde);
  z-index: 100;
  transition: transform 0.25s ease;
}

.footer-nav.oculto {
  transform: translateY(100%);
}

.footer-nav button {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--gris);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.footer-nav button .ico {
  font-size: 21px;
}

.footer-nav button.activo {
  color: var(--azul);
}

.footer-nav button.crear .ico {
  background: var(--azul);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  line-height: 1;
}

/* Modales */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

/* Modal de post: fullscreen sobre todo, respeta safe-area */
#modal-comments {
  padding: 0;
  align-items: flex-end;
  z-index: 300;
}

.modal-drag-handle {
  width: 36px;
  height: 4px;
  background: #ccc;
  border-radius: 2px;
  margin: 8px auto 0;
  flex-shrink: 0;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--borde);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--gris);
}

.modal-body {
  padding: 16px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--texto);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--azul);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--azul);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #0a348a;
}

.btn-block {
  width: 100%;
}

.btn-secondary {
  background: var(--borde);
  color: var(--texto);
}

/* Mensajes de estado */
.alert {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* Loading */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--gris);
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--borde);
  border-top-color: var(--azul);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gris);
}

.empty-state .emoji {
  font-size: 43px;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 13px;
}

/* Profile header (usado en modal y página perfil) */
.profile-header {
  text-align: center;
  padding: 20px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul), var(--azul-claro));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 29px;
  font-weight: 700;
  margin: 0 auto 12px;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-username {
  font-size: 15px;
  font-weight: 700;
}

.profile-name {
  font-size: 13px;
  color: var(--gris);
}

.profile-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.profile-stat {
  text-align: center;
}

.profile-stat .num {
  font-size: 15px;
  font-weight: 700;
}

.profile-stat .label {
  font-size: 22px;
  color: var(--gris);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--borde);
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  background: none;
  border: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--gris);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.activo {
  color: var(--azul);
  border-bottom-color: var(--azul);
}

/* Usuario en auth */
.user-badge {
  position: relative;
}

.user-badge-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-badge-trigger:hover {
  background: rgba(255,255,255,0.2);
}

.user-badge .avatar {
  width: 28px;
  height: 28px;
  font-size: 22px;
}

.user-badge .username {
  font-size: 15px;
  font-weight: 500;
}

/* User dropdown menu */
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  min-width: 180px;
  padding: 8px 0;
  display: none;
  z-index: 200;
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #333;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s;
}

.user-dropdown-item:hover {
  background: #f5f5f5;
}

.user-dropdown-item.logout {
  color: #dc2626;
}

.user-dropdown-item .ico {
  font-size: 21px;
}

.user-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

/* Hide when logged out/in */
.logged-in-only { display: none; }
.logged-out-only { display: block; }
body.authenticated .logged-in-only { display: flex; }
body.authenticated .logged-out-only { display: none; }

/* Modal Post Detail */
.modal-post-detail {
  width: 100%;
  max-width: 100%;
  height: calc(100dvh - env(safe-area-inset-top, 44px));
  max-height: calc(100dvh - env(safe-area-inset-top, 44px));
  margin-top: env(safe-area-inset-top, 44px);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.post-detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.post-detail-content {
  padding: 0;
}

.post-detail-content .post {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.comentarios-header {
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
  color: var(--gris);
  border-top: 1px solid var(--borde);
  border-bottom: 1px solid var(--borde);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Comentarios */
.comentarios-container {
  padding: 12px;
  min-height: 100px;
}

.comentario {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  position: relative;
}

.comentario .avatar {
  width: 36px;
  height: 36px;
  font-size: 15px;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.comentario .avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.comentario-contenido {
  flex: 1;
  min-width: 0;
}

.comentario-burbuja {
  background: var(--bg);
  border-radius: 18px;
  padding: 10px 14px;
  display: inline-block;
  max-width: 100%;
}

.comentario-autor {
  font-weight: 700;
  font-size: 1.2em;
  color: var(--texto);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.comentario-autor:hover {
  text-decoration: underline;
  cursor: pointer;
}

.comentario-texto {
  font-size: 1.1em;
  line-height: 1.35;
  word-wrap: break-word;
  color: var(--texto);
}

.comentario-mencion {
  color: var(--azul);
  font-weight: 600;
}

.comentario-mencion:hover {
  text-decoration: underline;
  cursor: pointer;
}

.comentario-acciones {
  display: flex;
  gap: 16px;
  margin-top: 4px;
  padding-left: 6px;
  align-items: center;
}

.comentario-acciones button {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--gris);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.comentario-acciones button:hover {
  text-decoration: underline;
}

.comentario-acciones .tiempo {
  font-size: 11px;
  color: var(--gris);
  font-weight: 400;
}

.comentario-acciones .autor-badge {
  background: var(--azul);
  color: #fff;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.comentario-autor .autor-badge {
  background: none;
  color: var(--azul);
  font-size: 1em;
  font-weight: 700;
  padding: 0;
  border-radius: 0;
  letter-spacing: 0;
}

/* Contenedor de respuestas */
.comentario-respuestas {
  margin-left: 18px;
  margin-top: 8px;
  padding-left: 22px;
  position: relative;
}

.comentario-respuestas .comentario {
  margin-bottom: 10px;
  position: relative;
}

/* Línea vertical - se extiende solo hasta el último hijo */
.comentario-respuestas::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--borde);
}

/* Ocultar línea después del último comentario */
.comentario-respuestas > .comentario:last-child ~ .linea-vertical,
.comentario-respuestas::after {
  display: none;
}

/* La línea vertical termina en el centro del avatar del último hijo */
.comentario-respuestas {
  --ultimo-top: 14px;
}

.comentario-respuestas::before {
  bottom: calc(100% - var(--ultimo-top));
}

/* Truco: usar el último hijo para cortar la línea */
.comentario-respuestas > .comentario:last-child {
  position: relative;
}

/* Línea horizontal que conecta al avatar */
.comentario-respuestas > .comentario::before {
  content: '';
  position: absolute;
  left: -22px;
  top: 14px;
  width: 18px;
  height: 2px;
  background: var(--borde);
}

/* Cubrir la línea vertical después del último elemento */
.comentario-respuestas > .comentario:last-child::after {
  content: '';
  position: absolute;
  left: -22px;
  top: 16px;
  bottom: -10px;
  width: 2px;
  background: #fff;
}

.comentario-respuestas .avatar {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.comentario-respuestas .comentario-burbuja {
  padding: 8px 12px;
  border-radius: 14px;
}

.comentario-respuestas .comentario-autor {
  font-size: 1.2em;
}

.comentario-respuestas .comentario-texto {
  font-size: 1.1em;
}

.comentario-respuestas .comentario-acciones {
  gap: 12px;
}

.comentario-respuestas .comentario-acciones .tiempo,
.comentario-respuestas .comentario-acciones button {
  font-size: 13px;
}

/* Nivel 2 de anidación */
/* Nivel 2+: misma sangría fija, sin acumulación */
.comentario-respuestas .comentario-respuestas {
  margin-left: 0;
  padding-left: 0;
}
.comentario-respuestas .comentario-respuestas::before {
  display: none;
}
.comentario-respuestas .comentario-respuestas > .comentario::before,
.comentario-respuestas .comentario-respuestas > .comentario::after {
  display: none;
}

/* Input de comentario */
.comentario-input-container {
  display: flex;
  gap: 10px;
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--borde);
  background: #fff;
  flex-shrink: 0;
}

.comentario-input-container .avatar {
  width: 32px;
  height: 32px;
  font-size: 22px;
}

.comentario-input-wrapper {
  flex: 1;
  position: relative;
}

.comentario-input {
  width: 100%;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--borde);
  border-radius: 20px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 40px;
  max-height: 100px;
}

.comentario-input:focus {
  outline: none;
  border-color: var(--azul);
}

.comentario-enviar {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--azul);
  font-size: 15px;
  cursor: pointer;
  padding: 4px;
}

.comentario-enviar:disabled {
  color: var(--gris);
  cursor: not-allowed;
}

.respondiendo-a {
  font-size: 22px;
  color: var(--gris);
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.respondiendo-a button {
  background: none;
  border: none;
  color: var(--gris);
  cursor: pointer;
  font-size: 21px;
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ===== TAG SUGGESTIONS ===== */
.tag-suggestions {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.tag-suggestion {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--borde);
  transition: background 0.15s;
}

.tag-suggestion:last-child {
  border-bottom: none;
}

.tag-suggestion:hover,
.tag-suggestion:active {
  background: var(--bg);
}

.tag-suggestion .tag-name {
  color: var(--azul);
  font-weight: 500;
  font-size: 15px;
}

.tag-suggestion .tag-count {
  color: var(--gris);
  font-size: 13px;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

/* Tags en posts (hashtags clickeables) */
.post-contenido .hashtag {
  color: var(--azul);
  font-weight: 500;
  cursor: pointer;
}

.post-contenido .hashtag:hover {
  text-decoration: underline;
}

/* ===== CONFIRM MODAL ===== */
.confirm-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 320px;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.2s;
}

.confirm-modal-overlay.show .confirm-modal {
  transform: scale(1);
}

.confirm-title {
  font-size: 18px;
  font-weight: 600;
  color: #111;
  margin-bottom: 8px;
}

.confirm-message {
  font-size: 15px;
  color: var(--gris);
  margin-bottom: 20px;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
}

.confirm-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}

.confirm-btn.cancel {
  background: var(--bg);
  color: var(--gris);
}

.confirm-btn.cancel:active {
  background: #d1d5db;
}

.confirm-btn.confirm {
  background: var(--rojo-cuba);
  color: #fff;
}

.confirm-btn.confirm:active {
  background: #a00d24;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--footer-h) + env(safe-area-inset-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== PROFILE META (ciudad, profesión) ===== */
.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 6px 0 10px;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--gris);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ===== EDIT PROFILE MODAL ===== */
.edit-profile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.edit-profile-overlay.show {
  opacity: 1;
  visibility: visible;
}

.edit-profile-modal {
  width: 100%;
  max-height: 92vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.edit-profile-overlay.show .edit-profile-modal {
  transform: translateY(0);
}

.edit-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--borde);
  flex-shrink: 0;
}

.edit-profile-header h2 {
  font-size: 17px;
  font-weight: 600;
  color: #111;
}

.edit-profile-close {
  background: var(--bg);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  color: var(--gris);
  display: flex;
  align-items: center;
  justify-content: center;
}

.edit-profile-save {
  background: var(--azul);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.edit-profile-save:disabled {
  opacity: 0.5;
}

.edit-profile-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

/* Avatar section */
.edit-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.edit-avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--azul);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  border: 3px solid var(--borde);
}

.edit-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.edit-avatar-btn {
  background: var(--bg);
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--azul);
}

/* Fields */
.edit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-field label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  display: flex;
  justify-content: space-between;
}

.edit-char-count {
  font-weight: 400;
  color: #aaa;
}

.edit-field input,
.edit-field textarea,
.edit-field select {
  border: 1.5px solid var(--borde);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  color: #111;
  background: #fff;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.edit-field input:focus,
.edit-field textarea:focus,
.edit-field select:focus {
  border-color: var(--azul);
}

.edit-field textarea {
  resize: none;
}

/* Ciudad autocomplete */
.ciudad-search-wrap {
  position: relative;
}

.ciudad-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1.5px solid var(--borde);
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}

.ciudad-suggestion {
  padding: 12px 14px;
  cursor: pointer;
  font-size: 14px;
  color: #111;
  border-bottom: 1px solid var(--borde);
}

.ciudad-suggestion:last-child { border-bottom: none; }
.ciudad-suggestion:active { background: var(--bg); }

.ciudad-suggestion small {
  display: block;
  color: #888;
  font-size: 12px;
}

/* ===== EDITOR DE IMAGEN (portada + avatar) ===== */
.edit-portada-section,
.edit-avatar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.edit-avatar-section {
  align-items: center;
}

/* Contenedor editor genérico */
.edit-img-editor {
  width: 100%;
  height: 130px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #0b3b8f 0%, #1e5bb8 100%);
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.edit-img-editor--circle {
  width: 192px;
  height: 192px;
  border-radius: 50%;
  border: 4px solid var(--borde);
}

.edit-img-editor.dragging { cursor: grabbing; }

.edit-img-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform, background-position;
}

.edit-img-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  font-weight: 500;
  pointer-events: none;
  text-align: center;
  padding: 8px;
}

.edit-img-circle-mask {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 200px rgba(255,255,255,0.35);
  pointer-events: none;
}

/* Acciones portada */
.edit-portada-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.edit-portada-btn,
.edit-avatar-btn {
  display: inline-block;
  background: var(--bg);
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--azul);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
}

.edit-portada-tip {
  font-size: 13px;
  color: #888;
  font-style: italic;
}

/* ─── Notification Prompts ─────────────────────────────── */
#notif-prompt {
  position: fixed;
  bottom: calc(70px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  z-index: 9999;
  animation: notif-slide-up 0.3s ease;
}
@keyframes notif-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.notif-prompt-inner {
  background: #1e1e2e;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.notif-prompt-icon { font-size: 24px; flex-shrink: 0; }
.notif-prompt-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notif-prompt-text strong { font-size: 14px; color: #fff; }
.notif-prompt-text span   { font-size: 12px; color: rgba(255,255,255,0.6); line-height: 1.4; }
.notif-prompt-btn {
  background: #e63946;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.notif-prompt-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 4px;
}

/* ─── Modal Configuración ──────────────────────────────── */
/* ─── Modal Configuración ─────────────────────────────────── */
.config-modal { max-width: 480px; width: 100%; }
.config-body  { padding: 0 16px 24px; }

.config-section { margin-top: 20px; }
.config-section-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; color: #111; }
.config-section-desc  { font-size: 12px; color: rgba(0,0,0,0.5); margin: 0 0 12px; }

/* Cabecera de columnas */
.config-notif-header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 8px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.config-notif-col-labels {
  display: flex; gap: 0; width: 96px;
}
.config-notif-col-labels span {
  flex: 1; text-align: center;
  font-size: 12px; color: rgba(0,0,0,0.5); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}

/* Filas */
.config-notif-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.config-notif-row:last-child { border-bottom: none; }

.config-notif-info {
  display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0;
}
.config-notif-info > div {
  flex: 1; min-width: 0;
}
.config-notif-icon {
  font-size: 20px; line-height: 1; flex-shrink: 0; margin-top: 1px;
}
.config-notif-title {
  display: block; font-size: 14px; font-weight: 600; color: #111; line-height: 1.3;
}
.config-notif-desc {
  display: block; font-size: 12px; color: rgba(0,0,0,0.5); line-height: 1.4; margin-top: 2px;
}

/* Checkboxes */
.config-notif-checks {
  display: flex; gap: 0; flex-shrink: 0; width: 96px;
}
.config-check {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  cursor: pointer; user-select: none;
}
.config-check input[type="checkbox"] { display: none; }
.config-check-box {
  width: 40px; height: 40px; border-radius: 12px;
  border: 1.5px solid rgba(0,0,0,0.15);
  background: rgba(0,0,0,0.04);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s, transform .12s;
  position: relative;
}
.config-check-box::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid rgba(0,0,0,0.2);
  border-bottom: 2px solid rgba(0,0,0,0.2);
  transform: rotate(-45deg) translateY(-1px);
  transition: border-color .15s;
}
.config-check input:checked + .config-check-box {
  background: rgba(230,57,70,0.12);
  border-color: #e63946;
  transform: scale(1.07);
}
.config-check input:checked + .config-check-box::after {
  border-color: #e63946;
}
.config-check:hover .config-check-box { border-color: rgba(0,0,0,0.3); }

/* Guardado */
.config-save-status {
  text-align: center; color: #4caf50; font-size: 13px;
  margin-top: 14px;
}
@keyframes fadeInOut {
  0%   { opacity:0; transform: translateY(4px); }
  20%  { opacity:1; transform: translateY(0); }
  80%  { opacity:1; }
  100% { opacity:0; }
}

/* ── App Download Banner ────────────────────────────── */
.app-banner {
  position: fixed;
  bottom: 72px; /* encima del footer nav */
  left: 12px;
  right: 12px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,.14);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  z-index: 1200;
  border: 1px solid var(--borde);
  animation: slideUpBanner .35s ease;
}
@keyframes slideUpBanner {
  from { opacity:0; transform: translateY(16px); }
  to   { opacity:1; transform: translateY(0); }
}
.app-banner-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}
.app-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-banner-text strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--texto);
}
.app-banner-text span {
  font-size: 11px;
  color: var(--gris);
}
.app-banner-btn {
  background: var(--primario);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
}
.app-banner-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gris);
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  flex-shrink: 0;
}

/* Menú item descarga app */
#menuDescargaApp {
  color: var(--primario);
  font-weight: 500;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  align-items: center;
  justify-content: center;
  overscroll-behavior: contain;
  touch-action: none;
}
#lightbox.open {
  display: flex;
}
#lightbox-close {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  line-height: 1;
  backdrop-filter: blur(4px);
}
#lightbox-close:hover {
  background: rgba(255,255,255,0.32);
}
#lightbox-img {
  width: 100vw;
  height: 100dvh;
  object-fit: contain;
  display: none;
  user-select: none;
  touch-action: none;
  transform-origin: center center;
  will-change: transform;
}
#lightbox-video {
  width: 100vw;
  height: 100dvh;
  object-fit: contain;
  display: none;
  touch-action: auto;
}

/* ── Animaciones de entrada de posts (como los grandes) ───────────────────── */
@keyframes post-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.post {
  animation: post-fade-in 0.3s ease both;
}
/* Delay escalonado para los primeros posts del feed */
.post:nth-child(1)  { animation-delay: 0ms; }
.post:nth-child(2)  { animation-delay: 50ms; }
.post:nth-child(3)  { animation-delay: 100ms; }
.post:nth-child(4)  { animation-delay: 150ms; }
.post:nth-child(5)  { animation-delay: 200ms; }
/* Resto sin delay para no frenar el scroll infinito */
.post:nth-child(n+6) { animation-delay: 0ms; }

/* ── Skeleton loader de posts (mientras carga el feed) ────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton-post {
  background: #fff;
  margin: 0;
  border-bottom: 6px solid #e5e7eb;
  padding: 16px;
  animation: post-fade-in 0.2s ease both;
}
.skeleton-line {
  border-radius: 6px;
  background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  flex-shrink: 0;
}
.skeleton-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.skeleton-meta { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.skeleton-name  { height: 13px; width: 45%; }
.skeleton-time  { height: 11px; width: 25%; }
.skeleton-text1 { height: 13px; width: 100%; margin-bottom: 8px; }
.skeleton-text2 { height: 13px; width: 80%; margin-bottom: 8px; }
.skeleton-text3 { height: 13px; width: 60%; margin-bottom: 12px; }
.skeleton-img {
  width: 100%; aspect-ratio: 4/5;
  border-radius: 0;
  background: linear-gradient(90deg, #ececec 25%, #f5f5f5 50%, #ececec 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  margin-bottom: 12px;
}
.skeleton-actions {
  display: flex; gap: 16px;
}
.skeleton-action { height: 28px; width: 60px; border-radius: 14px; }

/* ── Banner "Nueva versión disponible" ────────────────────────────────────── */
#sw-update-banner {
  display: none;
  position: fixed;
  bottom: 72px;
  left: 16px;
  right: 16px;
  max-width: 340px;
  margin: 0 auto;
  background: #0b3b8f;
  color: #fff;
  padding: 11px 16px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 9000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  animation: post-fade-in 0.3s ease both;
  gap: 10px;
  box-sizing: border-box;
}
#sw-update-banner.visible { display: flex; align-items: center; }
#sw-update-text { cursor: pointer; flex: 1; }
#sw-update-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 12px;
  flex-shrink: 0;
  min-width: 32px;
  text-align: center;
}

/* ── Modal Nueva Publicación (estilo Facebook) ────────────────────────────── */
/* Modal nueva publicación: bottom sheet igual que comentarios */
#modal-post {
  padding: 0;
  align-items: flex-end;
  z-index: 300;
}

.modal-new-post {
  width: 100%;
  max-width: 100%;
  height: calc(100dvh - env(safe-area-inset-top, 44px));
  max-height: calc(100dvh - env(safe-area-inset-top, 44px));
  margin-top: env(safe-area-inset-top, 44px);
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header: Título | Avatar+Nombre | X */
.np-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0 10px 16px;
  border-bottom: 1px solid var(--borde);
  position: relative;
}
.np-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--texto);
  flex-shrink: 0;
}
.np-header-author {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  padding-right: 8px;
}
.np-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--azul);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.np-avatar img { width: 100%; height: 100%; object-fit: cover; }
.np-author-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.np-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--texto);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-privacy-label {
  font-size: 11px;
  color: var(--gris);
  line-height: 1.2;
}
/* X pegada a la esquina superior derecha */
.np-close-right {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #333;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0 16px 0 0;
}
.np-close-right:hover { background: #f0f2f5; }

/* Form body (scrollable) — todo se extiende, nada se corta */
.np-form-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* La imagen ocupa todo su ancho y muestra altura completa */
/* NO poner display:block aquí — el JS controla display:none/block */
.np-media-preview img,
.np-media-preview video {
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: 8px;
}

/* Textarea: altura determinada SOLO por su contenido, nunca por flex */
.np-textarea {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 18px;
  color: var(--texto);
  padding: 8px 16px 12px;
  min-height: 120px;
  height: 120px; /* JS sobreescribe con scrollHeight */
  max-height: none;
  background: transparent;
  font-family: inherit;
  line-height: 1.5;
  box-sizing: border-box;
  overflow: hidden;
  flex: none; /* NUNCA crecer como flex item */
}
.np-textarea::placeholder { color: #bbb; }

/* Tags horizontales (dentro de np-bottom-bar) */
.np-tags-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.np-tags-row::-webkit-scrollbar { display: none; }
.np-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  border: 1.5px solid var(--borde);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--texto);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.np-tag-pill:hover { background: #f0f2f5; border-color: #bbb; }

/* Preview media */
.np-media-preview {
  margin: 0 16px 8px;
  border-radius: 10px;
  overflow: visible; /* NO cortar la imagen */
  position: relative;
  border: 1px solid var(--borde);
}
.np-media-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.np-media-label {
  font-size: 12px;
  color: var(--gris);
  padding: 4px 8px;
  background: #f9f9f9;
}

/* Barra de acciones + Publicar */
/* Barra inferior unificada: fija al fondo del modal */
.np-bottom-bar {
  flex-shrink: 0;
  border-top: 1px solid var(--borde);
  background: #fff;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Línea 2: iconos + publicar */
.np-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  gap: 8px;
}
.np-action-btns {
  display: flex;
  gap: 6px;
}
.np-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #f0f2f5;
  font-size: 20px;
  color: #444;
  cursor: pointer;
  transition: background 0.15s;
}
.np-action-btn:hover { background: #e4e6ea; }
label.np-action-btn { cursor: pointer; }
.np-gif-icon {
  font-size: 13px;
  font-weight: 800;
  color: #1877f2;
  letter-spacing: -0.5px;
}

/* Botón Publicar */
.np-submit {
  padding: 8px 22px;
  border-radius: 8px;
  border: none;
  background: var(--azul);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.np-submit:disabled {
  background: #e4e6ea;
  color: #bbb;
  cursor: not-allowed;
}
.np-submit:not(:disabled):hover { opacity: 0.9; }

/* ── Grid de fotos y videos en perfil ─────────────────────────────────────── */
.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
}
.profile-media-item {
  aspect-ratio: 1;
  overflow: hidden;
  background: #e8e8e8;
  cursor: pointer;
  position: relative;
}
.profile-media-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.profile-media-item img.loaded { opacity: 1; }
.profile-media-item video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.profile-media-video .profile-video-play {
  position: absolute;
  bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

/* ── Carrusel de fotos de perfil ──────────────────────────────────────────── */
.pcarousel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.pcarousel-overlay.open { display: flex; }

.pcarousel-close {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 16px);
  right: 16px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
}

.pcarousel-counter {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  font-weight: 500;
  z-index: 2;
  pointer-events: none;
}

/* Track: contenedor horizontal con snap */
.pcarousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pcarousel-track::-webkit-scrollbar { display: none; }

/* Cada slide */
.pcarousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pcarousel-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.pcarousel-slide img.loaded { opacity: 1; }

/* Dots indicadores */
.pcarousel-dots {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}
.pcarousel-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background 0.2s, transform 0.2s;
}
.pcarousel-dot.active {
  background: #fff;
  transform: scale(1.3);
}

/* ── Barra de engagement encima de botones (estilo Facebook/LinkedIn) ─────── */
.post-engagement-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid var(--borde);
  font-size: 13px;
  color: var(--gris);
}
.engagement-reactions {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.engagement-emoji { font-size: 15px; line-height: 1; }
.engagement-comments { cursor: pointer; }
.engagement-reactions:hover,
.engagement-comments:hover { text-decoration: underline; color: var(--texto); }

/* Emoji badges en la barra de engagement */
.engagement-reactions {
  display: flex;
  align-items: center;
  gap: 3px;
}
.engagement-emoji-badge {
  font-size: 16px;
  line-height: 1;
  margin-right: 1px;
}
.engagement-count {
  font-size: 13px;
  color: var(--gris);
  margin-left: 3px;
}

/* Barra engagement: el contador siempre azul si has reaccionado */
.engagement-reactions.reacted .engagement-count {
  color: var(--azul);
  font-weight: 600;
}

/* ── Estado de ánimo ─────────────────────────────────────────────────────── */

/* Inline en el nombre del post */
.post-estado-inline {
  font-weight: 400;
  color: var(--gris);
  font-size: 0.92em;
}

/* Modal selector — z-index mayor que modal-post (300) */
#modal-estado-animo {
  z-index: 400;
  padding: 0;
  align-items: flex-end;
}

.modal-estado-animo {
  width: 100%;
  max-width: 100%;
  height: calc(100dvh - env(safe-area-inset-top, 44px));
  margin-top: env(safe-area-inset-top, 44px);
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.estado-search-wrap {
  padding: 10px 16px;
  border-bottom: 1px solid var(--borde);
  flex-shrink: 0;
}
.estado-search {
  width: 100%;
  border: 1.5px solid var(--borde);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  background: #f0f2f5;
}
.estado-search:focus { border-color: var(--azul); background: #fff; }

.estado-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px 8px calc(12px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.estado-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border: none;
  background: none;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.estado-item:hover, .estado-item:active { background: #e8eaed; }
.estado-emoji { font-size: 36px; line-height: 1; }
.estado-label {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  text-align: center;
  line-height: 1.3;
}

/* Pill con estado seleccionado */
.pill-clear {
  margin-left: 4px;
  font-size: 14px;
  color: var(--gris);
  font-weight: 700;
  vertical-align: middle;
}

/* ── Ubicación en publicación ────────────────────────────────────────────── */
#modal-ubicacion { z-index: 400; padding: 0; align-items: flex-end; }

.ubicacion-results {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
.ubicacion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--borde);
  transition: background 0.15s;
}
.ubicacion-item:active, .ubicacion-item:hover { background: #f0f2f5; }
.ubicacion-buscando { color: var(--gris); font-size: 14px; cursor: default; }
.ubicacion-icon { font-size: 20px; flex-shrink: 0; }
.ubicacion-texto {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ubicacion-texto strong { font-size: 15px; font-weight: 600; color: var(--texto); }
.ubicacion-texto small { font-size: 12px; color: var(--gris); }

/* ===== PERSONAS (Menciones en publicaciones) ===== */
.personas-lista {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}
.personas-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--borde);
  transition: background 0.15s;
}
.personas-item:active, .personas-item:hover { background: #f0f2f5; }
.personas-item.selected { background: #e7f3ff; }
.personas-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--borde);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.personas-item-info {
  flex: 1;
}
.personas-item-nombre {
  font-size: 15px;
  font-weight: 600;
  color: var(--texto);
}
.personas-item-username {
  font-size: 13px;
  color: var(--gris);
}
.personas-item-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--borde);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.15s;
}
.personas-item.selected .personas-item-check {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
}
.personas-footer {
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--borde);
}
.personas-confirm-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #1877f2;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.personas-confirm-btn:active { background: #1460c5; }

/* Menciones en el feed */
.post-menciones {
  font-size: 14px;
  color: var(--gris);
  margin-top: 2px;
}
.post-menciones-link {
  color: #1877f2;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-size: 14px;
}
.post-menciones-link:hover { text-decoration: underline; }
/* Avatar de persona en lista ver */
.personas-ver-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--borde);
}
.personas-ver-item:last-child { border-bottom: none; }
.personas-ver-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.personas-ver-nombre { font-size: 15px; font-weight: 600; color: var(--texto); }
.personas-ver-username { font-size: 13px; color: var(--gris); }
