/* ---------- OPERATOR SIDEBAR ---------- */
#sidebar {
  width: 350px;
  min-width: 350px;
  height: 100%;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.4);
}

#sidebar-scroll {
  overflow-y: auto;
  flex: 1;
}

.brand {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(255, 140, 70, 0.08) 0%, transparent 100%);
}

.brand-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand h1 {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.15;
  color: var(--text);
}

.brand span {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.14em;
  margin-top: 3px;
  font-weight: 600;
}

.sec {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.eyebrow .count {
  color: var(--text-dim);
  letter-spacing: 0;
  font-size: 10.5px;
  background: var(--panel-alt);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

/* Lista de Quadrantes */
.qd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  margin-bottom: 6px;
  background: var(--panel-alt);
  transition: all var(--transition-fast);
}

.qd-item:hover {
  border-color: var(--line-highlight);
  background: var(--panel-elevated);
}

.qd-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex: 0 0 auto;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.qd-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qd-meta {
  font-size: 9.5px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 2px;
}

.qd-actions {
  display: flex;
  gap: 3px;
}

/* Legenda de Endereços Marcados */
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--panel-alt);
  border: 1px solid var(--line-soft);
  margin-bottom: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.legend-item:hover {
  border-color: var(--accent-dim);
  background: var(--panel-elevated);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.4);
}

.legend-txt {
  flex: 1;
  font-size: 11.5px;
  overflow: hidden;
}

.legend-addr {
  color: var(--accent);
  font-weight: 600;
}

.legend-sub {
  color: var(--text-dim);
  font-size: 10px;
  margin-top: 1px;
}

.empty-note {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  padding: 6px 2px;
}

/* Status de Busca */
#search-status {
  font-size: 10.5px;
  margin-top: 6px;
  min-height: 14px;
  font-weight: 500;
}
#search-status.err { color: var(--danger); }
#search-status.ok { color: var(--teal); }

/* Rodapé do Sidebar */
.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 6px;
  background: var(--panel);
}

/* Mobile Toggle */
#sidebar-toggle {
  display: none;
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1400;
  background: var(--panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
}

/* Transmissões de Vídeo de Drones */
.cam-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.cam-btn {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.cam-btn:hover {
  border-color: var(--accent);
  background: var(--panel-elevated);
}

.cam-btn.active {
  background: rgba(255, 140, 70, 0.12);
  border-color: var(--accent);
  color: #ffffff;
  box-shadow: inset 0 0 10px var(--accent-glow);
}

.cam-btn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.cam-btn-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--line);
  color: var(--text);
  font-weight: 700;
}

.cam-btn.active .cam-btn-tag {
  background: var(--danger);
  color: #fff;
}

.cam-btn-name {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cam-slot-card {
  background: var(--bg-deep);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 8px;
}

.cam-slot-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

/* ================= RECOLHIMENTO DA SIDEBAR ================= */
#sidebar {
  transition: margin-left 0.3s cubic-bezier(0.2, 0, 0, 1), left 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.sidebar-collapse-btn {
  background: rgba(255, 140, 70, 0.12);
  border: 1px solid rgba(255, 140, 70, 0.3);
  color: var(--accent);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: #fff;
}

#app.sidebar-collapsed #sidebar {
  margin-left: -350px;
}

.sidebar-floating-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1100;
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(14, 18, 22, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-floating-btn:hover {
  background: var(--accent);
  color: #000000;
}

#app.sidebar-collapsed .sidebar-floating-btn {
  display: flex !important;
}

/* ================= RESPONSIVIDADE ADAPTATIVA ================= */
@media (max-width: 820px) {
  #sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -100vw;
    width: 85vw;
    max-width: 360px;
    min-width: 0;
    margin-left: 0 !important;
    z-index: 2000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
  }

  #sidebar.open {
    left: 0 !important;
  }

  #sidebar-toggle {
    display: flex;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1050;
    background: rgba(14, 18, 22, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
  }

  #app.sidebar-collapsed .sidebar-floating-btn {
    display: none !important;
  }
}
