/* SaraHome / 莎拉家 — Cmd+K Command Palette UI
   對位 §R-N+4xxx+43 (2026-09-04, CEO verdict)
   對位 §R-N+264 a11y: ARIA combobox pattern + focus trap
   對位 §R-N+288 brand refresh: 暖橙 accent (對位 brand modal)
   對位 §R-N+62 KISS: 純 CSS, 0 animation library
*/

.cmd-k-modal[hidden] { display: none; }
.cmd-k-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    padding-left: 16px;
    padding-right: 16px;
    animation: cmd-k-fade-in 0.18s ease-out;
}
@keyframes cmd-k-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cmd-k-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.cmd-k-card {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25), 0 8px 16px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    animation: cmd-k-slide-down 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmd-k-slide-down {
    from { transform: translateY(-16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cmd-k-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.cmd-k-header svg {
    color: var(--sarahome-v3-color-accent, #2D7DD2);
    flex-shrink: 0;
}
.cmd-k-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    font-family: inherit;
    color: var(--sarahome-v3-color-text-primary, #0F172A);
}
.cmd-k-input::placeholder {
    color: #94A3B8;
}
.cmd-k-esc-hint {
    background: rgba(15, 23, 42, 0.06);
    color: #64748B;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.cmd-k-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
}

.cmd-k-empty {
    padding: 32px 16px;
    text-align: center;
    color: #94A3B8;
    font-size: 0.875rem;
}

.cmd-k-group {
    margin-bottom: 8px;
}
.cmd-k-group:last-child {
    margin-bottom: 0;
}
.cmd-k-group-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 12px;
}

.cmd-k-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.10s ease;
    color: var(--sarahome-v3-color-text-primary, #0F172A);
}
.cmd-k-item:hover,
.cmd-k-item[aria-selected="true"] {
    background: rgba(45, 125, 210, 0.08);
}
.cmd-k-item[aria-selected="true"] {
    outline: 2px solid rgba(45, 125, 210, 0.32);
    outline-offset: -2px;
}

.cmd-k-item-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    background: rgba(15, 23, 42, 0.04);
    border-radius: 6px;
}
.cmd-k-item-label {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cmd-k-item-name {
    font-size: 0.9375rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cmd-k-item-subtitle {
    font-size: 0.75rem;
    color: #64748B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cmd-k-item-shortcut {
    flex-shrink: 0;
    background: rgba(15, 23, 42, 0.06);
    color: #64748B;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.cmd-k-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(248, 250, 252, 0.6);
    font-size: 0.75rem;
    color: #64748B;
}
.cmd-k-footer kbd {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.6875rem;
    font-weight: 600;
    margin: 0 2px;
}
.cmd-k-launcher {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--sarahome-v3-color-accent, #2D7DD2);
    font-weight: 600;
}

@media (max-width: 640px) {
    .cmd-k-modal {
        padding-top: 8vh;
    }
    .cmd-k-footer {
        flex-wrap: wrap;
        gap: 8px;
    }
}