/* ===================== FEED SOCIAL (Fase 3) ===================== */
.feed-page {
  position: fixed; inset: 0; z-index: 1000;
  display: none; flex-direction: column;
  background: var(--bg-base, #0d1117);
  overflow: hidden;
}
.feed-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.feed-brand { font: 700 1.15rem var(--font-display, sans-serif); color: var(--text-primary); display: flex; align-items: center; gap: 9px; }
.feed-brand i { color: var(--primary); }
.feed-brand strong { color: var(--primary); }
.feed-back-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  font-weight: 600; cursor: pointer; transition: background .2s;
}
.feed-back-btn:hover { background: var(--primary-dark, #4f46e5); }

.feed-layout { flex: 1; display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 24px; max-width: 1180px; width: 100%; margin: 0 auto; padding: 22px; overflow-y: auto; }
.feed-main { min-width: 0; }
.feed-list { display: flex; flex-direction: column; gap: 16px; }

/* Avatares */
.feed-avatar { border-radius: 50%; overflow: hidden; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primary-dim, #312e81); color: var(--primary-light, #a5b4fc); font-weight: 700; }
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-avatar-md { width: 42px; height: 42px; font-size: 1rem; }
.feed-avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.feed-clickable { cursor: pointer; }

/* Composer */
.feed-composer { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.feed-composer-top { display: flex; gap: 12px; align-items: flex-start; }
.feed-composer-input { flex: 1; resize: none; border: none; background: var(--bg-input, var(--bg-void)); color: var(--text-primary); border-radius: 12px; padding: 11px 14px; font-size: .95rem; outline: none; }
.feed-composer-input:focus { box-shadow: 0 0 0 2px var(--primary-dim); }
.feed-composer-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.feed-prev-item { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; }
.feed-prev-item img { width: 100%; height: 100%; object-fit: cover; }
.feed-prev-rm { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.feed-composer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; flex-wrap: wrap; }
.feed-composer-left { display: flex; align-items: center; gap: 8px; }
.feed-composer-icon { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; color: var(--text-secondary); cursor: pointer; font-size: .82rem; }
.feed-composer-icon:hover { color: var(--primary); border-color: var(--primary); }
.feed-vis-select, .feed-comment-field { font-family: inherit; }
.feed-vis-select { background: var(--bg-input, var(--bg-void)); color: var(--text-primary); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: .8rem; cursor: pointer; }
.feed-composer-guest { display: flex; align-items: center; gap: 12px; background: var(--bg-card); border: 1px dashed var(--border); border-radius: 14px; padding: 18px; margin-bottom: 16px; color: var(--text-secondary); }
.feed-composer-guest i { color: var(--primary); font-size: 1.2rem; }

/* Barra de herramientas del composer (estilo Facebook: Foto/Video, Encuesta, ...) */
.feed-composer-divider { height: 1px; background: var(--border); margin: 12px 0 8px; }
.feed-composer-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.feed-tool {
    flex: 1;
    min-width: 110px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: none; border: none; border-radius: 8px;
    padding: 9px 10px; cursor: pointer;
    color: var(--text-secondary); font-size: .82rem; font-weight: 600;
    transition: background .15s;
}
.feed-tool:hover { background: var(--bg-hover, rgba(99,102,241,.08)); }
.feed-composer-submit { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 10px; }

.feed-btn-primary { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .2s; }
.feed-btn-primary:hover { background: var(--primary-dark, #4f46e5); }
.feed-btn-primary:disabled { opacity: .6; cursor: default; }
.feed-btn-sm { padding: 8px 14px; font-size: .85rem; }
.feed-btn-ghost { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 8px; padding: 9px 18px; cursor: pointer; }
.feed-btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.feed-loadmore { text-align: center; margin: 18px 0; }

/* Post */
.feed-post { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; animation: feedIn .3s ease; }
@keyframes feedIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.feed-post-head { display: flex; align-items: center; gap: 11px; }
.feed-post-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.feed-post-meta strong { color: var(--text-primary); font-size: .92rem; cursor: pointer; }
.feed-post-meta strong:hover { text-decoration: underline; }
.feed-shared-label { font-size: .8rem; color: var(--text-secondary); }
.feed-post-time { font-size: .74rem; color: var(--text-muted); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.feed-post-del { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.feed-post-del:hover { color: var(--red, #dc2626); background: var(--bg-input); }
/* Grupo de herramientas (editar / eliminar) en la cabecera del post */
.feed-post-tools { margin-left: auto; display: flex; gap: 2px; }
.feed-post-tools .feed-post-del { margin-left: 0; }
.feed-post-tool { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.feed-post-tool:hover { color: var(--primary); background: var(--bg-input); }
.feed-post-tool.feed-post-del:hover { color: var(--red, #dc2626); }

/* ── Editor de encuesta (composer) ── */
.feed-poll-editor { background: var(--bg-input, var(--bg-void)); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }
.feed-poll-edit-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; font-size: .85rem; color: var(--text-primary); }
.feed-poll-edit-head i { color: #f59e0b; }
.feed-poll-x { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: .9rem; }
.feed-poll-x:hover { color: var(--red, #dc2626); }
.feed-poll-opt-row { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.feed-poll-opt { flex: 1; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 8px; padding: 8px 11px; font-size: .85rem; outline: none; }
.feed-poll-opt:focus { border-color: var(--primary); }
.feed-poll-opt-rm { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px 6px; }
.feed-poll-opt-rm:hover { color: var(--red, #dc2626); }
.feed-poll-add { background: none; border: 1px dashed var(--border); color: var(--primary); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: .8rem; font-weight: 600; }
.feed-poll-add:hover { border-color: var(--primary); }

/* ── Encuesta dentro del post ── */
.feed-poll { display: flex; flex-direction: column; gap: 8px; margin: 11px 0; }
.feed-poll-row { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; overflow: hidden;
    border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary);
    border-radius: 10px; padding: 11px 14px; cursor: pointer; font-size: .88rem; text-align: left; transition: border-color .15s; }
.feed-poll-row:not(:disabled):hover { border-color: var(--primary); }
.feed-poll-row.voted { cursor: default; }
.feed-poll-row.mine { border-color: var(--primary); }
.feed-poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary-dim, rgba(99,102,241,.18)); transition: width .4s ease; z-index: 0; }
.feed-poll-row.mine .feed-poll-bar { background: rgba(99,102,241,.30); }
.feed-poll-label { position: relative; z-index: 1; flex: 1; font-weight: 600; }
.feed-poll-label i { color: var(--primary); }
.feed-poll-pct { position: relative; z-index: 1; font-weight: 700; color: var(--text-secondary); font-size: .82rem; }
.feed-poll-total { font-size: .76rem; color: var(--text-muted); margin-top: 2px; }

/* ── Editor de edición de post ── */
.feed-edit-box { margin: 11px 0; }
.feed-edit-text { width: 100%; resize: vertical; min-height: 70px; border: 1px solid var(--border); background: var(--bg-input, var(--bg-void));
    color: var(--text-primary); border-radius: 10px; padding: 11px 14px; font-size: .92rem; font-family: inherit; outline: none; }
.feed-edit-text:focus { border-color: var(--primary); }
.feed-edit-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; flex-wrap: wrap; }
.feed-edit-btns { display: flex; gap: 8px; }
.feed-post-text { margin: 11px 0; color: var(--text-primary); line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.feed-post-text a { color: var(--primary); }

.feed-post-images { display: grid; gap: 4px; margin: 10px 0; border-radius: 12px; overflow: hidden; }
.feed-post-images.n1 { grid-template-columns: 1fr; }
.feed-post-images.n2 { grid-template-columns: 1fr 1fr; }
.feed-post-images.n3, .feed-post-images.n4 { grid-template-columns: 1fr 1fr; }
.feed-post-img img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; display: block; }
.feed-post-images.n1 .feed-post-img img { max-height: 520px; }

/* Post compartido (anidado) */
.feed-shared { margin: 10px 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-input, rgba(255,255,255,.02)); }
.feed-post-inner { border: none; border-radius: 0; padding: 12px; background: transparent; }
.feed-shared-gone { padding: 16px; color: var(--text-muted); font-size: .85rem; text-align: center; }

.feed-post-stats { display: flex; align-items: center; gap: 14px; padding: 10px 2px; font-size: .78rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.feed-react-badge { display: inline-flex; align-items: center; gap: 4px; }
.feed-stat-comments { margin-left: auto; cursor: pointer; }
.feed-stat-comments:hover { text-decoration: underline; }

.feed-post-actions { display: flex; gap: 4px; padding-top: 6px; }
.feed-act-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px; background: none; border: none; border-radius: 8px; color: var(--text-secondary); font-weight: 600; font-size: .85rem; cursor: pointer; transition: background .15s; }
.feed-act-btn:hover { background: var(--bg-input, rgba(255,255,255,.04)); }
.feed-act-btn.reacted { color: var(--primary); }
.feed-act-btn.reacted.r-love { color: #e0245e; }
.feed-act-btn.reacted.r-haha, .feed-act-btn.reacted.r-wow, .feed-act-btn.reacted.r-sad { color: #f59e0b; }
.feed-act-btn.reacted.r-angry { color: #f97316; }
.feed-act-emoji { font-size: 1.05rem; }

/* Selector de reacciones (popover en hover) */
.feed-react-wrap { position: relative; flex: 1; display: flex; }
.feed-react-wrap .feed-act-btn { flex: 1; }
.feed-react-picker { position: absolute; bottom: calc(100% + 6px); left: 0; display: flex; gap: 4px; padding: 6px 8px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 30px; box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; visibility: hidden; transform: translateY(6px) scale(.95); transition: all .18s; z-index: 5; }
.feed-react-wrap:hover .feed-react-picker,
.feed-react-wrap.show .feed-react-picker { opacity: 1; visibility: visible; transform: none; }
.feed-react-opt { background: none; border: none; font-size: 1.5rem; cursor: pointer; padding: 2px; line-height: 1; transition: transform .12s; }
.feed-react-opt:hover { transform: scale(1.35) translateY(-3px); }
.feed-react-wrap-sm { flex: 0 0 auto; display: inline-flex; }
.feed-react-wrap-sm .feed-react-picker { font-size: .9rem; }

/* En táctil: el picker se abre por tap (clase .show) y los 10 emotes envuelven
   en varias filas sin salirse de la pantalla. */
@media (hover: none) {
  .feed-react-picker { flex-wrap: wrap; max-width: calc(100vw - 32px); justify-content: center; }
  .feed-react-opt { font-size: 1.6rem; padding: 4px; }
}

/* Comentarios */
.feed-comments { margin-top: 10px; }
.feed-comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.feed-comment { display: flex; gap: 9px; }
.feed-comment-main { flex: 1; min-width: 0; }
.feed-comment-bubble { background: var(--bg-input, rgba(255,255,255,.05)); border-radius: 14px; padding: 8px 13px; display: inline-block; max-width: 100%; }
.feed-comment-bubble strong { display: block; font-size: .82rem; color: var(--text-primary); cursor: pointer; }
.feed-comment-text { font-size: .9rem; color: var(--text-primary); word-break: break-word; }
.feed-comment-tools { display: flex; align-items: center; gap: 12px; margin: 3px 0 0 6px; font-size: .74rem; }
.feed-comment-tool { background: none; border: none; color: var(--text-secondary); font-weight: 600; font-size: .74rem; cursor: pointer; padding: 0; }
.feed-comment-tool:hover { text-decoration: underline; }
.feed-comment-del:hover { color: var(--red, #dc2626); }
.feed-creact-btn { background: none; border: none; color: var(--text-secondary); font-weight: 600; font-size: .74rem; cursor: pointer; padding: 0; }
.feed-creact-btn.reacted { color: var(--primary); }
.feed-comment-ago { color: var(--text-muted); }
.feed-creact-badge { color: var(--text-muted); }
.feed-comment-ago, .feed-creact-badge { font-weight: 400; }
.feed-load-replies { background: none; border: none; color: var(--primary); font-weight: 600; font-size: .78rem; cursor: pointer; margin: 6px 0 0 6px; padding: 0; display: inline-flex; align-items: center; gap: 6px; }
.feed-load-replies:hover { text-decoration: underline; }
.feed-replies { margin: 8px 0 0 14px; padding-left: 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.feed-more-comments { background: none; border: none; color: var(--text-secondary); font-weight: 600; font-size: .82rem; cursor: pointer; padding: 4px 0; }
.feed-more-comments:hover { text-decoration: underline; }

.feed-comment-input { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.feed-comment-field { flex: 1; background: var(--bg-input, var(--bg-void)); border: 1px solid var(--border); border-radius: 20px; padding: 8px 14px; color: var(--text-primary); outline: none; font-size: .88rem; }
.feed-comment-field:focus { border-color: var(--primary); }
.feed-comment-send { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 1rem; padding: 6px 8px; }
.feed-comment-guest { font-size: .82rem; color: var(--text-muted); padding: 8px 4px; }

.feed-empty { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.feed-empty i { font-size: 2.4rem; color: var(--primary); margin-bottom: 12px; }
.feed-empty h3 { color: var(--text-primary); margin: 0 0 6px; }

/* Sidebar */
.feed-sidebar { display: flex; flex-direction: column; gap: 16px; }
.feed-side-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.feed-side-card h4 { margin: 0 0 12px; font-size: .9rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.feed-side-card h4 i { color: var(--primary); }
.feed-side-hero { background: linear-gradient(135deg, #4338ca, #2563eb); color: #fff; border: none; }
.feed-side-hero h3 { margin: 0 0 6px; font-size: 1.05rem; }
.feed-side-hero p { margin: 0 0 12px; font-size: .82rem; opacity: .9; }
.feed-side-online { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600; }
.feed-dot-live { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: feedPulse 1.8s infinite; }
@keyframes feedPulse { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.feed-side-room { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-secondary); }
.feed-side-room:first-of-type { border-top: none; }
.feed-side-room i { color: var(--text-muted); }
.feed-side-room span { flex: 1; color: var(--text-primary); }
.feed-side-room b { color: var(--primary); }

/* Skeleton */
.feed-skel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.feed-skel-head { display: flex; gap: 11px; align-items: center; }
.feed-skel-av { width: 42px; height: 42px; border-radius: 50%; background: var(--bg-input, #1f2733); }
.feed-skel-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.feed-skel-lines span { height: 10px; border-radius: 5px; background: var(--bg-input, #1f2733); }
.feed-skel-lines span:first-child { width: 35%; }
.feed-skel-lines span:last-child { width: 22%; }
.feed-skel-body { height: 90px; border-radius: 10px; background: var(--bg-input, #1f2733); margin-top: 14px; }
.feed-skel, .feed-skel-av, .feed-skel-lines span, .feed-skel-body { animation: feedShimmer 1.4s infinite; }
@keyframes feedShimmer { 50% { opacity: .55; } }

/* Responsive */
@media (max-width: 900px) {
  .feed-layout { grid-template-columns: 1fr; padding: 14px; }
  .feed-sidebar { display: none; }
}
@media (max-width: 520px) {
  .feed-topbar { padding: 10px 14px; }
  .feed-brand span, .feed-brand strong { font-size: 1rem; }
  .feed-act-btn { font-size: .78rem; padding: 8px 4px; }
}

/* Ubicacion en publicaciones + filtro por ciudad (Fase 3) */
.feed-post-loc{white-space:nowrap;}
.feed-post-loc i{font-size:.72em;opacity:.8;margin-right:2px;}
.feed-cityfilter{display:flex;gap:.45rem;flex-wrap:wrap;margin:0 0 .8rem;}
.feed-cf-chip{display:inline-flex;align-items:center;gap:.35rem;border:1px solid var(--border,rgba(120,120,160,.28));background:var(--bg-secondary,#fff);color:var(--text);border-radius:999px;padding:.35rem .8rem;font-size:.82rem;cursor:pointer;transition:background .15s,color .15s;}
.feed-cf-chip:hover{background:var(--bg-hover,rgba(127,127,160,.12));}
.feed-cf-chip.active{background:var(--primary,#6366f1);color:#fff;border-color:var(--primary,#6366f1);}
