/* ─────────────────────────────────────────────
   Cognify Network — hoja de estilos
   Paleta: azul marino + rojo quemado + negro, mucho blanco — elegante y minimalista
   Tipografía: Fraunces (display) + IBM Plex Sans (UI) + IBM Plex Mono (datos)
───────────────────────────────────────────── */

:root {
  --ink-900: #0f1b33;
  --ink-800: #14213d;
  --ink-700: #1f2f52;
  --ink-600: #33456e;
  --black: #0a0a0b;
  --paper-100: #f5f4f2;
  --paper-050: #ffffff;
  --line: #e4e2df;
  --accent-500: #9c3a2c;
  --accent-600: #7c2c21;
  --accent-100: #f4e5e1;
  --green-600: #3a7d55;
  --red-600: #c0392b;
  --text-primary: var(--ink-900);
  --text-secondary: #5b5b60;
  --text-on-dark: #f5f4f2;
  --surface: var(--paper-050);
  --surface-raised: #ffffff;
  --border: var(--line);
  --accent: var(--accent-500);
  --accent-strong: var(--accent-600);
  --toast-bg: var(--ink-900);
  --toast-text: var(--paper-050);
  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-ui: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(15, 27, 51, 0.06), 0 8px 24px -12px rgba(15, 27, 51, 0.18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text-primary: #f1efec;
    --text-secondary: #a8a7ad;
    --surface: #0a0f1c;
    --surface-raised: #131f38;
    --border: #283251;
    --text-on-dark: #f1efec;
    --toast-bg: #223049;
    --toast-text: #f1efec;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --text-primary: #f1efec;
  --text-secondary: #a8a7ad;
  --surface: #0a0f1c;
  --surface-raised: #131f38;
  --border: #283251;
  --text-on-dark: #f1efec;
  --toast-bg: #223049;
  --toast-text: #f1efec;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 0.4em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.8em; }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.label-caps {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* ── Layout ── */
#app { min-height: 100%; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--ink-800);
  color: var(--text-on-dark);
  border-bottom: 1px solid var(--ink-700);
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none;
  color: var(--text-on-dark);
}
.topbar .brand .brand-logo { width: 34px; height: 34px; object-fit: contain; }
.topbar nav { display: flex; gap: 0.25rem; align-items: center; }
.topbar nav a, .topbar nav button {
  color: var(--text-on-dark);
  background: transparent;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  opacity: 0.82;
}
.topbar nav a.active, .topbar nav a:hover, .topbar nav button:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.topbar .badge {
  background: var(--accent);
  color: var(--text-on-dark);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  margin-left: 0.3rem;
}

main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }
.view { animation: fade-in 0.18s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 0.55rem;
  flex-wrap: wrap;
  padding: 1.4rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.82rem;
}
.site-footer .footer-logo { width: 20px; height: 20px; object-fit: contain; opacity: 0.85; }
.site-footer .footer-sep { opacity: 0.5; }
.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 480px) { .site-footer .footer-desc { display: none; } .site-footer .footer-desc + .footer-sep { display: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* ── Cards / surfaces ── */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.4rem;
}
.card + .card { margin-top: 1rem; }

/* ── Forms ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.field .hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
textarea, select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
}
textarea { resize: vertical; min-height: 5em; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}
.chip-input { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--accent-100); color: var(--ink-800);
  border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.8rem;
}
.chip button { background: none; border: none; cursor: pointer; color: var(--ink-700); font-weight: 700; padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--ink-800);
  color: var(--text-on-dark);
}
.btn:hover { background: var(--ink-700); }
.btn.primary { background: var(--accent); color: var(--text-on-dark); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn.ghost:hover { background: var(--accent-100); }
.btn.ghost-on-dark { background: transparent; color: var(--text-on-dark); border-color: rgba(245,244,242,0.4); }
.btn.ghost-on-dark:hover { background: rgba(245,244,242,0.12); border-color: rgba(245,244,242,0.65); }
.btn.danger { background: transparent; color: var(--red-600); border-color: var(--red-600); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.small { padding: 0.4rem 0.85rem; font-size: 0.82rem; }

/* ── Auth screens ── */
.auth-shell {
  max-width: 960px; margin: 1.5rem auto 3rem;
  display: grid; grid-template-columns: 1fr 1fr;
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: var(--surface-raised);
}
.auth-hero {
  position: relative;
  background:
    radial-gradient(circle at 15% 12%, rgba(156,58,44,0.3), transparent 45%),
    linear-gradient(160deg, var(--black), var(--ink-900) 55%, var(--ink-700));
  color: var(--text-on-dark);
  padding: 3rem 2.5rem;
  display: flex; flex-direction: column; justify-content: center; gap: 1.6rem;
  overflow: hidden;
}
.auth-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url('/images/hero-entrepreneurs.jpg') center 30% / cover no-repeat;
  opacity: 0.16;
  filter: grayscale(1) contrast(1.1) brightness(1.15);
  mix-blend-mode: luminosity;
  pointer-events: none;
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .hero-badge {
  display: inline-flex; align-items: center; gap: 0.7rem;
  background: var(--paper-050);
  border-radius: 999px;
  padding: 0.5rem 1.1rem 0.5rem 0.5rem;
  width: fit-content;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.auth-hero .hero-badge img { width: 34px; height: 34px; object-fit: contain; display: block; }
.auth-hero .hero-badge span { font-family: var(--font-display); font-weight: 600; color: var(--ink-900); font-size: 1.05rem; }
.auth-hero h1 { font-size: 1.9rem; line-height: 1.15; color: var(--text-on-dark); }
.auth-hero p.lead { color: rgba(241,237,225,0.82); font-size: 0.98rem; max-width: 34ch; }
.auth-hero .hero-cta { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 0.2rem; }
.auth-hero .hero-features { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.6rem; }
.auth-hero .hero-features li {
  list-style: none;
  display: flex; align-items: baseline; gap: 0.6rem;
  font-size: 0.88rem; color: rgba(241,237,225,0.92);
}
.auth-hero .hero-features .num {
  font-family: var(--font-mono);
  color: var(--accent-500);
  font-weight: 600;
  flex-shrink: 0;
}
.auth-form-side {
  position: relative;
  display: flex; align-items: center; justify-content: center; padding: 2.5rem 2rem;
  background: var(--surface-raised);
  overflow: hidden;
}
.auth-form-side::before {
  content: '';
  position: absolute; inset: 0;
  background: url('/images/hero-entrepreneurs.jpg') center 30% / cover no-repeat;
  opacity: 0.07;
  filter: grayscale(1) contrast(1.05);
  pointer-events: none;
}
:root:not([data-theme="light"]) .auth-form-side::before { opacity: 0.1; }
.auth-form-side .card { position: relative; z-index: 1; border: none; box-shadow: none; padding: 0; width: 100%; max-width: 360px; }
.auth-switch { text-align: center; margin-top: 1rem; font-size: 0.9rem; color: var(--text-secondary); }
.auth-switch button { background: none; border: none; color: var(--text-primary); text-decoration: underline; cursor: pointer; font-weight: 600; }
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; margin: 0 0 1.5rem; border-radius: 0; }
  .auth-hero { padding: 2.4rem 1.5rem; }
  .auth-hero .hero-features { display: none; }
}

