/* CÍRCULOS VIP — estilos */
:root {
  --bg: #010204;
  --panel: rgba(10, 18, 34, 0.92);
  --line: rgba(140, 180, 230, 0.16);
  --txt: #e8f1ff;
  --dim: #9db4d0;
  --acc: #67e8f9;
  --gold: #fbbf24;
  --danger: #f87171;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ---------- topbar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(2,6,14,.85), rgba(2,6,14,.35) 70%, transparent);
}
.brand { font-weight: 800; letter-spacing: 3px; font-size: 15px; white-space: nowrap; }
.brand-star { color: var(--gold); margin-right: 6px; }

.search-wrap { position: relative; flex: 1; max-width: 560px; margin: 0 auto; }
#search {
  width: 100%; box-sizing: border-box;
  padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 15, 30, 0.85); color: var(--txt);
  font-size: 14px; outline: none;
}
#search:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(103,232,249,.15); }

#results {
  position: absolute; top: 110%; left: 0; right: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
  max-height: 46vh; overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
.res-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.res-item:last-child { border-bottom: none; }
.res-item:hover { background: rgba(103,232,249,.08); }
.res-item b { font-size: 14px; }
.res-occ { color: var(--dim); font-size: 12px; margin-top: 2px; }
.res-route { color: var(--acc); font-size: 12px; margin-top: 4px; }
.res-empty { padding: 14px; color: var(--dim); font-size: 13px; }

.top-actions { display: flex; gap: 8px; }

/* ---------- botones ---------- */
.btn {
  border: 1px solid var(--line); background: rgba(20,32,55,.8); color: var(--txt);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: rgba(40,60,95,.85); }
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, #0ea5e9, #2563eb); border: none; font-weight: 700; }
.btn-primary:hover { background: linear-gradient(135deg, #38bdf8, #3b82f6); }
.btn-danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.4); color: #fecaca; }
.btn-ghost { background: transparent; }
.icon-btn {
  background: transparent; border: none; color: var(--dim);
  font-size: 16px; cursor: pointer; padding: 6px;
}
.icon-btn:hover { color: var(--txt); }

/* ---------- migas ---------- */
#crumbs {
  position: fixed; top: 58px; left: 0; right: 0; z-index: 25;
  display: flex; gap: 6px; align-items: center; justify-content: center;
  flex-wrap: wrap; padding: 4px 12px; pointer-events: none;
}
.crumb {
  pointer-events: auto; cursor: pointer;
  font-size: 12px; padding: 6px 12px; border-radius: 999px;
  background: rgba(8,15,30,.8); border: 1px solid var(--line); color: var(--dim);
}
.crumb:hover { color: var(--txt); border-color: var(--acc); }
.crumb.now { color: #06121f; background: var(--acc); border-color: var(--acc); font-weight: 700; }
.crumb-sep { color: var(--dim); font-size: 11px; }

/* ---------- escena ---------- */
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; }

#tooltip {
  position: fixed; z-index: 40; pointer-events: none;
  background: rgba(5,10,22,.95); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; max-width: 240px;
  transform: translate(14px, 14px);
}
#tooltip b { font-size: 13px; }
#tooltip span { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }

#legend {
  position: fixed; left: 14px; bottom: 14px; z-index: 25;
  background: rgba(5,10,22,.75); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; font-size: 12px; color: var(--dim);
}
.lg-item { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.lg-n { margin-left: auto; color: var(--txt); font-weight: 700; padding-left: 10px; }

#empty-hint {
  position: fixed; left: 50%; top: 58%; transform: translate(-50%,-50%);
  z-index: 20; text-align: center; color: var(--dim);
  background: rgba(5,10,22,.7); padding: 22px 30px; border-radius: 16px;
  border: 1px dashed var(--line);
}
#empty-hint p { margin: 0 0 12px; }

/* ---------- panel ---------- */
#panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 35;
  width: min(360px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line);
  padding: 20px; box-sizing: border-box; overflow-y: auto;
  transform: translateX(105%); transition: transform .3s ease;
  backdrop-filter: blur(10px);
}
#panel.open { transform: none; }
#p-close { position: absolute; top: 10px; right: 10px; }
.p-head h2 { margin: 10px 0 4px; font-size: 22px; }
.p-occ { color: var(--dim); margin: 0 0 12px; font-size: 14px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(103,232,249,.12); border: 1px solid currentColor;
}
.p-benefit {
  display: flex; gap: 8px; align-items: flex-start;
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.35);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.p-benefit span:first-child { color: var(--gold); }
#p-benefits { display: flex; flex-wrap: wrap; gap: 6px; }
.bchip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.35); color: #fde68a;
}
.benefit-row { display: flex; gap: 6px; margin-bottom: 6px; }
.benefit-row input { flex: 1; width: auto; min-width: 0; }
.btn-mini { padding: 6px 10px; font-size: 12px; width: auto; flex: 0 0 auto; }
.p-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.prow { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.prow a { color: var(--acc); text-decoration: none; word-break: break-all; }
.prow a:hover { text-decoration: underline; }
.p-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(103,232,249,.1); border: 1px solid var(--line); color: var(--dim);
}
.p-notes {
  font-size: 13px; color: var(--dim); background: rgba(255,255,255,.03);
  border-radius: 10px; padding: 10px 12px; white-space: pre-wrap;
}
.p-meta { font-size: 12px; color: var(--dim); }
.p-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.p-actions .btn-primary { grid-column: 1 / -1; }

/* ---------- modales ---------- */
#modal, #cmodal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(1,2,6,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-card {
  width: min(560px, 94vw); max-height: 92vh; overflow-y: auto;
  background: #0a1322; border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; box-sizing: border-box;
}
.modal-card h3 { margin: 0 0 16px; font-size: 18px; }
.field { margin-bottom: 12px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
.field label small { font-weight: 400; opacity: .8; }
.field input, .field select, .field textarea {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  color: var(--txt); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  outline: none; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--acc); }
.field select option { background: #0a1322; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.c-row { display: grid; grid-template-columns: 26px 1fr 90px; gap: 10px; align-items: center; margin-bottom: 10px; }
.c-row input[type="text"] {
  background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; width: 100%; box-sizing: border-box;
}
.c-row input[type="color"] { width: 100%; height: 38px; border: none; background: none; padding: 0; cursor: pointer; }

/* ---------- toast / fatal ---------- */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px);
  z-index: 60; background: #0ea5e9; color: #04121f; font-weight: 700; font-size: 14px;
  padding: 12px 22px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.fatal {
  color: var(--txt); background: #0a1322; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; font-size: 15px; line-height: 1.6;
}

@media (max-width: 640px) {
  .brand { font-size: 12px; letter-spacing: 2px; }
  #b-add { font-size: 12px; padding: 8px 10px; }
  .frow { grid-template-columns: 1fr; }
  #legend { font-size: 11px; padding: 8px 10px; }
  #crumbs { top: 54px; }
}
