/* base.css — estructura y layout */

:root{
  --bg: #0e0f12; --fg:#e7e7ea;
  --card:#161821; --muted:#a5a7b5;
  --ui-bd: rgba(255,255,255,.12);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;background:var(--bg);color:var(--fg);font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial}
.container{max-width:1200px;margin:0 auto;padding:18px}
h1{margin:4px 0 12px;font-size:20px}
.card{background:var(--card);border:1px solid var(--ui-bd);border-radius:16px;padding:14px;position:relative}
.grid{display:grid;gap:12px}
.g2{grid-template-columns:1fr 1fr}
.g3{grid-template-columns:repeat(3,1fr)}
.g4{grid-template-columns:repeat(4,1fr)}
@media(max-width:980px){.g3,.g4{grid-template-columns:1fr 1fr}}
@media(max-width:680px){.g2,.g3,.g4{grid-template-columns:1fr}}
label{display:block;font-size:12px;color:var(--muted);margin:4px 2px 6px}
input,select,textarea{
  width:100%;padding:10px 12px;border:1px solid var(--ui-bd);
  border-radius:12px;background:transparent;color:inherit;outline:none
}
.btn{
  display:inline-flex;align-items:center;gap:8px;padding:10px 14px;border-radius:12px;
  border:1px solid var(--ui-bd);background:transparent;color:inherit;cursor:pointer;font-weight:700
}
.badge{display:inline-block;font-size:12px;border:1px solid var(--ui-bd);padding:3px 10px;border-radius:999px;color:var(--muted)}
.muted{color:var(--muted);font-size:12px}
.hr{height:1px;background:var(--ui-bd);margin:12px 0}

/* Toolbar */
.toolbar{display:flex;gap:10px;align-items:center;justify-content:space-between;flex-wrap:wrap;position:relative;z-index:5}
.toolbar .left,.toolbar .right{display:flex;gap:10px;align-items:center;flex-wrap:wrap}

/* Portal (oculto por defecto, lo abre JS) */
#secretModal{position:fixed;inset:0;background:rgba(0,0,0,.6);display:none;align-items:center;justify-content:center;z-index:9999}
#secretModal .box{background:var(--card);border:1px solid var(--ui-bd);border-radius:16px;padding:16px;max-width:560px;width:92%}
#secretModal .row{display:flex;gap:8px;margin-top:10px}
#secretModal input{flex:1}

/* Slots generales */
#magicOvals{position:fixed;inset:auto -10vw -22vh -10vw; height:52vh; pointer-events:none; z-index:0}
#rivenRunes{position:fixed;inset:0;pointer-events:none;z-index:1;display:none}

/* Resumen rápido + Energías (estructura) */
.nu-quick{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:18px 0;position:relative;z-index:3}
.nu-quick .chip{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-radius:999px;border:1px solid var(--ui-bd);background:var(--card)}
.nu-quick .k{font-size:12px;color:var(--muted)}
.nu-quick .v{font-weight:800}

.nu-energy{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:10px 0 28px;position:relative;z-index:3}
.nu-energy .pill{border:1px dashed var(--ui-bd);border-radius:12px;padding:8px 12px;background:transparent}
.nu-energy .k{font-size:12px;color:var(--muted);display:block}
.nu-energy .v{font-weight:800}
@media (max-width:980px){.nu-quick,.nu-energy{grid-template-columns:1fr 1fr}}

/* Botones “+ Agregar …” visibles */
#nu-btn-parents, #nu-btn-add-child{ background:transparent; color:inherit; border:1px solid var(--ui-bd); }
/* --- Nota bajo el campo Apodo (sin depender de clases) --- */
/* Si tiene clase .hint la respeta; si no, toma al primer hermano del input */
#nu-apodo-wrap #nu_nick + *,
#nu-apodo-wrap .hint{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:8px;
  padding:6px 10px;
  font-size:12px;
  line-height:1.25;
  color:var(--muted);
  border:1px dashed var(--ui-bd, rgba(255,255,255,.18));
  border-radius:10px;
  background:rgba(255,255,255,.03);
}

/* Iconito “i” bonito */
#nu-apodo-wrap #nu_nick + *::before,
#nu-apodo-wrap .hint::before{
  content:"i";
  display:inline-grid;
  place-items:center;
  width:16px; height:16px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  color:var(--accent);
  border:1px solid var(--ui-bd, rgba(255,255,255,.2));
  background:rgba(255,255,255,.04);
}

/* Si por algún motivo viene vacío, se oculta */
#nu-apodo-wrap #nu_nick + *:empty,
#nu-apodo-wrap .hint:empty{ display:none; }

/* ================== CHAT GANDALF (base) ================== */
#nu-chat { position: fixed; inset: auto 18px 18px auto; z-index: 9998; }

#nu-chat-toggle.nu-chat-fab{
  position: relative;
  width: 54px; height: 54px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14);
  background: var(--card); color: var(--fg); font-size: 20px;
  display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
#nu-chat-toggle:hover{ filter: brightness(1.08); }
#nu-chat-toggle:active{ transform: translateY(1px); }

