<script lang="ts">
  import type { Snippet } from 'svelte';
  // The bottom tab bar: square borderless buttons, evenly distributed, mobile-OS feel.
  // Direct children (plain `.tab` buttons or HoldConfirm wrappers) share the width.
  let { children }: { children?: Snippet } = $props();
</script>

<div class="tabbar">{@render children?.()}</div>

<style>
  .tabbar {
    display: flex;
    gap: 12px;
    padding: 8px var(--pad);
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    user-select: none;
    -webkit-user-select: none;
  }
  :global(.tabbar > *) {
    flex: 1 1 0;
    min-width: 0;
  }
  /* Tab face: an icon square (the press-highlight target) + a tiny truncated label. */
  :global(.tab) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    padding: 2px 0;
    color: var(--text);
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
  }
  :global(.tab:disabled) {
    opacity: 0.4;
  }
  :global(.tab .sq) {
    width: 48px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    font-size: 1.5rem;
    line-height: 1;
    transition: background-color 0.12s;
  }
  :global(.tab:active:not(:disabled) .sq) {
    background: var(--surface-2);
  }
  :global(.tab .lbl) {
    font-size: 0.62rem;
    color: var(--text-muted);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
</style>