/* ── Directory grid ── */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.2rem; }
.filters select, .filters input { max-width: 220px; }
.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.profile-card { display: flex; flex-direction: column; gap: 0.6rem; }
.avatar, .avatar-lg, .avatar-sm {
  border-radius: 50%; flex-shrink: 0; overflow: hidden;
  object-fit: cover; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600;
}
.avatar-fallback { background: var(--ink-800); color: var(--text-on-dark); }
.avatar { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; border: 3px solid var(--surface-raised); }
.avatar-sm { width: 40px; height: 40px; font-size: 1rem; }
.profile-card .name { font-weight: 700; }
.profile-card .headline { color: var(--text-secondary); font-size: 0.85rem; min-height: 2.4em; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag { font-size: 0.72rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-secondary); }
.tag.stage-idea { border-color: var(--accent-500); color: var(--accent-600); }
.tag.stage-mvp { border-color: var(--ink-600); }
.tag.stage-ingresos { border-color: var(--green-600); color: var(--green-600); }
.tag.stage-escalando { border-color: var(--red-600); color: var(--red-600); }

/* ── Profile view ── */
.profile-card-shell { padding: 0; overflow: hidden; }
.cover-banner {
  width: 100%; height: 170px;
  background: linear-gradient(135deg, var(--ink-800), var(--ink-600));
  background-size: cover; background-position: center;
}
.profile-card-body { padding: 1.4rem; }
.profile-header { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.profile-card-shell .profile-header { margin-top: -52px; }
.profile-header .meta { flex: 1; min-width: 200px; padding-top: 0.6rem; }
.section-title { margin-top: 1.6rem; margin-bottom: 0.6rem; }

/* ── Connections list ── */
.conn-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.conn-row:last-child { border-bottom: none; }
.conn-row .info { flex: 1; min-width: 0; }
.conn-row .name { font-weight: 600; }
.conn-row .headline { font-size: 0.82rem; color: var(--text-secondary); }
.conn-actions { display: flex; gap: 0.4rem; }

/* ── Coach panel ── */
.coach-card { background: linear-gradient(135deg, var(--ink-800), var(--ink-700)); color: var(--text-on-dark); }
.coach-card .label-caps { color: var(--accent-100); }
.coach-card textarea { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); color: var(--text-on-dark); }
.coach-card textarea::placeholder { color: rgba(241,237,225,0.55); }

