/* ============================================================
   Command Palette / Busca Global
   ============================================================ */

.cp-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.cp-overlay.cp-visible {
    opacity: 1;
}

.cp-modal {
    width: 100%;
    max-width: 640px;
    background: var(--orbyra-card);
    border-radius: var(--orbyra-radius);
    box-shadow: var(--orbyra-shadow-lg);
    overflow: hidden;
    animation: fadeInScale 0.2s ease;
}

/* ── Search Input ────────────────────────────────────────── */
.cp-input-wrapper {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--orbyra-border);
    gap: 0.75rem;
}

.cp-input-wrapper i {
    font-size: 1.25rem;
    color: var(--orbyra-text-muted);
    flex-shrink: 0;
}

.cp-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    color: var(--orbyra-text);
    background: transparent;
}

.cp-input::placeholder {
    color: var(--orbyra-text-muted);
}

.cp-filter-hint {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--orbyra-radius-sm);
    background: var(--orbyra-primary-light);
    color: var(--orbyra-primary-hover);
    font-weight: 500;
    white-space: nowrap;
}

/* ── Results ─────────────────────────────────────────────── */
.cp-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.cp-results::-webkit-scrollbar {
    width: 6px;
}

.cp-results::-webkit-scrollbar-thumb {
    background: var(--orbyra-border);
    border-radius: 3px;
}

.cp-section-header {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--orbyra-text-muted);
}

.cp-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: background 0.1s ease;
    text-decoration: none;
    color: var(--orbyra-text);
}

.cp-item:hover,
.cp-item.cp-active {
    background: var(--orbyra-bg);
}

.cp-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--orbyra-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    background: var(--orbyra-border-light);
    color: var(--orbyra-text-muted);
}

.cp-item-content {
    flex: 1;
    min-width: 0;
}

.cp-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--orbyra-text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-item-subtitle {
    font-size: 0.75rem;
    color: var(--orbyra-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-item-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #fff;
    flex-shrink: 0;
}

/* ── Footer ──────────────────────────────────────────────── */
.cp-footer {
    display: grid;
    grid-template-columns: 1fr;
    border-top: 1px solid var(--orbyra-border);
    font-size: 0.7rem;
    color: var(--orbyra-text-muted);
}

.cp-footer-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1.25rem;
}

.cp-footer-hints {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1.25rem;
    border-top: 1px solid color-mix(in srgb, var(--orbyra-border) 50%, transparent);
    background: var(--orbyra-bg);
    flex-wrap: wrap;
}

.cp-footer-hints-label {
    font-weight: 600;
    opacity: 0.7;
    margin-right: 0.15rem;
}

.cp-footer kbd {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    border: 1px solid var(--orbyra-border);
    border-radius: 4px;
    background: var(--orbyra-bg);
    color: var(--orbyra-text);
    font-family: inherit;
}

.cp-footer-hints kbd {
    background: var(--orbyra-card);
}

/* ── Empty state ─────────────────────────────────────────── */
.cp-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--orbyra-text-muted);
    font-size: 0.875rem;
}

/* ── Loading ─────────────────────────────────────────────── */
.cp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--orbyra-text-muted);
}

.cp-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--orbyra-border);
    border-top-color: var(--orbyra-primary);
    border-radius: 50%;
    animation: cp-spin 0.6s linear infinite;
}

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

/* ── Search trigger kbd ──────────────────────────────────── */
.cp-trigger-kbd {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border: 1px solid var(--orbyra-border);
    border-radius: 4px;
    background: var(--orbyra-card);
    color: var(--orbyra-text-muted);
    font-family: inherit;
    pointer-events: none;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .cp-overlay {
        padding-top: 0;
        align-items: stretch;
    }
    .cp-modal {
        max-width: 100%;
        border-radius: 0;
        height: 100%;
    }
    .cp-results {
        max-height: calc(100vh - 130px);
    }
}
