﻿/* command demo styles — plain CSS section. The library ships zero CSS.
   Mirrored in the CSS tab of each demo on Components/Pages/Css/CommandPage.razor. */

/* All styles are consumer-authored — the library ships zero CSS */
.cmd {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 28rem;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

/* Focus stays in the input while navigating, so ring the whole card */
.cmd:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cmd-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.85rem;
    border-bottom: 1px solid var(--color-border);
}

.cmd-input-icon { color: var(--color-faint); }

/* BitBhCommandInput renders <input role="combobox"> */
.cmd-input {
    flex: 1;
    min-width: 0;
    height: 2.75rem;
    border: 0;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
}

.cmd-input::placeholder { color: var(--color-faint); }

/* BitBhCommandList renders role="listbox" */
.cmd-list {
    max-height: 18rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.375rem;
    scroll-padding-block: 0.375rem;
}

/* BitBhCommandEmpty only renders while nothing matches */
.cmd-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-muted);
}

/* Groups get the hidden attribute when none of their items match */
.cmd-group[hidden] { display: none; }

.cmd-group [data-bit-bh-command-group-heading] {
    padding: 0.5rem 0.6rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 0.4rem;
    font-size: 0.875rem;
    color: light-dark(#27272a, #fafafa);
    cursor: pointer;
    user-select: none;
}

/* data-selected marks the highlighted item (the aria-activedescendant target) */
.cmd-item[data-selected] { background: var(--color-accent-subtle); color: var(--color-accent-text); }
.cmd-item[data-disabled] { opacity: 0.45; cursor: not-allowed; }

.cmd-item-icon { width: 1.25rem; flex-shrink: 0; text-align: center; }

.cmd-item-shortcut {
    margin-left: auto;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--color-muted);
}

.cmd-item[data-selected] .cmd-item-shortcut { color: #60a5fa; }

/* BitBhCommandSeparator is removed while searching */
.cmd-separator { height: 1px; margin: 0.375rem -0.375rem; background: var(--color-border); }

.cmd-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border: 1px solid var(--color-border);
    border-bottom-width: 2px;
    border-radius: 0.3rem;
    background: var(--color-subtle);
    font-family: inherit;
    font-size: 0.68rem;
    color: var(--color-text-tertiary);
}

/* Breadcrumb of the page stack, kept in sync through PageChanged */
.cmd-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 0.85rem 0;
    font-size: 0.75rem;
    color: var(--color-muted);
}

.cmd-crumb {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--color-fill);
    color: var(--color-text-secondary);
}

.cmd-crumb-sep  { color: var(--color-disabled); }
.cmd-crumb-hint { margin-left: auto; color: var(--color-faint); }

.cmd-item-arrow { margin-left: auto; color: var(--color-faint); }
.cmd-item-check { margin-left: auto; font-weight: 600; color: var(--color-primary-text); }

.cmd-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 20rem;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: 0.5rem;
    background: var(--color-surface);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    color: var(--color-muted);
    cursor: pointer;
    transition: border-color 120ms ease;
}

.cmd-trigger:hover         { border-color: var(--color-border-hover); }
.cmd-trigger:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.cmd-trigger-keys          { display: inline-flex; gap: 0.2rem; margin-left: auto; }

/* OverlayClass → BitBhDialogBackdrop */
.cmd-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.45);
    backdrop-filter: blur(2px);
}

/* ContentClass → BitBhDialogPanel (the dialog root already covers the viewport) */
.cmd-dialog {
    position: relative;
    z-index: 1;
    width: calc(100% - 2rem);
    max-width: 36rem;
    margin: 12vh auto 0;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.85rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    outline: none;
}

.cmd-dialog[data-state="open"] { animation: cmd-dialog-in 140ms ease-out; }

@keyframes cmd-dialog-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
}

/* CommandClass → the BitBhCommand inside the panel (the panel is the card) */
.cmd-palette            { display: flex; flex-direction: column; }
.cmd-palette .cmd-list  { max-height: min(22rem, 50vh); }

.cmd-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.85rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-subtle);
    font-size: 0.75rem;
    color: var(--color-muted);
}

.cmd-footer span { display: inline-flex; align-items: center; gap: 0.25rem; }

.cmd-spinner {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: cmd-spin 700ms linear infinite;
}

@keyframes cmd-spin {
    to { transform: rotate(360deg); }
}

.cmd-item-body        { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.cmd-item-title       { font-weight: 500; }
.cmd-item-description { overflow: hidden; font-size: 0.75rem; color: var(--color-text-tertiary); white-space: nowrap; text-overflow: ellipsis; }

.cmd-item[data-selected] .cmd-item-description { color: var(--color-accent-text); }

/* Sort="true" ranks results with the CSS order property —
   the list (and group item containers) must be flex columns */
.cmd-list-sorted { display: flex; flex-direction: column; }

.cmd-item-enter { margin-left: auto; }