/* ── Indicador de avance con el coach (verde → rojo) ── */
.coach-status { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.coach-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.coach-status-dot.green { background: var(--green-600); box-shadow: 0 0 0 3px rgba(58,125,85,0.18); }
.coach-status-dot.yellow { background: #c9891a; box-shadow: 0 0 0 3px rgba(201,137,26,0.18); }
.coach-status-dot.red { background: var(--red-600); box-shadow: 0 0 0 3px rgba(192,57,43,0.18); }

/* ── Utility ── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-secondary); }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-text);
  padding: 0.7rem 1.1rem; border-radius: 999px; font-size: 0.88rem;
  box-shadow: var(--shadow-card); z-index: 50;
  max-width: 90vw;
  border: 1px solid var(--border);
}
.toast.error { background: var(--red-600); }
.spinner {
  width: 1.1em; height: 1.1em; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: currentColor;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.spinner-mark { width: 40px; height: 40px; object-fit: contain; animation: pulse-mark 1.4s ease-in-out infinite; display: inline-block; }
@keyframes pulse-mark { 0%, 100% { opacity: 0.35; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .spinner-mark { animation: none; opacity: 0.8; } }

/* ── Edición de foto de perfil / portada ── */
.photo-edit-cover {
  position: relative; width: 100%; height: 170px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--ink-800), var(--ink-600));
  background-size: cover; background-position: center;
  display: flex; align-items: flex-end; justify-content: flex-end;
  margin-bottom: -40px;
}
.photo-edit-avatar-wrap { position: relative; width: 84px; height: 84px; margin-left: 1.4rem; }
.photo-edit-avatar-wrap .avatar-lg { width: 84px; height: 84px; }
.photo-edit-btn {
  position: absolute; bottom: 0.5rem; right: 0.5rem;
  background: rgba(15,27,51,0.72); color: var(--text-on-dark);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.75rem;
  cursor: pointer;
}
.photo-edit-btn:hover { background: rgba(15,27,51,0.9); }
.photo-edit-avatar-wrap .photo-edit-btn { inset: auto -6px -6px auto; right: -6px; bottom: -6px; padding: 0.3rem 0.5rem; }
.photo-edit-row { display: flex; align-items: flex-end; gap: 1rem; padding: 0 1.4rem; margin-bottom: 1.4rem; }
.photo-edit-hint { color: var(--text-secondary); font-size: 0.78rem; padding: 0 1.4rem 0.6rem; margin-top: -1rem; }

