/* ===========================================================
   GSM Prime — estilos compartidos (shell + componentes)
   Cada página añade su CSS específico inline.
   =========================================================== */
:root{
  --bg: #ffffff;
  --panel: #fafafa;
  --border: #e5e7eb;
  --border-soft: #eef0f2;
  --text: #0f1419;
  --text-dim: #536471;
  --text-faint: #8b98a5;
  --accent: #000000;
  --link: #1d9bf0;
  --solved: #00a86b;
  --amber: #b8860b;
  --danger: #e0245e;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
html, body { margin:0; padding:0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
}
a{ color: inherit; text-decoration: none; }
::selection{ background: #fff4c2; }

/* ---------- SHELL ---------- */
.app{
  display: grid;
  grid-template-columns: 250px 1fr 320px;
  height: 100vh;
  max-width: 1240px;
  margin: 0 auto;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  position: relative;
}
.app.no-side{ grid-template-columns: 250px 1fr; }

/* ---------- SIDEBAR ---------- */
.rail{
  display:flex; flex-direction:column;
  padding: 20px 14px;
  border-right: 1px solid var(--border-soft);
  overflow-y: auto;
}
.rail::-webkit-scrollbar{ width: 0; }
.rail-logo{
  display:flex; align-items:center; gap:10px;
  margin-bottom: 20px;
  padding-left: 8px;
}
.rail-logo .mark{
  width: 32px; height:32px; border-radius: 8px;
  background: var(--text);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:700; font-size:14px;
  font-family: var(--mono);
  flex-shrink:0;
  object-fit: cover;
}
.rail-logo .name{ font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.rail-logo .sub{ font-size: 10.5px; color: var(--text-faint); margin-top: 1px; font-family: var(--mono); letter-spacing: 0.02em; }

.rail-item{
  display:flex; align-items:center; gap:16px;
  padding: 11px 12px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  cursor:pointer;
  transition: background .15s;
  position: relative;
}
.rail-item svg{ width:22px; height:22px; stroke: currentColor; fill:none; stroke-width:1.8; flex-shrink:0; }
.rail-item:hover{ background: var(--border-soft); }
.rail-item.active{ font-weight: 700; }
.rail-item.active svg{ stroke-width: 2.2; }
.rail-item .badge-count{
  margin-left: auto;
  background: var(--danger); color:#fff;
  font-size: 10.5px; font-weight: 700; font-family: var(--mono);
  min-width: 18px; height: 18px; border-radius: 999px;
  display:flex; align-items:center; justify-content:center; padding: 0 5px;
}

.publish-btn{
  margin-top: 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 0;
  font-size: 15.5px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  width: 100%;
}
.publish-btn:hover{ opacity: 0.85; }
.publish-btn:active{ transform: scale(0.98); }

.rail-spacer{ flex:1; }
.rail-profile{
  display:flex; align-items:center; gap:10px;
  padding: 10px;
  border-radius: 999px;
  cursor:pointer;
  transition: background .15s;
}
.rail-profile:hover{ background: var(--border-soft); }
.rail-profile .rp-info{ flex: 1; min-width: 0; }
.rail-profile .rp-logout-txt{
  font-size: 11.5px; font-weight: 700; color: var(--text-faint);
  margin-top: 3px; transition: color .15s;
}
.rail-profile:hover .rp-logout-txt{ color: var(--danger); }
.rail-profile .rp-logout{
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: var(--text-faint); fill: none; stroke-width: 1.8;
  transition: stroke .15s;
}
.rail-profile:hover .rp-logout{ stroke: var(--danger); }
.rail-avatar{
  width: 34px; height:34px; border-radius:50%;
  background: var(--text);
  color: #fff;
  display:flex; align-items:center; justify-content:center;
  font-size: 12px; font-weight: 700;
  flex-shrink:0;
  overflow: hidden;
}
.rail-avatar img{ width:100%; height:100%; object-fit:cover; }
.rail-profile .pname{ font-size: 13.5px; font-weight: 700; }
.rail-profile .phandle{ font-size: 11.5px; color: var(--text-faint); font-family: var(--mono); }

/* ---------- MAIN COLUMN ---------- */
.main{
  display:flex; flex-direction:column;
  overflow: hidden;
  border-right: 1px solid var(--border-soft);
}
.app.no-side .main{ border-right: none; }
.topbar{
  padding: 16px 22px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 2;
}
.topbar-title{
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0;
  display:flex; align-items:center; gap:12px;
}
.topbar-title .back{
  width: 30px; height: 30px; border-radius: 50%;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer; flex-shrink:0;
  transition: background .15s;
}
.topbar-title .back:hover{ background: var(--border-soft); }
.topbar-title .back svg{ width: 18px; height: 18px; stroke: var(--text); fill:none; stroke-width: 2.2; }
.topbar-sub{ font-size: 12.5px; color: var(--text-faint); font-family: var(--mono); margin-top: 3px; }

.scroll-area{
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.scroll-area::-webkit-scrollbar{ width:0; }

/* ---------- RIGHT PANEL ---------- */
.side{
  padding: 20px 18px;
  overflow-y: auto;
}
.side::-webkit-scrollbar{ width:0; }

.profile-card{
  background: var(--text);
  color: #fff;
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
}
.profile-card .top{ display:flex; align-items:center; gap:12px; margin-bottom: 18px; }
.profile-card .avatar-lg{
  width: 48px; height:48px; border-radius:50%;
  background: rgba(255,255,255,0.14);
  border: 1.5px solid rgba(255,255,255,0.25);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:16px; color:#fff;
  flex-shrink:0; overflow: hidden;
}
.profile-card .avatar-lg img{ width:100%; height:100%; object-fit:cover; }
.profile-card .uname{ font-size: 15px; font-weight: 700; }
.profile-card .uhandle{ font-size: 12px; color: rgba(255,255,255,0.55); font-family: var(--mono); margin-top:1px; }

.level-badge{
  display:inline-flex; align-items:center; gap:6px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  margin-bottom: 18px;
}
.level-badge .glow{
  width: 7px; height: 7px; border-radius:50%;
  background: linear-gradient(135deg,#e5e4e2,#b8b8b8);
  box-shadow: 0 0 6px rgba(229,228,226,0.9);
}

.stat-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255,255,255,0.14);
  border-radius: 12px;
  overflow: hidden;
}
.stat-cell{
  background: rgba(255,255,255,0.05);
  padding: 12px 14px;
}
.stat-cell .label{
  font-size: 10px; color: rgba(255,255,255,0.5);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-family: var(--mono);
  margin-bottom: 4px;
}
.stat-cell .value{
  font-size: 17px; font-weight: 700;
  font-family: var(--mono);
}
.stat-cell .value.small{ font-size: 13px; }

.side-section{ padding: 4px 4px 18px; }
.side-section .side-title{ font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.info-row{
  display:flex; justify-content:space-between; align-items:center;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.info-row:last-child{ border-bottom:none; }
.info-row .k{ color: var(--text-faint); }
.info-row .v{ font-weight: 600; color: var(--text); font-family: var(--mono); font-size: 12.5px; }

.ad-box{
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  color: var(--text-faint);
}
.ad-box .ad-label{
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  font-family: var(--mono); margin-bottom: 10px;
}
.ad-box .ad-block{
  background: var(--panel);
  border-radius: 10px;
  height: 100px;
  display:flex; align-items:center; justify-content:center;
  font-size: 12px; color: var(--text-faint);
  margin-bottom: 8px;
}
.ad-box .ad-cta{ font-size: 12px; color: var(--text-dim); }

/* ---------- COMPONENTES COMUNES ---------- */
.avatar{
  width: 38px; height:38px; border-radius:50%;
  background: var(--text);
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px; color:#fff;
  flex-shrink:0; overflow: hidden;
}
.avatar img{ width:100%; height:100%; object-fit:cover; }
/* Cualquier foto dentro de un contenedor de avatar: recorte centrado y circular */
.avatar img, .avatar-lg img, .rail-avatar img, .pro-avatar img,
.avatar-preview img, .notif-avatar .avatar img{
  width: 100%; height: 100%; object-fit: cover; object-position: center; display: block;
}

.status{
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space:nowrap;
  font-family: var(--mono);
  border: 1px solid transparent;
}
.status.solved{ color: var(--solved); background: #e9f9f2; border-color: #cdefe0; }
.status.open{ color: var(--amber); background: #fdf5e2; border-color: #f4e5b8; }
.status.aporte{ color: var(--text-dim); background: var(--panel); border-color: var(--border); }
.status.comprobada{ color: var(--solved); background: #e9f9f2; border-color: #cdefe0; }
.status.debate{ color: var(--link); background: #e8f5fd; border-color: #cde9fb; }

.tag{ font-size: 12.5px; color: var(--link); font-family: var(--mono); }

/* Categoría al inicio del título — gris, para distinguirla de un vistazo */
.title-cat{ color: var(--text-faint); font-weight: 700; }

.post-media-note{
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-size: 12px; color: var(--text-faint); font-family: var(--mono);
}
.post-media-note svg{ width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.post-software{
  display: inline-flex; align-items: center; gap: 6px;
  margin: 3px 0 6px;
  padding: 3px 10px;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-size: 11.5px; font-weight: 700; font-family: var(--mono);
  color: var(--text-dim);
}
.post-software svg{ width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }

/* Recompensa de una Ayuda (monedas) */
.bounty{
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; font-family: var(--mono);
  background: #fdf5e2; border: 1px solid #f4e5b8; color: var(--amber);
}
.bounty.paid{ background: #e9f9f2; border-color: #cdefe0; color: var(--solved); }
.bounty .coin{ font-size: 12px; line-height: 1; }

/* Etiqueta de usuario suspendido */
.susp-tag{
  font-size: 9px; font-family: var(--mono); font-weight: 700;
  color: var(--danger); background: #fdecf1; border: 1px solid #f6c9d7;
  padding: 1px 5px; border-radius: 999px; margin-left: 6px; letter-spacing: .04em;
}

/* Botón "⋯" y menú contextual */
.dots-btn{
  background: none; border: none; cursor: pointer;
  color: var(--text-faint); font-size: 18px; line-height: 1;
  padding: 2px 8px; border-radius: 999px; flex-shrink: 0;
}
.dots-btn:hover{ background: var(--border-soft); color: var(--text); }
.ctx-menu{
  position: fixed; z-index: 130; min-width: 190px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.16); padding: 6px;
}
.ctx-menu[hidden]{ display: none; }
.ctx-menu button{
  display: flex; align-items: center; gap: 9px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 10px 11px; border-radius: 8px;
  font-family: var(--font); font-size: 13.5px; color: var(--text);
}
.ctx-menu button:hover{ background: var(--border-soft); }
.ctx-menu button.danger{ color: var(--danger); }

/* Switch genérico */
.gsm-switch{
  width: 40px; height: 23px; border-radius: 999px; background: var(--border);
  position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0;
}
.gsm-switch::after{
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 19px; height: 19px; border-radius: 50%; background: #fff;
  transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.gsm-switch.on{ background: var(--text); }
.gsm-switch.on::after{ transform: translateX(17px); }

/* Modal de reporte */
.gsm-report-overlay{
  position: fixed; inset: 0; z-index: 400;
  background: rgba(15,20,25,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade-in .15s ease both;
}
.gsm-report-overlay[hidden]{ display: none; }
.gsm-report-card{
  width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 20px;
}
.grc-head{ display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.grc-kicker{ font-size: 10.5px; font-weight: 700; font-family: var(--mono); color: var(--text-faint); letter-spacing: .06em; }
.grc-title{ font-size: 18px; font-weight: 800; margin-top: 3px; }
.grc-close{
  width: 28px; height: 28px; border-radius: 50%; background: var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; color: var(--text-dim); flex-shrink: 0;
}
.grc-quote{
  margin: 14px 0; padding: 11px 13px;
  background: var(--panel); border: 1px solid var(--border-soft); border-left: 3px solid var(--border);
  border-radius: 8px; font-size: 13px; color: var(--text-dim); line-height: 1.5;
  max-height: 110px; overflow-y: auto;
}
.grc-reasons{ display: flex; flex-direction: column; gap: 2px; }
.grc-reason{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 6px; font-size: 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}
.grc-reason:last-child{ border-bottom: none; }
.grc-reason input{ width: 16px; height: 16px; accent-color: var(--text); }
.grc-note{
  width: 100%; margin-top: 8px; resize: vertical; min-height: 70px;
  background: var(--panel); border: 1.5px solid var(--border-soft); border-radius: 10px;
  padding: 10px 12px; font-family: var(--font); font-size: 13.5px; color: var(--text); outline: none;
}
.grc-note[hidden]{ display: none; }
.grc-note:focus{ border-color: var(--text); background: #fff; }
.grc-switchrow{
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 16px 0 4px; font-size: 13.5px; font-weight: 600;
}
.grc-actions{ display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* Modal de recompensa */
.gsm-reward-card{ max-width: 380px; }
.grw-balance{
  margin: 12px 0 14px; font-size: 12.5px; font-family: var(--mono);
  color: var(--text-dim);
}
.grw-chips{ display: flex; gap: 8px; margin-bottom: 14px; }
.grw-chips button{
  flex: 1; padding: 9px 0; border-radius: 10px;
  border: 1.5px solid var(--border-soft); background: var(--panel);
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text-dim);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.grw-chips button:hover{ border-color: var(--text); color: var(--text); }
.grw-chips button.on{ border-color: var(--amber); background: #fdf5e2; color: var(--amber); }
.grw-stepper{ display: flex; align-items: stretch; gap: 8px; }
.grw-stepper button{
  width: 44px; border: 1.5px solid var(--border-soft); background: var(--panel);
  border-radius: 10px; font-size: 20px; font-weight: 700; color: var(--text-dim);
  cursor: pointer;
}
.grw-stepper button:hover{ border-color: var(--text); color: var(--text); }
.grw-stepper input{
  flex: 1; text-align: center; border: 1.5px solid var(--border-soft); border-radius: 10px;
  background: var(--panel); font-family: var(--mono); font-size: 18px; font-weight: 700;
  color: var(--text); outline: none; padding: 10px; appearance: textfield;
}
.grw-stepper input:focus{ border-color: var(--text); background: #fff; }
.grw-stepper input::-webkit-outer-spin-button,
.grw-stepper input::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }

.btn{
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.btn:active{ transform: scale(.98); }
.btn:hover{ opacity: .88; }
.btn.primary{ background: var(--text); color: #fff; }
.btn.primary:disabled{ background: var(--text-faint); cursor: not-allowed; }
.btn.ghost{ background: var(--border-soft); color: var(--text); }
.btn.block{ width: 100%; }

.toast{
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mono);
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
}
.toast.show{ opacity: 1; transform: translateX(-50%) translateY(0); }

.empty{
  text-align:center; padding: 80px 20px; color: var(--text-faint);
  font-size: 14px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px){
  .app, .app.no-side{ grid-template-columns: 72px 1fr; max-width: 100%; }
  .side{ display: none; }
  .rail-logo .name, .rail-logo .sub, .rail-item span,
  .rail-profile .rp-info, .rail-profile .rp-logout{ display: none; }
  .rail-item, .rail-profile{ justify-content: center; }
  .publish-btn{ font-size: 0; padding: 14px 0; }
  .publish-btn::after{ content: "+"; font-size: 20px; }
}
@media (max-width: 640px){
  body{ overflow: auto; }
  .app, .app.no-side{ grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .rail{
    flex-direction: row; align-items: center;
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 8px 10px; border-top: 1px solid var(--border);
    background: #fff; z-index: 60; justify-content: space-around;
  }
  .rail-logo, .rail-spacer, .rail-profile, .publish-btn{ display: none; }
  .main{ border: none; }
}
