<script setup>
const emit = defineEmits(["download", "resetCamera"]);
</script>

<template>
  <div class="modebar" role="toolbar" aria-label="Управление 3D-просмотром">
    <button
      type="button"
      class="modebar-btn"
      title="Сохранить снимок"
      aria-label="Сохранить снимок"
      @click="emit('download')"
    >
      <svg viewBox="0 0 24 24" aria-hidden="true">
        <path d="M4 7h4l2-3h4l2 3h4v12H4V7z" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" />
        <circle cx="12" cy="13" r="3.5" fill="none" stroke="currentColor" stroke-width="1.6" />
      </svg>
    </button>
    <button
      type="button"
      class="modebar-btn"
      title="Сбросить камеру"
      aria-label="Сбросить камеру"
      @click="emit('resetCamera')"
    >
      <svg viewBox="0 0 24 24" aria-hidden="true">
        <path d="M4 10.5 10.5 4 17 10.5" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" />
        <path d="M10.5 4v16" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" />
      </svg>
    </button>
  </div>
</template>

<style scoped>
.modebar {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: flex;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--card-bg) 88%, transparent);
  border: 1px solid var(--card-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.modebar-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--modebar-icon, #636363);
  cursor: pointer;
}

.modebar-btn:hover {
  background: color-mix(in srgb, var(--control-text) 8%, transparent);
}

.modebar-btn svg {
  width: 18px;
  height: 18px;
}
</style>