#nu-chat-toggle .nu-chat-unread{
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px;
  padding: 0 6px; display: grid; place-items: center;
  background: var(--accent, #ff6600); color: #111; border-radius: 999px;
  font: 700 12px/1 system-ui; border: 1px solid rgba(0,0,0,.15);
}
#nu-chat-toggle .nu-chat-unread[hidden]{ display:none; }

#nu-chat-panel[hidden]{ display: none !important; }
#nu-chat-panel{
  position: fixed; right: 18px; bottom: 86px; width: min(360px, calc(100vw - 36px));
  background: var(--card); color: var(--fg);
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.35);
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
}

.nu-chat-header{
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(0deg, rgba(255,255,255,.02), rgba(255,255,255,.04));
}
.nu-chat-title strong{ font-weight: 800; }
.nu-chat-actions .btn{ padding: 6px 8px; border-radius: 10px; }

.nu-chat-log{
  height: 320px; overflow:auto; padding: 12px; display: grid; gap: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,0));
}
.nu-chat-log .msg{ display: flex; }
.nu-chat-log .msg .bubble{
  max-width: 80%; padding: 8px 10px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.03);
}
.nu-chat-log .msg .bubble p{ margin:0 0 4px 0; white-space: pre-wrap; word-break: break-word; }
.nu-chat-log .msg .bubble time{ display:block; font-size:11px; color: var(--muted); }

.nu-chat-log .msg.me{ justify-content: flex-end; }
.nu-chat-log .msg.me .bubble{
  background: var(--accent, #ff6600); color:#111; border-color: transparent;
}
.nu-chat-log .msg.system .bubble{
  background: rgba(125,211,252,.12); border-color: rgba(125,211,252,.35);
}

.nu-chat-form{
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 10px; border-top: 1px solid rgba(255,255,255,.10);
}
.nu-chat-input{
  width:100%; padding: 10px 12px; border-radius: 12px;
  border:1px solid rgba(255,255,255,.14); background: transparent; color: var(--fg);
  outline: none;
}
.nu-chat-input:focus{ border-color: var(--accent, #ff6600); box-shadow: 0 0 0 4px var(--ring, rgba(255,102,0,.25)); }

/* Respeta reduce-motion */
@media (prefers-reduced-motion: reduce){
  #nu-chat-toggle, #nu-chat-panel { transition: none !important; }
}


/* ======= Reloj fijo (arriba-derecha) ======= */
#nu-clock {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 50;
  background: var(--card);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 12px;
  line-height: 1.2;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
#nu-clock .date {
  font-size: 11px;
  opacity: .8;
  font-weight: 600;
}

/* ======= FAB Agenda (botón flotante) ======= */
#nu-agenda-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  border: 1px solid rgba(255,255,255,.16);
  background: var(--card);
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(0,0,0,.28);
  transition: transform .15s ease, box-shadow .2s ease;
}
#nu-agenda-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,.34); }

/* ======= Panel Agenda ======= */
#nu-agenda-panel {
  position: fixed;
  right: 20px;
  bottom: 72px;
  width: 340px;
  max-height: 70vh;
  overflow: hidden;
  z-index: 50;
  background: var(--card);
  color: var(--fg);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
#nu-agenda-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
#nu-agenda-panel header {
  display:flex; align-items:center; justify-content:space-between;
  padding: 10px 12px; font-weight: 800; border-bottom:1px solid rgba(255,255,255,.08);
}
#nu-agenda-panel header .actions { display:flex; gap:8px; }
#nu-agenda-panel .body { padding: 10px 12px; display:grid; gap:10px; }
#nu-agenda-panel .row { display:grid; grid-template-columns: 1fr 120px; gap:8px; }
#nu-agenda-panel input[type="text"],
#nu-agenda-panel input[type="date"],
#nu-agenda-panel input[type="time"]{
  width:100%; padding:8px 10px; border-radius:10px; border:1px solid rgba(255,255,255,.14);
  background: transparent; color: var(--fg); outline:none;
}
#nu-agenda-panel .btn {
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:8px 12px; border-radius:10px; border:1px solid rgba(255,255,255,.16);
  background: transparent; color: var(--fg); cursor: pointer; font-weight: 800;
}
#nu-agenda-panel .btn.primary { background: var(--accent); color: #0b0b0b; border-color: transparent; }
#nu-agenda-panel .list { display:grid; gap:8px; max-height: 36vh; overflow:auto; padding-bottom: 4px; }
#nu-agenda-panel .item {
  border:1px solid rgba(255,255,255,.10); border-radius:12px; padding:8px 10px;
  display:grid; gap:2px; background: rgba(255,255,255,.02);
}
#nu-agenda-panel .meta { font-size:11px; opacity:.8; display:flex; gap:8px; }
#nu-agenda-panel .title { font-weight:800; }
#nu-agenda-panel .item .row-actions { display:flex; gap:8px; margin-top:6px; }
#nu-agenda-panel .empty {
  font-size:12px; opacity:.75; border:1px dashed rgba(255,255,255,.16);
  border-radius:12px; padding:10px; text-align:center;
}

/* Responsive: ocultar reloj si tapa UI en móviles */
@media (max-width: 640px){
  #nu-clock { display:none; }
  #nu-agenda-panel { width: calc(100vw - 32px); right: 16px; }
}
