/* =====================================================
   PANELS.CSS — Info panel and sub-view overlay styles
   ===================================================== */

/* ── Info panel (right drawer) ───────────────────── */
#info-panel {
  flex: 0 0 auto;
  width: var(--panel-w);
  height: 100%;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transform: translateX(100%);
  transition: transform var(--transition);
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

#info-panel.open {
  transform: translateX(0);
}

#panel-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

#panel-header-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  transition: background 0.3s, box-shadow 0.3s;
}

#panel-header-bar.purple { background: var(--purple); box-shadow: 0 0 8px var(--purple); }
#panel-header-bar.pink   { background: var(--pink);   box-shadow: 0 0 8px var(--pink);   }
#panel-header-bar.amber  { background: var(--amber);  box-shadow: 0 0 8px var(--amber);  }

#panel-title-group {
  flex: 1;
}

#panel-comp-id {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

#panel-title {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0,240,255,0.5);
  line-height: 1.2;
}

#panel-title.purple { color: var(--purple); text-shadow: 0 0 8px rgba(123,47,255,0.5); }
#panel-title.pink   { color: var(--pink);   text-shadow: 0 0 8px rgba(255,61,232,0.5); }
#panel-title.amber  { color: var(--amber);  text-shadow: 0 0 8px rgba(255,204,0,0.5);  }

#panel-short-desc {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  font-style: italic;
}

#btn-close-panel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex: 0 0 auto;
  margin-left: 8px;
}

#btn-close-panel:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ── Panel body ──────────────────────────────────── */
#panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
}

/* ── Specs table ─────────────────────────────────── */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 11px;
}

.spec-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.spec-table td:first-child {
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
  padding-right: 12px;
  width: 40%;
}

.spec-table td:last-child {
  color: var(--text);
  font-family: var(--font-mono);
}

/* ── Content sections ────────────────────────────── */
.panel-section {
  margin-bottom: 16px;
}

.panel-section-heading {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--cyan-dim);
}

.panel-section-heading.purple { color: var(--purple); border-color: var(--purple-dim); }
.panel-section-heading.pink   { color: var(--pink);   border-color: var(--pink-dim);   }
.panel-section-heading.amber  { color: var(--amber);  border-color: var(--amber-dim);  }

.panel-section p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 8px;
}

.panel-section p:last-child { margin-bottom: 0; }

/* ── Fun fact box ────────────────────────────────── */
.fun-fact-box {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid var(--cyan-dim);
  border-left: 3px solid var(--cyan);
  border-radius: 3px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.fun-fact-box .ff-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 4px;
}

.fun-fact-box p {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  font-style: italic;
}

/* ── Explore button ──────────────────────────────── */
.btn-explore {
  display: block;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--purple);
  border-radius: 3px;
  color: var(--purple);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  margin-top: 8px;
  margin-bottom: 16px;
}

.btn-explore:hover {
  background: var(--purple-dim);
  box-shadow: 0 0 12px rgba(123,47,255,0.4);
}

/* ── Related components ──────────────────────────── */
.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.related-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
}

.related-tag:hover {
  border-color: var(--cyan-dim);
  color: var(--cyan);
}

/* ── Block diagram in panel ──────────────────────── */
.block-diagram-container {
  margin: 0 0 16px;
  padding: 8px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.block-diagram-container svg {
  width: 100%;
  height: auto;
  display: block;
}

.section-raw {
  margin-top: 6px;
}

/* ── Sub-view info panel ─────────────────────────── */
.sub-panel-section {
  margin-bottom: 14px;
}

/* ── Tooltip for SVG elements ────────────────────── */
.svg-tooltip {
  background: rgba(13, 13, 26, 0.96);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text);
  max-width: 200px;
  pointer-events: none;
}

/* ── Tablet: panel overlays from right ───────────── */
@media (max-width: 900px) {
  #info-panel {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    z-index: 50;
    box-shadow: -10px 0 30px rgba(0,0,0,0.8);
  }
}

/* ── Mobile: bottom sheet ────────────────────────── */
@media (max-width: 600px) {
  #info-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: 68vh;
    transform: translateY(100%);
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.8);
    z-index: 100;
  }

  #info-panel.open {
    transform: translateY(0);
  }

  /* Drag handle above panel header */
  #panel-header {
    padding-top: 20px;
  }

  #panel-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
  }

  /* Larger close button for touch */
  #btn-close-panel {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  /* Larger tap targets for related tags */
  .related-tag {
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Explore button more prominent */
  .btn-explore {
    padding: 14px;
    font-size: 12px;
  }

  /* Spec table slightly larger text */
  .spec-table { font-size: 12px; }
  .spec-table td { padding: 6px; }
}
