/* ------------------------------------------------------------------------------
 *  # Command Palette & Search Overlay styles
 *
 *  Estilo translúcido glassmorphic premium para a Pesquisa Geral global.
 * ---------------------------------------------------------------------------- */

/* Backdrop overlay */
.occ-cp-overlay {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    /* scrim neutro: rgba(15,23,42,…) e slate e lancava azul sobre a pagina quente */
    background-color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px) brightness(0.85);
    -webkit-backdrop-filter: blur(10px) brightness(0.85);
    /* Acima do modal do Bootstrap (1055): o Ctrl+K também abre com um modal aberto. */
    z-index: 1060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal Container */
.occ-cp-container {
    width: 100%;
    max-width: 650px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: occCpFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Dark mode overrides (if parent has data-color-theme="dark" or similar).
   Tokenizado em 2026-08-11: os hex slate literais (#1e293b, #334155, #475569)
   sobreviveram a retuna da rampa dark e deixavam o Ctrl+K azul no meio de uma
   interface grafite. Agora seguem --occ-surface / --occ-surface-2 / --occ-line*. */
[data-color-theme="dark"] .occ-cp-container,
html[data-color-theme="dark"] .occ-cp-container {
    background: var(--occ-surface);
    border-color: var(--occ-line-strong);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

@keyframes occCpFadeIn {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Top search bar */
.occ-cp-search-bar {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
}

[data-color-theme="dark"] .occ-cp-search-bar,
html[data-color-theme="dark"] .occ-cp-search-bar {
    border-bottom-color: rgba(51, 65, 85, 0.8);
}

.occ-cp-search-icon {
    font-size: 20px;
    color: #64748b;
    margin-right: 14px;
    flex-shrink: 0;
}

.occ-cp-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #0f172a;
    outline: none;
    padding: 0;
}

[data-color-theme="dark"] .occ-cp-input,
html[data-color-theme="dark"] .occ-cp-input {
    color: #f1f5f9;
}

.occ-cp-input::placeholder {
    color: #94a3b8;
}

.occ-cp-shortcut-hint {
    font-size: 11px;
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    text-transform: uppercase;
    font-weight: 600;
}

[data-color-theme="dark"] .occ-cp-shortcut-hint,
html[data-color-theme="dark"] .occ-cp-shortcut-hint {
    background: var(--occ-surface-2);
    color: var(--occ-ink-soft);
    border-color: var(--occ-line-strong);
}

/* Scrollable Results */
.occ-cp-results {
    max-height: 440px;
    overflow-y: auto;
    padding: 8px;
}

/* Category header */
.occ-cp-category {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
    padding: 8px 12px 4px 12px;
}

/* Result item */
.occ-cp-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease, color 0.12s ease;
    margin-bottom: 2px;
    color: #334155;
    text-decoration: none;
}

[data-color-theme="dark"] .occ-cp-item,
html[data-color-theme="dark"] .occ-cp-item {
    color: #cbd5e1;
}

.occ-cp-item i {
    font-size: 18px;
    margin-right: 12px;
    color: #64748b;
    flex-shrink: 0;
}

.occ-cp-item-details {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.occ-cp-item-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
}

.occ-cp-item-subtitle {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

[data-color-theme="dark"] .occ-cp-item-subtitle,
html[data-color-theme="dark"] .occ-cp-item-subtitle {
    color: #94a3b8;
}

/* Status Badges */
.occ-cp-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    flex-shrink: 0;
}

.occ-cp-badge--success {
    background-color: #dcfce7;
    color: #15803d;
}

[data-color-theme="dark"] .occ-cp-badge--success,
html[data-color-theme="dark"] .occ-cp-badge--success {
    background-color: rgba(21, 128, 61, 0.2);
    color: #4ade80;
}

.occ-cp-badge--info {
    background-color: #dbeafe;
    color: #1d4ed8;
}

[data-color-theme="dark"] .occ-cp-badge--info,
html[data-color-theme="dark"] .occ-cp-badge--info {
    background-color: rgba(29, 78, 216, 0.2);
    color: #60a5fa;
}

.occ-cp-badge--neutral {
    background-color: #f1f5f9;
    color: #475569;
}

[data-color-theme="dark"] .occ-cp-badge--neutral,
html[data-color-theme="dark"] .occ-cp-badge--neutral {
    background-color: rgba(71, 85, 105, 0.2);
    color: #cbd5e1;
}

/* Cancelada e no-show: âmbar, não vermelho — é uma situação, não uma ação que destrói. */
.occ-cp-badge--alerta {
    background-color: #fef3c7;
    color: #b45309;
}

[data-color-theme="dark"] .occ-cp-badge--alerta,
html[data-color-theme="dark"] .occ-cp-badge--alerta {
    background-color: rgba(180, 83, 9, 0.2);
    color: #fbbf24;
}

/* Hint de ação à direita do item. Uma única casca de pílula para TODOS os
   tipos (atalho, ação, estadia) — só o de estadia é clicável e ganha caret.
   display:none aqui; a regra de hover/ativo abaixo revela como inline-flex. */
.occ-cp-item-action-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid transparent;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #94a3b8;
    white-space: nowrap;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

/* Hover and Highlight styles */
.occ-cp-item:hover,
.occ-cp-item.occ-cp-item--active {
    background-color: #f8fafc;
    color: #0f172a;
}

[data-color-theme="dark"] .occ-cp-item:hover,
[data-color-theme="dark"] .occ-cp-item.occ-cp-item--active,
html[data-color-theme="dark"] .occ-cp-item:hover,
html[data-color-theme="dark"] .occ-cp-item.occ-cp-item--active {
    background-color: var(--occ-surface-2);
    color: var(--occ-ink);
}

.occ-cp-item:hover i,
.occ-cp-item.occ-cp-item--active i {
    color: var(--occ-accent);
}

/* Sempre visível (senão ninguém descobre que há menu), porém apagado; o item
   sob o mouse/ativo é que ganha a pílula preenchida. */
.occ-cp-item:hover .occ-cp-item-action-hint,
.occ-cp-item.occ-cp-item--active .occ-cp-item-action-hint {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.22);
    color: #64748b;
}

/* Empty State / Loading State */
.occ-cp-empty,
.occ-cp-loading {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

.occ-cp-empty i,
.occ-cp-loading i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    color: #94a3b8;
}

/* Footer panel */
.occ-cp-footer {
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

[data-color-theme="dark"] .occ-cp-footer,
html[data-color-theme="dark"] .occ-cp-footer {
    background: var(--occ-surface);
    border-top-color: var(--occ-line);
    color: var(--occ-ink-soft);
}

.occ-cp-footer kbd {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
    color: #334155;
    font-size: 9px;
    padding: 1px 3px;
    font-family: inherit;
    margin: 0 2px;
}

[data-color-theme="dark"] .occ-cp-footer kbd,
html[data-color-theme="dark"] .occ-cp-footer kbd {
    background: var(--occ-surface-2);
    border-color: var(--occ-line-strong);
    color: var(--occ-ink);
}

/* ── Exact Match highlighting ── */
.occ-cp-item--exact {
    border-left: 3px solid var(--occ-accent);
    padding-left: 9px;
    background-color: rgba(13, 148, 136, 0.04);
}

[data-color-theme="dark"] .occ-cp-item--exact,
html[data-color-theme="dark"] .occ-cp-item--exact {
    background-color: rgba(13, 148, 136, 0.08);
}

.occ-cp-item--exact:hover,
.occ-cp-item--exact.occ-cp-item--active {
    background-color: rgba(13, 148, 136, 0.08);
}

[data-color-theme="dark"] .occ-cp-item--exact:hover,
[data-color-theme="dark"] .occ-cp-item--exact.occ-cp-item--active,
html[data-color-theme="dark"] .occ-cp-item--exact:hover,
html[data-color-theme="dark"] .occ-cp-item--exact.occ-cp-item--active {
    background-color: rgba(13, 148, 136, 0.15);
}

/* ── Text highlight (search match) ── */
.occ-cp-item mark {
    background-color: rgba(250, 204, 21, 0.35);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
}

[data-color-theme="dark"] .occ-cp-item mark,
html[data-color-theme="dark"] .occ-cp-item mark {
    background-color: rgba(250, 204, 21, 0.2);
}


/* ── Menu de destinos do item (Lançar consumo / Estadia / Extrato / ...) ──
   Expansão inline em vez de dropdown flutuante: .occ-cp-results tem
   overflow-y:auto e recortaria um menu absoluto. Flutuante exigiria
   position:fixed calculado em JS + reposicionamento no scroll. */
.occ-cp-item-wrap {
    position: relative;
}

/* Só o que o gatilho ACRESCENTA à pílula base: ser clicável e ter o caret.
   Casca (padding, fundo, borda, tipografia) vem de .occ-cp-item-action-hint. */
.occ-cp-item-action-hint--menu {
    cursor: pointer;
    padding-right: 8px;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

/* line-height 1 + block: herdando o line-height do texto, o glifo da Phosphor
   ganha folga acima/abaixo e desce em relação à palavra */
.occ-cp-item-action-hint--menu i {
    display: block;
    font-size: 11px;
    line-height: 1;
    color: inherit;
    transition: transform 0.15s ease;
}

.occ-cp-item-action-hint--menu:hover,
.occ-cp-item-action-hint--menu[aria-expanded="true"] {
    background: var(--occ-accent-soft);
    border-color: var(--occ-accent);
    color: var(--occ-accent);
}

/* O gatilho recebe foco ao ser clicado e o browser desenha o próprio anel
   preto por cima da pílula. Anel só no foco por teclado, na cor da marca. */
.occ-cp-item-action-hint--menu:focus {
    outline: none;
}

.occ-cp-item-action-hint--menu:focus-visible {
    outline: 2px solid var(--occ-accent);
    outline-offset: 2px;
}

/* Menu aberto mantém o gatilho visível mesmo sem hover no item */
.occ-cp-item-action-hint--menu[aria-expanded="true"] {
    display: inline-flex;
}

.occ-cp-item-action-hint--menu[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Painel: cartão fechado nos 4 lados. A borda-esquerda solta lia como
   indent-guide de treeview — principal responsável pelo ar de app antigo. */
/* Largura do conteúdo e ancorado à DIREITA, embaixo do gatilho que o abriu —
   esticado na largura do item ele vira uma faixa vazia (o conteúdo é curto). */
.occ-cp-actions {
    display: grid;
    gap: 2px;
    width: max-content;
    min-width: 232px;
    max-width: 340px;
    margin: 3px 10px 8px auto;
    padding: 5px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    position: relative;
}

.occ-cp-actions::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 26px;
    width: 8px;
    height: 8px;
    background: #f1f5f9;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    transform: rotate(45deg);
}

.occ-cp-actions[hidden] {
    display: none;
}

.occ-cp-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.25;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.1s ease, color 0.1s ease;
}

.occ-cp-action i {
    font-size: 15px;
    width: 16px;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
    color: #94a3b8;
    transition: color 0.1s ease;
}

/* Marca a ação que o Enter já executa — explica por que ela se repete aqui */
.occ-cp-action kbd {
    margin-left: auto;
    font-family: inherit;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .02em;
    padding: 2px 5px;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
}

.occ-cp-action:hover,
.occ-cp-action:focus {
    background: #ffffff;
    color: #0f172a;
    outline: none;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.occ-cp-action:hover i,
.occ-cp-action:focus i {
    color: var(--occ-accent);
}

[data-color-theme="dark"] .occ-cp-item-action-hint,
html[data-color-theme="dark"] .occ-cp-item-action-hint {
    color: var(--occ-ink-faint);
}

[data-color-theme="dark"] .occ-cp-item:hover .occ-cp-item-action-hint,
[data-color-theme="dark"] .occ-cp-item.occ-cp-item--active .occ-cp-item-action-hint,
html[data-color-theme="dark"] .occ-cp-item:hover .occ-cp-item-action-hint,
html[data-color-theme="dark"] .occ-cp-item.occ-cp-item--active .occ-cp-item-action-hint {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.22);
    color: var(--occ-ink-soft);
}

/* preto puro em vez do slate rgba(15,23,42,.4): o recuo continua lendo como
   recuo, sem lancar matiz sobre a superficie quente atras */
[data-color-theme="dark"] .occ-cp-actions,
html[data-color-theme="dark"] .occ-cp-actions {
    background: rgba(0, 0, 0, 0.28);
    border-color: rgba(148, 163, 184, 0.16);
}

[data-color-theme="dark"] .occ-cp-actions::before,
html[data-color-theme="dark"] .occ-cp-actions::before {
    background: rgba(0, 0, 0, 0.28);
    border-color: rgba(148, 163, 184, 0.16);
}

[data-color-theme="dark"] .occ-cp-action,
html[data-color-theme="dark"] .occ-cp-action {
    color: #cbd5e1;
}

[data-color-theme="dark"] .occ-cp-action i,
html[data-color-theme="dark"] .occ-cp-action i {
    color: #64748b;
}

[data-color-theme="dark"] .occ-cp-action kbd,
html[data-color-theme="dark"] .occ-cp-action kbd {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

[data-color-theme="dark"] .occ-cp-action:hover,
[data-color-theme="dark"] .occ-cp-action:focus,
html[data-color-theme="dark"] .occ-cp-action:hover,
html[data-color-theme="dark"] .occ-cp-action:focus {
    background: rgba(148, 163, 184, 0.14);
    color: #f8fafc;
    box-shadow: none;
}

[data-color-theme="dark"] .occ-cp-action:hover i,
[data-color-theme="dark"] .occ-cp-action:focus i,
html[data-color-theme="dark"] .occ-cp-action:hover i,
html[data-color-theme="dark"] .occ-cp-action:focus i {
    color: var(--occ-accent);
}

/* Entrada suave onde houver suporte; sem ele, mostra/esconde como antes */
@supports (transition-behavior: allow-discrete) {
    .occ-cp-actions {
        transition: opacity 0.14s ease, transform 0.14s ease, display 0.14s allow-discrete;
    }

    .occ-cp-actions[hidden] {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }

    @starting-style {
        .occ-cp-actions:not([hidden]) {
            opacity: 0;
            transform: translateY(-4px) scale(0.98);
        }
    }
}
