/* Sized in rem throughout (root font = --font-size-base, values are
   px-at-12 ÷ 12), so the Display panel's TEXT SIZE scales the whole
   surface, not just its type. Hairlines stay px. */

.bluetooth {
    display: contents;
}

/* Slot metrics come from the shared .bar-icon-button /
   .bar-status-button classes in bar.css. */

/* ---- Device panel -------------------------------------------------- */

.bluetooth-panel {
    position: fixed;
    z-index: 150;
    width: 31.6667rem;
    max-width: calc(var(--viewport-w) - 16px);
    max-height: calc(var(--viewport-h) - var(--bar-height) - 10px);
    overflow-y: auto;
    padding: 1.6667rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.1667rem;
    background: var(--color-background);
    border: var(--border-width) solid var(--color-accent);
    border-radius: var(--radius);
    color: var(--color-foreground);
    font-family: var(--font-mono);
}

.bluetooth-panel > * {
    flex: none;
}

html[data-bar-position="left"] .bluetooth-panel,
html[data-bar-position="right"] .bluetooth-panel {
    max-height: calc(var(--viewport-h) - 10px);
}

html[data-bar-position="top"] .bluetooth-panel {
    top: calc(var(--bar-height) + 5px);
    right: 5px;
}

html[data-bar-position="bottom"] .bluetooth-panel {
    bottom: calc(var(--bar-height) + 5px);
    right: 5px;
}

html[data-bar-position="left"] .bluetooth-panel {
    left: calc(var(--bar-size-vertical) + 5px);
    bottom: 5px;
}

html[data-bar-position="right"] .bluetooth-panel {
    right: calc(var(--bar-size-vertical) + 5px);
    bottom: 5px;
}

/* ---- Hero: glyph · title/status · power toggle --------------------- */

.bluetooth-hero {
    display: flex;
    align-items: center;
    gap: 1.1667rem;
    border-radius: var(--radius);
}

.bluetooth-hero-icon {
    font-size: 2.1667rem;
    line-height: 1;
}

.bluetooth-hero-icon-off {
    opacity: 0.5;
}

.bluetooth-hero-labels {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1667rem;
}

.bluetooth-hero-title {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bluetooth-hero-status {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: color-mix(in srgb, var(--color-foreground) 65%, transparent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 180ms ease-out;
}

.bluetooth-hero-status-fading {
    opacity: 0;
}

/* The power toggle: a small track + knob switch. */
.bluetooth-switch {
    flex: none;
    width: 2.8333rem;
    height: 1.5rem;
    padding: 0.1667rem;
    display: flex;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--color-foreground) 25%, transparent);
    border-radius: 1rem;
    background: color-mix(in srgb, var(--color-foreground) 8%, transparent);
    cursor: pointer;
}

.bluetooth-switch-knob {
    width: 1.0833rem;
    height: 1.0833rem;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-foreground) 55%, transparent);
    transition: transform 160ms ease-out, background 160ms ease-out;
}

.bluetooth-switch-on {
    border-color: var(--color-accent);
}

.bluetooth-switch-on .bluetooth-switch-knob {
    transform: translateX(1.3333rem);
    background: var(--color-accent);
}

.bluetooth-separator {
    height: 1px;
    background: color-mix(in srgb, var(--color-foreground) 10%, transparent);
}

/* ---- Sections and device rows -------------------------------------- */

.bluetooth-sections {
    display: flex;
    flex-direction: column;
    gap: 0.8333rem;
    max-height: 33.3333rem;
    overflow-y: auto;
}

.bluetooth-section-title {
    font-size: 0.8333rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: color-mix(in srgb, var(--color-foreground) 65%, transparent);
}

.bluetooth-row {
    display: flex;
    align-items: center;
    gap: 0.8333rem;
    padding: 0.5rem 0.8333rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}

.bluetooth-row-icon {
    flex: none;
    width: 1.8333rem;
    text-align: center;
    font-size: 1.25rem;
}

.bluetooth-row-labels {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.0833rem;
}

.bluetooth-row-name {
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bluetooth-row-status {
    font-size: 0.75rem;
}

.bluetooth-row-status-dim {
    color: color-mix(in srgb, var(--color-foreground) 60%, transparent);
}

/* The forget affordance only surfaces under the cursor, as upstream. */
.bluetooth-row-forget {
    flex: none;
    padding: 0.1667rem 0.3333rem;
    border: none;
    background: none;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 1rem;
    color: color-mix(in srgb, var(--color-foreground) 65%, transparent);
    cursor: pointer;
    visibility: hidden;
}

.bluetooth-row:hover .bluetooth-row-forget,
.bluetooth-row-forget-shown {
    visibility: visible;
}

.bluetooth-row-forget:hover,
.bluetooth-row-forget-cursor {
    color: var(--color-accent);
}

.bluetooth-row-scan .bluetooth-row-name {
    color: color-mix(in srgb, var(--color-foreground) 70%, transparent);
}

/* Shared cursor highlight, hover and j/k alike. */
.bluetooth-cursor {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
}

.bluetooth-row:hover {
    background: color-mix(in srgb, var(--color-foreground) 6%, transparent);
}

.bluetooth-empty {
    font-size: 0.8333rem;
    color: color-mix(in srgb, var(--color-foreground) 60%, transparent);
    cursor: pointer;
}
