/* ═══════════════════════════════════════════════════════
   Radar de Prioridades — page-specific styles
   Depende de: style.css (design tokens) + simulators.css
   ═══════════════════════════════════════════════════════ */

:root {
  --zazen-bg:      var(--z-bg);
  --zazen-surface: var(--z-surface);
  --zazen-border:  var(--z-border);
  --zazen-teal:    var(--z-primary);
  --zazen-gold:    var(--z-accent);
  --zazen-text:    var(--z-text);
  --zazen-muted:   var(--z-text-2);
  --zazen-dim:     var(--z-text-muted);
  --font-head:  'Ubuntu', sans-serif;
  --font-body:  'Ubuntu', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  background: var(--zazen-bg);
  color: var(--zazen-text);
  font-family: var(--font-body);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: 56px;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-heading); }

/* ── Header ── */
.zr-header {
  background: linear-gradient(135deg, var(--zazen-surface) 0%, #0e1a24 100%);
  border-bottom: 1px solid var(--zazen-border);
  padding: 1.25rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.zr-eyebrow {
  font-size: .62rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--zazen-teal);
  margin-bottom: .3rem;
}
.zr-header h1 { font-size: 1.35rem; font-weight: 400; color: #f0ece4; }
.zr-header-actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

.zr-select {
  background: var(--zazen-surface);
  border: 1px solid rgba(43,184,184,.25);
  color: var(--zazen-text);
  border-radius: 6px;
  padding: .35rem .75rem;
  font-family: var(--font-body);
  font-size: .78rem;
  cursor: pointer;
}
.zr-btn-primary {
  background: var(--zazen-teal);
  border: none;
  color: #0a1219;
  border-radius: 6px;
  padding: .4rem 1rem;
  font-family: var(--font-heading);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}
.zr-btn-primary:hover { opacity: .85; }
.zr-btn-outline {
  background: none;
  border: 1px solid var(--zazen-teal);
  color: var(--zazen-teal);
  border-radius: 6px;
  padding: .35rem 1rem;
  font-family: var(--font-heading);
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.zr-btn-outline:hover { background: var(--zazen-teal); color: #0a1219; }

/* ── Add Form ── */
.zr-add-form {
  background: #111c26;
  border-bottom: 1px solid rgba(43,184,184,.12);
  padding: .9rem 1.75rem;
  display: none;
  gap: .7rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.zr-add-form.open { display: flex; }
.zr-form-group { display: flex; flex-direction: column; gap: .3rem; }
.zr-form-label {
  font-size: .6rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--zazen-muted);
}
.zr-form-input, .zr-form-select {
  background: var(--zazen-surface);
  border: 1px solid rgba(255,255,255,.1);
  color: #f0ece4;
  border-radius: 6px;
  padding: .4rem .7rem;
  font-family: var(--font-body);
  font-size: .8rem;
}
.zr-form-input:focus, .zr-form-select:focus { outline: none; border-color: var(--zazen-teal); }

.zr-slider-wrap { display: flex; flex-direction: column; gap: .3rem; }
.zr-slider-label { display: flex; justify-content: space-between; }
.zr-slider-label span { font-size: .6rem; letter-spacing: 2px; text-transform: uppercase; color: var(--zazen-muted); }
.zr-slider-label strong { font-size: .7rem; color: var(--zazen-teal); }
input[type=range] { accent-color: var(--zazen-teal); cursor: pointer; width: 100%; }

/* ── Main layout ── */
.zr-main {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Radar canvas ── */
#radar-wrap { flex: 1; position: relative; min-width: 0; min-height: 0; }
#radar-svg { display: block; width: 100%; height: 100%; }

/* ── Tooltip ── */
#tooltip {
  position: fixed;
  background: var(--zazen-surface);
  border: 1px solid rgba(43,184,184,.3);
  border-radius: 8px;
  padding: .7rem .9rem;
  font-size: .78rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  z-index: 999;
  max-width: 220px;
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
#tooltip.visible { opacity: 1; pointer-events: auto; }
#tooltip .tt-header { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .3rem; }
#tooltip .tt-area { font-size: .6rem; letter-spacing: 2px; text-transform: uppercase; }
#tooltip .tt-title { color: #f0ece4; font-family: var(--font-heading); margin-bottom: .5rem; line-height: 1.3; }
#tooltip .tt-score { font-size: .7rem; color: var(--zazen-muted); }
#tooltip .tt-score span { color: var(--zazen-teal); }
#tt-close {
  background: none; border: none; color: var(--zazen-muted);
  cursor: pointer; font-size: .9rem; line-height: 1;
  padding: 0 .1rem; flex-shrink: 0; transition: color .15s;
}
#tt-close:hover { color: #f0ece4; }

/* ── Demand list ── */
.demand-item {
  padding: .45rem .5rem; border-radius: 6px;
  cursor: pointer; transition: background .15s; margin-bottom: .3rem;
}
.demand-item:hover { background: rgba(255,255,255,.04); }
.demand-item.is-selected { background: rgba(43,184,184,.08); border-left: 2px solid var(--zazen-teal); padding-left: .35rem; }
.demand-item-header { display: flex; align-items: center; gap: .4rem; }
.demand-area-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.demand-title { font-size: .74rem; color: var(--zazen-text); flex: 1; line-height: 1.3; }
.demand-delete {
  background: none; border: none; color: rgba(224,92,92,.4);
  cursor: pointer; padding: 0 .15rem; font-size: .85rem; line-height: 1;
  transition: color .15s; flex-shrink: 0;
}
.demand-delete:hover { color: #e05c5c; }
.demand-meta { display: flex; justify-content: space-between; margin-top: .2rem; padding-left: 1rem; }

/* ── Sidebar ── */
.zr-sidebar {
  width: 260px;
  background: #0e1a24;
  border-left: 1px solid var(--zazen-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}
.zr-sidebar-section { padding: 1rem; border-bottom: 1px solid var(--zazen-border); flex-shrink: 0; }

/* ── Panel switching ── */
.sidebar-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.sidebar-panel[hidden] { display: none !important; }

/* List panel */
.zr-list-header { padding: .75rem 1rem .5rem; border-bottom: 1px solid var(--zazen-border); flex-shrink: 0; }
#demand-list {
  overflow-y: auto; flex: 1; padding: .5rem .75rem;
  scrollbar-width: thin; scrollbar-color: var(--zazen-dim) transparent;
}
#demand-list::-webkit-scrollbar { width: 4px; }
#demand-list::-webkit-scrollbar-thumb { background: var(--zazen-dim); border-radius: 2px; }

/* Detail panel */
#panel-detail { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--zazen-dim) transparent; }
#panel-detail::-webkit-scrollbar { width: 4px; }
#panel-detail::-webkit-scrollbar-thumb { background: var(--zazen-dim); border-radius: 2px; }
.detail-back { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--zazen-border); flex-shrink: 0; }
#btn-back {
  background: none; border: none; color: var(--zazen-teal); font-size: .75rem;
  font-family: var(--font-body); cursor: pointer; display: flex;
  align-items: center; gap: .3rem; padding: 0; transition: opacity .15s;
}
#btn-back:hover { opacity: .75; }

/* Legends section */
.zr-legends-wrap {
  overflow-y: auto; flex-shrink: 0; border-top: 1px solid var(--zazen-border);
  scrollbar-width: thin; scrollbar-color: var(--zazen-dim) transparent;
}
.zr-sidebar-title {
  font-size: .6rem; letter-spacing: 3px; text-transform: uppercase;
  color: var(--zazen-dim); margin-bottom: .75rem;
}

/* Detail panel internals */
#detail-panel .dp-area { font-size: .6rem; letter-spacing: 2px; text-transform: uppercase; margin-bottom: .4rem; }
#detail-panel .dp-title { font-family: var(--font-heading); font-size: .9rem; color: #f0ece4; margin-bottom: .9rem; line-height: 1.4; }
.dp-bar-wrap { margin-bottom: .7rem; }
.dp-bar-header { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.dp-bar-label { font-size: .65rem; color: var(--zazen-muted); letter-spacing: .5px; }
.dp-bar-val { font-size: .7rem; }
.dp-bar-bg { background: var(--zazen-surface); border-radius: 3px; height: 4px; }
.dp-bar-fill { height: 100%; border-radius: 3px; transition: width .3s; }
.dp-score-box {
  background: var(--zazen-surface); border-radius: 6px; padding: .6rem .8rem;
  display: flex; justify-content: space-between; align-items: center; margin-top: .9rem;
}
.dp-score-box .label { font-size: .65rem; color: var(--zazen-muted); }
.dp-score-box .value { font-size: 1.4rem; font-weight: 300; color: #f0ece4; font-family: var(--font-heading); }

.zr-btn-ghost-red {
  width: 100%; margin-top: .75rem; background: none;
  border: 1px solid rgba(224,92,92,.3); color: rgba(224,92,92,.7);
  border-radius: 6px; padding: .4rem; font-size: .72rem;
  cursor: pointer; font-family: var(--font-body); transition: all .2s;
}
.zr-btn-ghost-red:hover { border-color: #e05c5c; color: #e05c5c; }

.zr-placeholder { font-size: .8rem; color: var(--zazen-dim); line-height: 1.6; }

/* Legend dots */
.legend-item { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.legend-sq  { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend-label { font-size: .75rem; color: var(--zazen-muted); }
.legend-label b { font-weight: 400; }

/* ── Areas Editor ── */
.ae-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}
#btn-edit-areas {
  background: none;
  border: none;
  color: var(--zazen-dim);
  cursor: pointer;
  font-size: .72rem;
  padding: .1rem .25rem;
  line-height: 1;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
#btn-edit-areas:hover  { color: var(--zazen-teal); }
#btn-edit-areas.active { color: var(--zazen-teal); background: rgba(43,184,184,.08); }

#areas-editor { display: none; margin-bottom: .25rem; }
#areas-editor.open { display: block; }

.areas-scroll-wrap {
  max-height: 140px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--zazen-dim) transparent;
  margin-bottom: .25rem;
}
.areas-scroll-wrap::-webkit-scrollbar { width: 3px; }
.areas-scroll-wrap::-webkit-scrollbar-thumb { background: var(--zazen-dim); border-radius: 2px; }

.ae-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.ae-color {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px;
  background: none;
  flex-shrink: 0;
}
.ae-name {
  flex: 1;
  background: var(--zazen-surface);
  border: 1px solid rgba(255,255,255,.08);
  color: #f0ece4;
  border-radius: 4px;
  padding: .2rem .4rem;
  font-size: .72rem;
  font-family: var(--font-body);
  min-width: 0;
}
.ae-name:focus { outline: none; border-color: var(--zazen-teal); }
.ae-del {
  background: none;
  border: none;
  color: rgba(224,92,92,.35);
  cursor: pointer;
  font-size: .78rem;
  line-height: 1;
  padding: .1rem .15rem;
  flex-shrink: 0;
  transition: color .15s;
}
.ae-del:hover { color: #e05c5c; }

.ae-add-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid rgba(255,255,255,.06);
}
.ae-add-btn {
  background: none;
  border: 1px solid rgba(43,184,184,.3);
  color: var(--zazen-teal);
  border-radius: 4px;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  padding: .15rem .35rem;
  flex-shrink: 0;
  transition: background .15s;
}
.ae-add-btn:hover { background: rgba(43,184,184,.1); }

/* ── Footer ── */
.zr-footer {
  background: #080f16;
  border-top: 1px solid var(--zazen-border);
  padding: .5rem 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.zr-footer-text { font-size: .65rem; color: var(--zazen-dim); }

/* ── Responsive ── */
@media (max-width: 768px) {
  html, body { height: auto; overflow: auto; }
  body { overflow-y: auto; }
  .zr-main { flex-direction: column; overflow: visible; }
  #radar-wrap { min-height: 80vw; max-height: 90vw; flex: none; }

  .zr-sidebar {
    width: 100%; border-left: none; border-top: 1px solid var(--zazen-border);
    overflow: visible; flex-direction: column; height: auto;
  }
  .sidebar-panel { flex: none; overflow: visible; min-height: 0; }
  #demand-list { max-height: 40vh; overflow-y: auto; }
  #panel-detail { max-height: 50vh; overflow-y: auto; }

  .zr-legends-wrap .zr-sidebar-section {
    display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .8rem; padding: .6rem 1rem;
  }
  .zr-legends-wrap .zr-sidebar-title { flex: 0 0 100%; margin-bottom: 0; margin-top: .3rem; }
  #legend-areas { flex: 0 0 100%; display: flex; flex-wrap: wrap; gap: .2rem .7rem; }
  .zr-legends-wrap .legend-item { margin-bottom: 0; }

  .zr-header { padding: 1rem; }
  .zr-header h1 { font-size: 1.1rem; }
  .zr-footer { flex-direction: column; align-items: flex-start; gap: .2rem; }
  .zr-footer-text:not(:first-child) { display: none; }
}

@media (max-width: 480px) {
  .zr-header-actions .zr-select { display: none; }
}
