/* ==========================================================================
   Global Command Palette Stylesheet (assets/css/components/command-palette.css)
   Pure Vanilla CSS Floating Quick Launcher (Ctrl+K / ?)
   ========================================================================== */

/* --- Overlay Backdrop --- */
.cmd-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4rem 1rem 2rem 1rem;
}

.cmd-palette-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: cmdFadeIn 0.15s ease-out forwards;
}

/* --- Dialog Container --- */
.cmd-palette-dialog {
    position: relative;
    width: 100%;
    max-width: 640px;
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 1.25rem;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 10;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    animation: cmdScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="dark"] .cmd-palette-dialog,
.dark .cmd-palette-dialog {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6);
}

@keyframes cmdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cmdScaleUp {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --- Search Header --- */
.cmd-palette-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    background: var(--color-surface, #ffffff);
}

[data-theme="dark"] .cmd-palette-header,
.dark .cmd-palette-header {
    background: #1e293b;
    border-bottom-color: #334155;
}

.cmd-search-icon {
    font-size: 1.2rem;
    color: var(--color-primary, #4f46e5);
    flex-shrink: 0;
}

.cmd-search-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--color-text-main, #0f172a);
    outline: none;
}

.cmd-search-input::placeholder {
    color: var(--color-text-muted, #94a3b8);
    font-weight: 400;
}

[data-theme="dark"] .cmd-search-input,
.dark .cmd-search-input {
    color: #f8fafc;
}

.cmd-kbd-esc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.55rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text-muted, #64748b);
    border: 1px solid var(--color-border, #cbd5e1);
    cursor: pointer;
    flex-shrink: 0;
}

[data-theme="dark"] .cmd-kbd-esc,
.dark .cmd-kbd-esc {
    background: rgba(255, 255, 255, 0.08);
    border-color: #475569;
    color: #94a3b8;
}

/* --- Category Filter Tabs --- */
.cmd-filter-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: var(--color-background, #f8fafc);
    border-bottom: 1px solid var(--color-border, #e2e8f0);
}

[data-theme="dark"] .cmd-filter-tabs,
.dark .cmd-filter-tabs {
    background: #0f172a;
    border-bottom-color: #334155;
}

.cmd-tab-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cmd-tab-btn:hover {
    color: var(--color-text-main, #1e293b);
    background: rgba(0, 0, 0, 0.05);
}

.cmd-tab-btn.active {
    background: var(--color-primary, #4f46e5);
    color: #ffffff;
}

/* --- Results List --- */
.cmd-palette-body {
    overflow-y: auto;
    padding: 0.75rem 0.5rem;
    flex-grow: 1;
}

.cmd-group-title {
    font-size: 0.6875rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted, #94a3b8);
    padding: 0.65rem 1rem 0.35rem 1rem;
}

.cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin: 0.15rem 0;
    border-radius: 0.65rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.cmd-item:hover,
.cmd-item.is-selected {
    background: rgba(79, 70, 229, 0.08);
}

[data-theme="dark"] .cmd-item:hover,
[data-theme="dark"] .cmd-item.is-selected,
.dark .cmd-item:hover,
.dark .cmd-item.is-selected {
    background: rgba(129, 140, 248, 0.15);
}

.cmd-item-left {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.cmd-item-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.icon-blue   { background: rgba(37, 99, 235, 0.12); color: #2563eb; }
.icon-purple { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.icon-teal   { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.icon-amber  { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.icon-rose   { background: rgba(225, 29, 72, 0.12); color: #e11d48; }
.icon-emerald{ background: rgba(16, 185, 129, 0.12); color: #059669; }

.cmd-item-text {
    display: flex;
    flex-direction: column;
}

.cmd-item-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--color-text-main, #0f172a);
}

[data-theme="dark"] .cmd-item-title,
.dark .cmd-item-title {
    color: #f8fafc;
}

.cmd-item-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted, #64748b);
    margin-top: 0.1rem;
}

.cmd-item-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 0.35rem;
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-muted, #64748b);
}

[data-theme="dark"] .cmd-item-badge,
.dark .cmd-item-badge {
    background: rgba(255, 255, 255, 0.07);
    color: #94a3b8;
}

.cmd-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--color-text-muted, #94a3b8);
}

.cmd-empty-state i {
    font-size: 2.25rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
    display: block;
}

/* --- Palette Footer --- */
.cmd-palette-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--color-background, #f8fafc);
    border-top: 1px solid var(--color-border, #e2e8f0);
    font-size: 0.75rem;
    color: var(--color-text-muted, #64748b);
}

[data-theme="dark"] .cmd-palette-footer,
.dark .cmd-palette-footer {
    background: #0f172a;
    border-top-color: #334155;
    color: #94a3b8;
}

.cmd-footer-hints {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cmd-footer-hints kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.35rem;
    border-radius: 0.25rem;
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #cbd5e1);
    font-size: 0.6875rem;
    font-family: inherit;
    font-weight: 700;
    margin-right: 0.2rem;
}

[data-theme="dark"] .cmd-footer-hints kbd,
.dark .cmd-footer-hints kbd {
    background: #1e293b;
    border-color: #475569;
}

/* --- Header Shortcut Button Tag --- */
.header-cmd-palette-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 0.5rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-cmd-palette-btn:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: var(--color-primary, #4f46e5);
    color: var(--color-primary, #4f46e5);
}

[data-theme="dark"] .header-cmd-palette-btn,
.dark .header-cmd-palette-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: #334155;
    color: #cbd5e1;
}

@media (max-width: 640px) {
    .cmd-footer-brand {
        display: none;
    }
}
