/* 2D Viewer specific styles */

header {
  position: sticky;
  top: 0;
  z-index: 5;
}

header .title {
  margin-right: auto;
}

header .controls {
  justify-content: flex-end;
}

.input {
  width: 320px;
  max-width: 70vw;
}

/* Main layout */
main {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 12px;
  padding: 12px;
}

/* Network container */
#networkWrap {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  height: calc(100vh - 74px);
  min-height: 560px;
}

#network {
  position: absolute;
  inset: 0;
  outline: none;
}

#network canvas {
  outline: none;
}

#banner {
  position: absolute;
  left: 80px;
  right: 160px;
  bottom: 16px;
  z-index: 4;
}

.tooltip {
  position: absolute;
  z-index: 10;
}

/* Sidebar */
aside {
  height: calc(100vh - 74px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cards */
.card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
}

.card h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.2px;
  color: var(--text);
}

.card h3.collapsible {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -12px -12px 0 -12px;
  padding: 12px;
  border-radius: 14px 14px 0 0;
}

.card h3.collapsible:hover {
  background: rgba(255,255,255,0.03);
}

.card h3.collapsible.collapsed {
  border-radius: 14px;
  margin-bottom: -12px;
}

.card h3.collapsible::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transition: transform 0.2s;
}

.card h3.collapsible.collapsed::after {
  transform: rotate(-90deg);
}

.card .card-body {
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease;
  max-height: 500px;
  margin-top: 8px;
}

.card .card-body.collapsed {
  max-height: 0;
  margin-top: 0;
}

.card-bottom {
  margin-top: auto;
}

/* Settings */
.input-full {
  width: 100%;
}

.label-muted {
  opacity: 0.7;
  font-size: 12px;
}

.settings-kv {
  align-items: center;
}

.settings-kv .k {
  padding-top: 0;
}

.settings-kv input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.noscript-msg {
  padding: 14px;
  color: #ffb3b3;
}

/* Filter controls - 2D specific overrides */
/* Base styles are in ck-family-graph-base.css */

.filter-select {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.filter-select:hover {
  border-color: var(--accent);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(122,162,255,0.2);
}

/* 2D specific: use --panel2 background for filter buttons */
.filter-btn {
  background: var(--panel2);
}

.filter-input {
  background: var(--panel);
  width: 80px;
  text-align: left;
}

.filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.filter-row-inline {
  margin-top: 4px;
  justify-content: flex-start;
}

/* Embed mode */
body.embed-mode {
  overflow: hidden;
}

body.embed-mode header,
body.embed-mode aside {
  display: none;
}

body.embed-mode main {
  grid-template-columns: 1fr;
  padding: 0;
}

body.embed-mode #networkWrap {
  height: 100vh;
  min-height: 100vh;
  border: none;
  border-radius: 0;
}

/* Responsive */
@media (max-width: 1020px) {
  main {
    grid-template-columns: 1fr;
  }

  aside {
    height: auto;
    min-height: auto;
  }

  #networkWrap {
    height: 70vh;
  }

  header .controls {
    justify-content: flex-start;
  }

  .input {
    width: 280px;
  }
}