/* ── Recuperar contraseña (variante de una sola columna) ── */
.auth-shell-solo { grid-template-columns: 1fr; max-width: 420px; }
.auth-shell-solo .auth-form-side { padding: 2.2rem 2rem; }
.auth-forgot { text-align: right; margin: -0.5rem 0 0; }
.auth-forgot a { font-size: 0.85rem; color: var(--text-secondary); text-decoration: underline; }

/* ── Publicaciones (feed y perfil) ── */
.post-compose textarea { min-height: 4em; }
.post-compose-row { display: flex; align-items: center; gap: 0.8rem; }
.post-compose-row .hint { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#post-image-label { cursor: pointer; }

.post-card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); padding: 1.1rem; margin-bottom: 1rem; }
.post-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.7rem; }
.post-head .info { flex: 1; min-width: 0; }
.post-head .name { font-weight: 700; text-decoration: none; }
.post-head .post-date { font-size: 0.78rem; color: var(--text-secondary); }
.post-delete, .comment-delete {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font-size: 0.9rem; padding: 0.2rem 0.4rem; border-radius: 6px; flex-shrink: 0;
}
.post-delete:hover, .comment-delete:hover { color: var(--red-600); background: var(--accent-100); }
.post-body { white-space: pre-wrap; }
.post-image { display: block; width: 100%; max-height: 480px; object-fit: contain; border-radius: 10px; margin-bottom: 0.8rem; background: var(--surface); }
.post-actions { display: flex; gap: 1rem; border-top: 1px solid var(--border); padding-top: 0.6rem; }
.post-like-btn, .post-comment-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  font-size: 0.88rem; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.4rem;
}
.post-like-btn:hover, .post-comment-toggle:hover { color: var(--text-primary); }
.post-like-btn.liked { color: var(--accent-600); font-weight: 600; }
.post-comments { margin-top: 0.8rem; border-top: 1px solid var(--border); padding-top: 0.8rem; }
.comment-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.7rem; }
.comment-row { display: flex; align-items: flex-start; gap: 0.6rem; }
.comment-row .info { flex: 1; min-width: 0; }
.comment-row .name { font-weight: 600; font-size: 0.85rem; }
.comment-body { margin: 0.1rem 0 0; font-size: 0.9rem; }
.comment-form { display: flex; gap: 0.5rem; }
.comment-form input { flex: 1; }
.empty-state.small { padding: 0.5rem; font-size: 0.85rem; }

/* ── Panel de administrador ── */
.admin-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.admin-tab {
  background: none; border: none; cursor: pointer; padding: 0.6rem 1rem;
  font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid transparent;
}
.admin-tab.active { color: var(--accent-600); border-bottom-color: var(--accent-500); }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td:nth-child(1), .admin-table td:nth-child(5) { white-space: normal; }
.admin-row-actions { display: flex; gap: 0.4rem; }
.tag.small { font-size: 0.65rem; padding: 0.05rem 0.4rem; }
.admin-posts-list { display: flex; flex-direction: column; gap: 0.8rem; }
.admin-post-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.admin-post-row .info { flex: 1; min-width: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.9rem; }
.stat-card { text-align: center; }
.stat-num { font-family: var(--font-display); font-size: 2.1rem; font-weight: 600; color: var(--accent-600); }
.stat-label { color: var(--text-secondary); font-size: 0.82rem; margin-top: 0.2rem; }

@media (max-width: 640px) {
  .topbar { padding: 0.75rem 1rem; }
  .topbar nav a span.full { display: none; }
  main { padding: 1.2rem 1rem 4rem; }
}
