/* ==========================================================================
   CLOOST SOCIAL - COMPONENTES INTERACTIVOS, MODALES Y VISTAS
   ========================================================================== */

/* ==========================================================================
   1. MODAL BASE Y ANIMACIONES
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.active {
  display: flex !important;
  animation: fadeInModal 0.2s ease forwards;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-sheet {
  background: #FFFFFF;
  border-radius: 28px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  transform: scale(0.95) translateY(20px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-backdrop.active .modal-sheet {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   2. MODAL DE CREACIÓN DE PUBLICACIÓN
   ========================================================================== */
.post-creator-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-type-selector {
  display: flex;
  gap: 8px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: var(--radius-pill);
}

.post-type-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  transition: var(--transition-fast);
}

.post-type-btn.active {
  background: #FFFFFF;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.post-type-btn.anonymous.active {
  background: #7C3AED;
  color: #FFFFFF;
}

.post-type-btn.business.active {
  background: #0284C7;
  color: #FFFFFF;
}

.creator-textarea {
  width: 100%;
  min-height: 120px;
  border: none;
  resize: none;
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.6;
}

.creator-textarea::placeholder {
  color: #94A3B8;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.preview-thumb-box {
  position: relative;
  height: 110px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.preview-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn-remove-preview {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(15, 23, 42, 0.75);
  color: #FFF;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.category-tags-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.cat-tag-pill {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: #F1F5F9;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.cat-tag-pill.active {
  background: #E0F2FE;
  color: #0284C7;
  border-color: #BAE6FD;
}

.btn-submit-post {
  background: var(--primary-blue);
  color: #FFF;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  transition: var(--transition-fast);
}

.btn-submit-post:hover {
  background: var(--primary-blue-hover);
}

/* ==========================================================================
   3. MODAL Y CAJÓN DE COMENTARIOS
   ========================================================================== */
.comments-list-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.comment-bubble-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.comment-content-box {
  flex: 1;
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment-author-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

.comment-text {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
}

.comment-time-sub {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.comment-form-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid #F1F5F9;
  padding-top: 14px;
}

.comment-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.anonymous-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: #F1F5F9;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.anonymous-switch-btn.active {
  background: #7C3AED;
  color: #FFF;
}

.comment-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.comment-input-field {
  flex: 1;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 0.92rem;
  color: var(--text-main);
}

.comment-input-field:focus {
  background: #FFF;
  border-color: var(--primary-blue);
}

.btn-send-comment {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--primary-blue);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-send-comment:hover {
  background: var(--primary-blue-hover);
  transform: scale(1.05);
}

/* ==========================================================================
   4. VISOR DE HISTORIAS A PANTALLA COMPLETA (STORY VIEWER)
   ========================================================================== */
.story-viewer-modal {
  position: fixed;
  inset: 0;
  background: #000000;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
}

.story-viewer-modal.active {
  display: flex !important;
  animation: fadeInModal 0.2s ease forwards;
}

.story-viewer-frame {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 100%;
  max-height: 840px;
  border-radius: 28px;
  overflow: hidden;
  background: #1E293B;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.story-progress-bar-container {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
  z-index: 20;
}

.story-progress-segment {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #FFFFFF;
  border-radius: var(--radius-pill);
}

.story-viewer-header {
  position: absolute;
  top: 26px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  color: #FFF;
}

.story-viewer-author {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-viewer-image-container {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.story-caption-overlay {
  position: absolute;
  bottom: 80px;
  left: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFF;
  padding: 12px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

.story-nav-touch-left, .story-nav-touch-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 35%;
  z-index: 10;
  cursor: pointer;
}

.story-nav-touch-left { left: 0; }
.story-nav-touch-right { right: 0; }

.story-viewer-footer {
  position: absolute;
  bottom: 16px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

.story-reply-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  color: #FFF;
  font-size: 0.9rem;
  backdrop-filter: blur(4px);
}

.story-reply-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   5. MENSAJERÍA DIRECTA Y CHAT (MESSAGES) - FULL WIDTH & RESPONSIVE
   ========================================================================== */

/* Layout específico para la página de mensajes: 100% de lado a lado */
.messages-full-layout {
  display: block !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 12px 20px 20px 20px !important;
  box-sizing: border-box;
}

.messages-feed-full {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
}

/* Ocultar barra flotante en la sala de mensajes para no tapar el input de chat */
.messages-full-layout ~ .floating-bottom-nav-container {
  display: none !important;
}

/* Contenedor Principal del Chat */
.chat-page-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  background: #FFFFFF;
  border-radius: 24px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  overflow: hidden;
  height: calc(100vh - 90px);
  min-height: 520px;
  width: 100%;
}

/* Columna Lateral de Conversaciones */
.chat-sidebar-list {
  border-right: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #FFFFFF;
  min-width: 0;
}

.chat-list-header {
  padding: 16px 20px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-list-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-list-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.chat-new-btn {
  background: #EFF6FF;
  color: var(--primary-blue);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.chat-new-btn:hover {
  background: var(--primary-blue);
  color: #FFFFFF;
}

.chat-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.chat-search-wrapper svg {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.chat-search-input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.chat-search-input:focus {
  border-color: var(--primary-blue);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(42, 133, 255, 0.12);
}

.chat-conversations-scroll {
  overflow-y: auto;
  flex: 1;
}

.chat-empty-list {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chat-contact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid #F8FAFC;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.chat-contact-item:hover {
  background: #F8FAFC;
}

.chat-contact-item.active {
  background: #EFF6FF;
  border-left: 3px solid var(--primary-blue);
}

.contact-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.contact-info-col {
  flex: 1;
  min-width: 0;
}

.contact-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.contact-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-time {
  font-size: 0.72rem;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.contact-info-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.contact-last-msg {
  font-size: 0.83rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.chat-contact-item.active .contact-last-msg {
  color: #1E40AF;
}

.online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  border-radius: var(--radius-pill);
  background: #10B981;
  border: 2px solid #FFF;
}

/* Columna Principal: Ventana del Chat Activo */
.chat-main-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #F8FAFC;
  min-width: 0;
}

.chat-window-header {
  background: #FFFFFF;
  padding: 14px 22px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-back-btn {
  display: none;
  background: #F1F5F9;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-main);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.chat-back-btn:hover {
  background: #E2E8F0;
}

.chat-messages-stream {
  flex: 1;
  padding: 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #F8FAFC;
}

.chat-bubble {
  max-width: 68%;
  padding: 12px 18px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-word;
}

.chat-bubble.them {
  align-self: flex-start;
  background: #FFFFFF;
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  border-bottom-left-radius: 4px;
  border: 1px solid #F1F5F9;
}

.chat-bubble.me {
  align-self: flex-end;
  background: var(--primary-blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(42, 133, 255, 0.25);
  border-bottom-right-radius: 4px;
}

.chat-bubble-time {
  font-size: 0.72rem;
  opacity: 0.75;
  align-self: flex-end;
}

.chat-input-bar {
  background: #FFFFFF;
  padding: 14px 22px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.chat-attach-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.chat-attach-btn:hover {
  color: var(--primary-blue);
  background: #EFF6FF;
}

.chat-text-input {
  flex: 1;
  background: #F1F5F9;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.chat-text-input:focus {
  background: #FFFFFF;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(42, 133, 255, 0.12);
}

.btn-send-message {
  background: var(--primary-blue);
  color: #FFFFFF;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(42, 133, 255, 0.3);
  transition: var(--transition-fast);
}

.btn-send-message:hover {
  background: var(--primary-blue-hover);
  transform: scale(1.04);
}

/* ==========================================================================
   RESPONSIVE ADAPTABILITY: DESKTOP, TABLET & MOBILE
   ========================================================================== */

/* Tablet (768px a 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .messages-full-layout {
    padding: 10px 14px 14px 14px !important;
  }
  .chat-page-container {
    grid-template-columns: 290px 1fr;
    height: calc(100vh - 85px);
    border-radius: 20px;
  }
  .chat-bubble {
    max-width: 80%;
  }
}

/* Teléfonos Móviles (< 768px) */
@media (max-width: 767px) {
  .messages-full-layout {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .chat-page-container {
    grid-template-columns: 1fr;
    height: calc(100dvh - 65px);
    border-radius: 0;
    border: none;
  }

  /* Vista Lista de Conversaciones en móvil */
  .chat-sidebar-list {
    display: flex;
    width: 100%;
    height: 100%;
    border-right: none;
  }

  /* Vista Sala de Chat en móvil: oculta hasta seleccionar una */
  .chat-main-window {
    display: none;
    width: 100%;
    height: 100%;
  }

  /* Cuando el usuario entra en una conversación en móvil */
  .chat-page-container.mobile-chat-active .chat-sidebar-list {
    display: none !important;
  }

  .chat-page-container.mobile-chat-active .chat-main-window {
    display: flex !important;
  }

  .chat-back-btn {
    display: inline-flex !important;
  }

  .chat-messages-stream {
    padding: 16px;
  }

  .chat-bubble {
    max-width: 85%;
  }

  .chat-input-bar {
    padding: 10px 14px;
    gap: 8px;
  }

  .chat-text-input {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .btn-send-message {
    width: 40px;
    height: 40px;
  }
}

/* ==========================================================================
   6. VISTA DE PERFIL Y NEGOCIO (LINKEDIN + X HYBRID)
   ========================================================================== */

/* Layout enfocado sin sidebar derecha */
.main-layout.profile-main-layout {
  max-width: 1060px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .main-layout.profile-main-layout {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 28px;
    padding: 24px 16px;
  }
  .profile-main-layout .feed-content {
    max-width: 760px;
    margin: 0;
  }
}

@media (min-width: 1200px) {
  .main-layout.profile-main-layout {
    grid-template-columns: 270px minmax(0, 1fr);
    gap: 32px;
  }
  .profile-main-layout .feed-content {
    max-width: 780px;
  }
}

.profile-card-main {
  background: #FFFFFF;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.profile-cover-banner {
  height: 200px;
  width: 100%;
  background: linear-gradient(135deg, #2A85FF, #7C3AED);
  position: relative;
  overflow: hidden;
}

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

/* Botón flotante para cambiar foto de portada */
.btn-change-cover-pill {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transition: var(--transition-fast);
  user-select: none;
  z-index: 2;
}

.btn-change-cover-pill:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.profile-details-body {
  padding: 0 24px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.profile-avatar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -50px;
}

.profile-avatar-wrap {
  position: relative;
  display: inline-flex;
}

.profile-avatar-lg {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-pill);
  border: 4px solid #FFFFFF;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  background: #FFFFFF;
  display: block;
}

/* Botón badge para cambiar foto de perfil */
.btn-change-avatar-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2.5px solid #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: var(--transition-fast);
  z-index: 2;
}

.btn-change-avatar-badge:hover {
  transform: scale(1.1);
  background: #1e70e3;
}

.profile-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-profile-action {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  color: var(--text-main);
  transition: var(--transition-fast);
}

.btn-profile-action:hover {
  background: #F1F5F9;
}

.btn-profile-action.primary {
  background: var(--primary-blue);
  color: #FFFFFF;
  border-color: var(--primary-blue);
}

.profile-stats-bar {
  display: flex;
  gap: 24px;
  padding: 12px 0;
  border-top: 1px solid #F1F5F9;
  border-bottom: 1px solid #F1F5F9;
}

.stat-item-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-number {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.profile-tabs-nav {
  display: flex;
  border-bottom: 1px solid #F1F5F9;
  gap: 16px;
  margin-top: 8px;
}

.profile-tab-btn {
  padding: 12px 6px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  position: relative;
  cursor: pointer;
}

.profile-tab-btn.active {
  color: var(--primary-blue);
}

.profile-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-blue);
  border-radius: var(--radius-pill);
}

/* Tarjeta de Servicios de Negocio (LinkedIn Mode) */
.business-services-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  padding: 16px 0;
}

.service-card-item {
  background: #FFFFFF;
  border-radius: 20px;
  padding: 20px;
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: var(--transition-fast);
}

.service-card-item:hover {
  border-color: #CBD5E1;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.service-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
}

.service-price {
  font-weight: 700;
  font-size: 0.95rem;
  color: #059669;
}

.service-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ==========================================================================
   7. PANTALLA DE LOGIN Y REGISTRO
   ========================================================================== */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #FFFFFF;
  border-radius: 32px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.demo-account-pill-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #F8FAFC;
  border-radius: 20px;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: var(--transition-fast);
}

.demo-account-pill-card:hover {
  border-color: var(--primary-blue);
  background: #F0F7FF;
  transform: translateY(-2px);
}

/* ==========================================================================
   8. TOAST DE NOTIFICACIONES
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToastIn 0.3s ease;
}

@keyframes slideToastIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   9. POPOVER DE NOTIFICACIONES DESPLEGABLE
   ========================================================================== */
.notifications-popover-menu {
  position: absolute;
  top: 54px;
  right: 0;
  width: 330px;
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid #E2E8F0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.notifications-popover-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.notif-popover-header {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.95rem;
}

.notif-popover-body {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.notif-popover-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #F8FAFC;
  transition: background 0.15s ease;
}

.notif-popover-item:hover {
  background: #F8FAFC;
}

.notif-popover-item.unread {
  background: #EFF6FF;
}

/* ==========================================================================
   10. MENÚ CONTEXTUAL DE 3 PUNTOS EN POSTS
   ========================================================================== */
.post-options-dropdown-container {
  position: relative;
}

.post-options-menu {
  position: absolute;
  top: 44px;
  right: 0;
  width: 210px;
  background: #FFFFFF;
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
  border: 1px solid #E2E8F0;
  padding: 6px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-options-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Apertura hacia arriba cuando está cerca del borde inferior */
.post-options-menu.drop-up {
  top: auto;
  bottom: 44px;
  transform: translateY(6px) scale(0.95);
  box-shadow: 0 -14px 36px rgba(15, 23, 42, 0.16);
}

.post-options-menu.drop-up.active {
  transform: translateY(0) scale(1);
}

.post-option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: left;
  transition: background 0.15s ease;
  width: 100%;
}

.post-option-item:hover {
  background: #F1F5F9;
  color: var(--primary-blue);
}

.post-option-item.delete:hover {
  background: #FEF2F2;
  color: #EF4444;
}

.promoted-tag-badge {
  font-size: 0.72rem;
  background: linear-gradient(135deg, #FEF08A, #FDE047);
  color: #854D0E;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 800;
}

/* Miniaturas en Lightbox */
.lightbox-thumb-btn {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  opacity: 0.6;
  transition: all 0.2s ease;
  cursor: pointer;
}

.lightbox-thumb-btn.active {
  border-color: var(--primary-blue);
  opacity: 1;
  transform: scale(1.08);
}

.lightbox-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   11. MINI VENTANA DESPLEGABLE DEL MENÚ (3 RAYITAS)
   ========================================================================== */
.nav-menu-popover {
  position: absolute;
  top: 54px;
  left: 0;
  width: 290px;
  max-width: calc(100vw - 32px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  border: 1px solid #E2E8F0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-menu-popover.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.nav-popover-header {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-popover-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 480px;
  overflow-y: auto;
}

.nav-popover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.nav-popover-item:hover {
  background: #F8FAFC;
  color: var(--primary-blue);
}

.nav-popover-item.active {
  background: #EFF6FF;
  color: var(--primary-blue);
}

.nav-popover-item.action {
  background: #EFF6FF;
  color: var(--primary-blue);
  margin-top: 4px;
}

.nav-popover-item.action:hover {
  background: var(--primary-blue);
  color: #FFFFFF;
}

/* ==========================================================================
   12. BOTÓN DE CHAT, BURBUJA Y MINI VENTANA DE MENSAJES
   ========================================================================== */
.nav-chat-pill {
  position: relative;
}

.nav-badge-pill, #notifCountBadge {
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 9999px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
  animation: popBadgeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popBadgeIn {
  0% { transform: scale(0); opacity: 0; }
  80% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.chat-popover-menu {
  position: absolute;
  top: 54px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  border: 1px solid #E2E8F0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-popover-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-popover-header {
  padding: 14px 18px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 0.95rem;
}

.chat-popover-body {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-popover-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #F8FAFC;
  text-decoration: none;
  transition: background 0.15s ease;
}

.chat-popover-item:hover {
  background: #F8FAFC;
}

.chat-popover-item.unread {
  background: #EFF6FF;
}

.chat-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-blue);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(42, 133, 255, 0.6);
}

.chat-popover-footer {
  padding: 10px 16px;
  border-top: 1px solid #F1F5F9;
  text-align: center;
  background: #FAFBFD;
}

.btn-chat-popover-action {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--primary-blue);
  padding: 8px 12px;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-chat-popover-action:hover {
  background: #EFF6FF;
}

/* ==========================================================================
   8. RENGLÓN DE CARGA DE PUBLICACIÓN (OPTIMISTIC UPLOADING PROGRESS UI)
   ========================================================================== */
.publishing-progress-card {
  background: #FFFFFF;
  border-radius: 24px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid #EBF2FA;
  display: flex;
  align-items: center;
  gap: 14px;
  animation: slideInDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.4s ease;
  margin-bottom: 6px;
}

.publishing-progress-card.finished {
  background: #F0FDF4;
  border-color: #BBF7D0;
}

.publishing-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.publishing-avatar-wrap .user-avatar-round {
  width: 42px;
  height: 42px;
  border: 2px solid #FFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.publishing-thumb-preview {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  object-fit: cover;
  border: 2px solid #FFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.publishing-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.publishing-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.publishing-status-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.publishing-percent-badge {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--primary-blue);
  font-variant-numeric: tabular-nums;
}

.publishing-bar-track {
  width: 100%;
  height: 6px;
  background: #F1F5F9;
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.publishing-bar-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-blue), #60A5FA);
  border-radius: 99px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.publishing-bar-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.5) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  animation: shimmerProgress 1.4s infinite;
}

@keyframes shimmerProgress {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.publishing-spinner-icon {
  width: 22px;
  height: 22px;
  border: 2.5px solid #E2E8F0;
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ==========================================================================
   9. BURBUJA Y VENTANA EMERGENTE DE CHAT FLOTANTE (MULTI-PERSONA DOCK)
   ========================================================================== */
.floating-chat-container {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 850;
  font-family: inherit;
}

@media (max-width: 768px) {
  .floating-chat-container {
    bottom: 84px;
    right: 18px;
  }
}

/* Botón Circular Flotante (Burbuja) */
.floating-chat-bubble {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #0062E3 100%);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 10px 28px rgba(42, 133, 255, 0.44);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease;
  outline: none;
}

.floating-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 34px rgba(42, 133, 255, 0.52);
}

.floating-chat-bubble:active {
  transform: scale(0.95);
}

.floating-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #EF4444;
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 99px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  animation: pulseBadge 2s infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Ventana Emergente de Chat */
.floating-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  height: 490px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 120px);
  background: #FFFFFF;
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.92);
  transform-origin: bottom right;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 860;
}

.floating-chat-window.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Cabecera del Chat Flotante */
.floating-chat-header {
  background: #FFFFFF;
  border-bottom: 1px solid #F1F5F9;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.floating-chat-back-btn {
  background: #F1F5F9;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s;
}

.floating-chat-back-btn:hover {
  background: #E2E8F0;
}

.floating-chat-header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.floating-chat-header-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.floating-chat-header-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.floating-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floating-chat-action-btn {
  background: transparent;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.floating-chat-action-btn:hover {
  background: #F1F5F9;
  color: var(--text-main);
}

/* Pestañas de Múltiples Personas Activas */
.floating-chat-multi-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #F8FAFC;
  border-bottom: 1px solid #F1F5F9;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.floating-chat-multi-tabs::-webkit-scrollbar {
  display: none;
}

.floating-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  position: relative;
  flex-shrink: 0;
}

.floating-tab-pill span {
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-tab-pill:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.floating-tab-pill.active {
  background: #EFF6FF;
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.floating-tab-pill img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

/* Panel 1: Lista Vertical de Conversaciones */
.floating-chat-list-panel {
  flex: 1;
  display: flex;
  flex-direction: column !important;
  min-height: 0;
  overflow: hidden;
  background: #FFFFFF;
  width: 100%;
}

/* Buscador en la Lista (Cajita moderna con icono) */
.floating-chat-search-wrap {
  padding: 10px 14px;
  background: #FFFFFF;
  border-bottom: 1px solid #F1F5F9;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

.floating-chat-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #F1F5F9;
  border-radius: 99px;
  padding: 8px 14px;
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

.floating-chat-search-box:focus-within {
  background: #FFFFFF;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(42, 133, 255, 0.12);
}

.floating-chat-search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.86rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
}

/* Scroll de Contactos / Chats */
.floating-chat-contacts-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  box-sizing: border-box;
}

.floating-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
  color: inherit;
  width: 100%;
  box-sizing: border-box;
}

.floating-contact-item:hover {
  background: #F1F5F9;
}

.floating-contact-item.active {
  background: #EFF6FF;
}

.floating-contact-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.floating-contact-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.floating-contact-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.floating-contact-lastmsg {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* Panel de Conversación */
.floating-chat-conversation-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #FAFBFD;
}

.floating-chat-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.floating-msg-bubble {
  max-width: 78%;
  padding: 9px 13px;
  font-size: 0.86rem;
  line-height: 1.4;
  word-break: break-word;
  animation: fadeInMsg 0.2s ease;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.floating-msg-bubble.me {
  align-self: flex-end;
  background: var(--primary-blue);
  color: #FFFFFF;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 2px 8px rgba(42, 133, 255, 0.25);
}

.floating-msg-bubble.them {
  align-self: flex-start;
  background: #FFFFFF;
  color: var(--text-main);
  border: 1px solid #E2E8F0;
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.floating-msg-time {
  font-size: 0.68rem;
  margin-top: 3px;
  opacity: 0.75;
  text-align: right;
}

/* Input Bar Inferior */
.floating-chat-input-bar {
  padding: 10px 14px;
  background: #FFFFFF;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.floating-chat-input-bar input {
  flex: 1;
  border: none;
  background: #F1F5F9;
  border-radius: 99px;
  padding: 9px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  transition: background 0.15s;
}

.floating-chat-input-bar input:focus {
  background: #EFF6FF;
}

.floating-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
}

.floating-chat-send-btn:hover {
  transform: scale(1.05);
  background: #0066FF;
}

/* ==========================================================================
   NUEVAS FUNCIONALIDADES DE CHAT: IMÁGENES, EMOJIS, CITAS Y MENÚ HOVER (•••)
   ========================================================================== */

/* Fila de Mensaje que contiene la burbuja y las acciones en hover */
.chat-msg-row {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  gap: 8px;
}

.chat-msg-row.me {
  justify-content: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-row.them {
  justify-content: flex-start;
  flex-direction: row;
}

/* Botón de 3 puntos (•••) para Opciones del Mensaje */
.msg-options-trigger {
  opacity: 0;
  pointer-events: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid #E2E8F0;
  color: #64748B;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.18s ease, background 0.18s ease, transform 0.15s ease;
  flex-shrink: 0;
  z-index: 10;
}

.chat-msg-row:hover .msg-options-trigger,
.chat-msg-row:focus-within .msg-options-trigger {
  opacity: 1;
  pointer-events: auto;
}

/* En dispositivos táctiles permitir ver el botón ligeramente */
@media (hover: none) {
  .msg-options-trigger {
    opacity: 0.65;
    pointer-events: auto;
  }
}

.msg-options-trigger:hover {
  background: #F1F5F9;
  color: var(--primary-blue);
  transform: scale(1.08);
}

/* Menú Contextual Desplegable */
.msg-dropdown-menu {
  position: absolute;
  background: #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
  border: 1px solid #E2E8F0;
  padding: 6px;
  min-width: 145px;
  z-index: 150;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: fadeInMsg 0.15s ease;
}

.msg-dropdown-menu.active {
  display: flex;
}

.msg-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}

.msg-dropdown-item:hover {
  background: #F1F5F9;
  color: var(--primary-blue);
}

.msg-dropdown-item.danger {
  color: #EF4444;
}

.msg-dropdown-item.danger:hover {
  background: #FEF2F2;
  color: #DC2626;
}

/* Cita / Bloque de Respuesta dentro de la burbuja */
.chat-bubble-reply-quote {
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 6px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 3px solid;
  cursor: pointer;
  transition: opacity 0.15s;
}

.chat-bubble-reply-quote:hover {
  opacity: 0.88;
}

.chat-bubble.me .chat-bubble-reply-quote {
  background: rgba(255, 255, 255, 0.2);
  border-left-color: #FFFFFF;
  color: #FFFFFF;
}

.chat-bubble.them .chat-bubble-reply-quote {
  background: #F1F5F9;
  border-left-color: var(--primary-blue);
  color: var(--text-main);
}

.chat-bubble-reply-author {
  font-weight: 700;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-bubble-reply-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  opacity: 0.9;
}

/* ==========================================================================
   IMÁGENES EN CHAT: CERO MARCOS, ASPECTO NATURAL SIN RECORTAR
   ========================================================================== */

/* Burbuja cuando el mensaje es ÚNICAMENTE una imagen: CERO marcos ni fondos coloreados */
.chat-bubble.only-image {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 2px 0;
  max-width: min(340px, 80vw);
}

/* Burbuja cuando el mensaje tiene imagen Y además texto */
.chat-bubble.has-image-and-text {
  padding: 0 !important;
  overflow: hidden;
  max-width: min(340px, 80vw);
}

.chat-bubble.has-image-and-text .chat-bubble-caption {
  padding: 8px 14px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Contenedor de la imagen: sin marco artificial, bordes suaves y sombra sutil */
.chat-media-card {
  position: relative;
  display: inline-block;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  background: transparent;
  line-height: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  width: 100%;
}

.chat-bubble.has-image-and-text .chat-media-card {
  border-radius: 18px 18px 0 0;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* La imagen en sí: tal cual es, sin recortar, proporciones 100% naturales */
.chat-natural-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  background: transparent;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.chat-media-card:hover .chat-natural-img {
  filter: brightness(0.97);
}

/* Badge flotante elegante con la hora sobre la foto (estilo WhatsApp / Telegram) */
.chat-img-time-badge {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Compatibilidad para chat flotante */
.floating-msg-bubble.only-image {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: min(240px, 72vw);
}

.floating-msg-bubble.has-image-and-text {
  padding: 0 !important;
  overflow: hidden;
  max-width: min(240px, 72vw);
}

.floating-msg-bubble.has-image-and-text .chat-bubble-caption {
  padding: 6px 10px 8px 10px;
  font-size: 0.85rem;
}

/* Barra de Previsualización de Respuesta antes de enviar */
.chat-reply-preview-bar {
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  border-left: 4px solid var(--primary-blue);
  padding: 8px 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
  animation: fadeInMsg 0.18s ease;
}

.chat-reply-preview-bar.active {
  display: flex;
}

.reply-preview-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.reply-preview-author {
  font-weight: 700;
  color: var(--primary-blue);
  font-size: 0.78rem;
}

.reply-preview-snippet {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reply-preview-cancel-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.reply-preview-cancel-btn:hover {
  background: #E2E8F0;
  color: #EF4444;
}

/* Barra de Previsualización de Imagen Adjunta antes de enviar */
.chat-image-preview-bar {
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  padding: 8px 16px;
  display: none;
  align-items: center;
  gap: 12px;
  animation: fadeInMsg 0.18s ease;
}

.chat-image-preview-bar.active {
  display: flex;
}

.chat-image-preview-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #CBD5E1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.chat-image-preview-info {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
}

.chat-image-preview-name {
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-image-preview-size {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* Selector Popover de Emojis */
.emoji-picker-popover {
  position: absolute;
  bottom: 74px;
  left: 20px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  width: 320px;
  max-width: 90vw;
  display: none;
  flex-direction: column;
  z-index: 300;
  overflow: hidden;
  animation: fadeInMsg 0.18s ease;
}

.emoji-picker-popover.active {
  display: flex;
}

/* Ajuste para el chat flotante */
.floating-chat-window .emoji-picker-popover {
  bottom: 64px;
  left: 10px;
  right: 10px;
  width: auto;
}

.emoji-picker-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #F1F5F9;
  background: #F8FAFC;
  padding: 6px 8px;
  gap: 4px;
}

.emoji-category-tab {
  flex: 1;
  padding: 6px 2px;
  font-size: 1.1rem;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, transform 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-category-tab:hover {
  background: #E2E8F0;
  transform: scale(1.1);
}

.emoji-category-tab.active {
  background: #EFF6FF;
  box-shadow: inset 0 -2px 0 var(--primary-blue);
}

.emoji-picker-search {
  padding: 8px 12px;
  border-bottom: 1px solid #F1F5F9;
}

.emoji-picker-search input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  font-size: 0.8rem;
  background: #F8FAFC;
  outline: none;
}

.emoji-picker-search input:focus {
  border-color: var(--primary-blue);
  background: #FFFFFF;
}

.emoji-grid-container {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 10px;
  max-height: 210px;
  overflow-y: auto;
}

.emoji-grid-btn {
  font-size: 1.35rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.12s;
  user-select: none;
}

.emoji-grid-btn:hover {
  background: #EFF6FF;
  transform: scale(1.22);
}

/* Lightbox para ver imágenes ampliadas */
.chat-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeInMsg 0.2s ease;
}

.chat-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  object-fit: contain;
}

.chat-lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   ALIAS Y UNIFICACIÓN DE MODALES
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.2s ease forwards;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-container {
  background: #FFFFFF;
  border-radius: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  animation: fadeInMsg 0.22s ease forwards;
}

/* ==========================================================================
   ADAPTABILIDAD MÓVIL EXHAUSTIVA (< 768px y < 600px)
   ========================================================================== */

@media (max-width: 768px) {
  /* Evitar cualquier scroll horizontal no deseado sin crear doble barra vertical */
  body {
    overflow-x: clip !important;
    max-width: 100% !important;
  }

  .main-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 12px !important;
    gap: 14px !important;
  }

  /* En móvil, ocultar la burbuja circular flotante para que no tape las fotos del feed ni la barra inferior */
  .floating-chat-container {
    display: none !important;
  }

  /* Padding inferior generoso en el feed móvil para que la barra inferior flotante no tape publicaciones */
  .feed-content,
  #postsFeedContainer {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .feed-content {
    padding-bottom: 125px !important;
    gap: 14px !important;
  }

  /* Chat Principal */
  .chat-page-container {
    height: calc(100dvh - 70px) !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .chat-messages-stream {
    padding: 12px 10px !important;
    gap: 12px !important;
  }

  .chat-bubble {
    max-width: 88% !important;
  }

  .chat-bubble.only-image,
  .chat-bubble.has-image-and-text {
    max-width: min(280px, 82vw) !important;
  }

  /* Popover de emojis adaptativo a toda la pantalla del teléfono */
  .emoji-picker-popover {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-width: calc(100vw - 16px) !important;
    bottom: 64px !important;
    border-radius: 16px !important;
  }

  .emoji-grid-container {
    grid-template-columns: repeat(7, 1fr) !important;
    max-height: 180px !important;
  }

  /* Previews de chat en móvil */
  .chat-reply-preview-bar,
  .chat-image-preview-bar {
    padding: 6px 12px !important;
  }
}

@media (max-width: 600px) {
  /* Cabecera superior (Top Nav) */
  .top-nav {
    padding: 10px 12px 14px 12px !important;
  }

  .nav-page-title {
    font-size: 1.15rem !important;
    max-width: 130px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .nav-icon-btn,
  .nav-notification-pill {
    height: 40px !important;
  }

  .nav-icon-btn {
    width: 40px !important;
  }

  .nav-notification-pill {
    padding: 0 12px !important;
  }

  /* Popovers del menú superior: nunca desbordar fuera de pantalla */
  .nav-menu-popover,
  .notifications-popover-menu,
  .chat-popover-menu {
    position: fixed !important;
    top: 60px !important;
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100vw - 20px) !important;
    border-radius: 20px !important;
  }

  /* Historias en móvil */
  .stories-container {
    gap: 10px !important;
    padding: 4px 2px 10px 2px !important;
  }

  .story-item {
    width: 68px !important;
  }

  .story-card-wrapper,
  .story-your-wrapper {
    width: 66px !important;
    height: 88px !important;
    border-radius: 18px !important;
  }

  /* Caja de crear publicación en móvil */
  .create-post-quick-card {
    padding: 14px !important;
    border-radius: 22px !important;
    gap: 10px !important;
  }

  .create-post-top-row {
    gap: 10px !important;
  }

  .user-avatar-round {
    width: 40px !important;
    height: 40px !important;
  }

  .create-post-trigger-input {
    padding: 10px 14px !important;
    font-size: 0.85rem !important;
  }

  /* Botones de acción rápida para crear publicación en móvil */
  .create-post-actions-row {
    gap: 4px !important;
  }

  .quick-action-btn {
    flex: 1 1 0 !important;
    font-size: 0.75rem !important;
    padding: 7px 6px !important;
    gap: 4px !important;
  }

  .quick-action-btn svg {
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0 !important;
  }

  /* Post Card en móvil */
  .post-card {
    border-radius: 22px !important;
    padding: 16px 14px !important;
    gap: 12px !important;
  }

  .post-author-info {
    gap: 10px !important;
  }

  .post-author-name {
    font-size: 0.95rem !important;
  }

  .post-sub-meta {
    font-size: 0.75rem !important;
    gap: 4px !important;
  }

  .post-category-pill {
    padding: 5px 12px !important;
    font-size: 0.75rem !important;
  }

  /* Carrusel / Pila de imágenes en publicaciones (Móvil) */
  .post-media-stack {
    min-height: 220px !important;
    padding: 6px 0 !important;
  }

  .stack-card-center {
    width: 68% !important;
    height: 205px !important;
    border-radius: 20px !important;
  }

  .stack-card-left,
  .stack-card-right {
    width: 54% !important;
    height: 180px !important;
    border-radius: 18px !important;
  }

  .post-text-content {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
  }

  /* Acciones inferiores de cada publicación en móvil */
  .post-actions-row {
    gap: 6px !important;
  }

  .post-stats-pill-group {
    padding: 5px 10px !important;
    gap: 6px !important;
  }

  .stat-action-btn {
    font-size: 0.8rem !important;
    padding: 3px 4px !important;
    gap: 4px !important;
  }

  .post-comment-input-pill {
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    gap: 6px !important;
  }

  .post-more-btn {
    width: 36px !important;
    height: 36px !important;
  }

  /* Perfil en móvil */
  .profile-cover-banner {
    height: 150px !important;
  }

  .profile-avatar-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-top: -42px !important;
  }

  .profile-avatar-lg {
    width: 84px !important;
    height: 84px !important;
  }

  .profile-actions-group {
    width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .btn-profile-action {
    flex: 1 1 auto !important;
    text-align: center !important;
    padding: 7px 12px !important;
    font-size: 0.82rem !important;
  }

  .profile-details-body {
    padding: 0 14px 18px 14px !important;
  }

  .profile-stats-bar {
    gap: 10px !important;
    justify-content: space-around !important;
  }

  .profile-tabs-nav {
    overflow-x: auto !important;
    scrollbar-width: none !important;
    white-space: nowrap !important;
    gap: 12px !important;
  }

  .profile-tabs-nav::-webkit-scrollbar {
    display: none !important;
  }

  /* Modales en móvil */
  .modal-sheet,
  .modal-container {
    max-width: calc(100vw - 24px) !important;
    border-radius: 20px !important;
    max-height: calc(100dvh - 40px) !important;
    margin: auto !important;
  }

  .modal-header,
  .modal-footer {
    padding: 14px 18px !important;
  }

  .modal-body {
    padding: 16px 18px !important;
  }

  /* Barra flotante inferior de móvil */
  .floating-bottom-nav {
    gap: 6px !important;
    padding: 4px !important;
  }

  .nav-circle-btn {
    width: 46px !important;
    height: 46px !important;
  }

  .nav-pill-active-btn {
    height: 46px !important;
    padding: 0 16px !important;
  }
}



