/**
 * Command Palette (Ctrl/Cmd + K)
 * =============================
 * The thing that lets the rail stop growing. It is painted from the SAME tokens as
 * everything else (workspace-tokens.css), so it reads as part of the product rather
 * than a widget bolted on — the founder's whole complaint in phase 8.
 */

.cmdk {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 1050);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 12vh 20px 20px;
    background: rgba(4, 6, 18, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.cmdk__panel {
    width: 100%;
    max-width: 620px;
    display: flex;
    flex-direction: column;
    max-height: 62vh;
    overflow: hidden;
    background: var(--ws-bg-elevated);
    border: 1px solid var(--ws-border-control);
    border-radius: var(--ws-radius-lg);
    box-shadow: var(--ws-shadow-lg);
    animation: cmdkIn 0.14s var(--ws-ease);
}

@keyframes cmdkIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .cmdk__panel { animation: none; }
}

/* ---- Search row ---------------------------------------------------------- */

.cmdk__search {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ws-glass-border);
}

.cmdk__search-ic {
    font-size: 14px;
    color: var(--ws-text-subtle);
}

.cmdk__input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ws-text);
    font-family: inherit;
    font-size: 15px;
}

.cmdk__input::placeholder { color: var(--ws-text-subtle); }

.cmdk__kbd,
.cmdk__foot kbd {
    padding: 2px 6px;
    border: 1px solid var(--ws-border-control);
    border-radius: 5px;
    background: var(--ws-glass-bg);
    color: var(--ws-text-muted);
    font-family: inherit;
    font-size: 10.5px;
    line-height: 1.5;
}

/* ---- Results ------------------------------------------------------------- */

.cmdk__list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cmdk__group {
    padding: 10px 10px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--ws-text-subtle);
}

/* The same row as everywhere else in the workspace — one card, one hover, one
   active treatment. See .ws-item in workspace-shell.css. */
.cmdk__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--ws-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    color: var(--ws-text-secondary);
}

.cmdk__row:hover { background: var(--ws-glass-hover); }

.cmdk__row.is-active {
    background: rgba(0, 242, 254, 0.09);
    border-color: rgba(0, 242, 254, 0.22);
    color: var(--ws-text);
}

.cmdk__row-ic {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ws-text-muted);
}

.cmdk__row.is-active .cmdk__row-ic { color: var(--ws-accent); }

.cmdk__row-label {
    flex: none;
    max-width: 46%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.cmdk__row-hint {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    font-size: 12px;
    color: var(--ws-text-subtle);
}

.cmdk__empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 13.5px;
    color: var(--ws-text-subtle);
}

/* ---- Footer -------------------------------------------------------------- */

.cmdk__foot {
    display: flex;
    gap: 16px;
    padding: 9px 16px;
    border-top: 1px solid var(--ws-glass-border);
    background: var(--ws-glass-bg);
    font-size: 11px;
    color: var(--ws-text-subtle);
}

.cmdk__foot span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* The palette trigger is now an icon in the workspace icon rail (#ws-palette-btn,
   styled by .ws-rail-btn in workspace-shell.css) — no separate full-width button. */

/* Phones: full-bleed, and no 12vh gap above it. */
@media (max-width: 767px) {
    .cmdk { padding: 0; }

    .cmdk__panel {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border: 0;
        border-radius: 0;
    }

    .cmdk__row-hint { display: none; }
}
