/* Command Palette */
.cmd-palette-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
}

.cmd-palette-overlay.open {
    display: flex;
}

.cmd-palette {
    width: 90%;
    max-width: 560px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: cmdSlideDown 0.15s ease-out;
}

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

.cmd-palette-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid #e8e8e8;
    color: #999;
}

.cmd-palette-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: #333;
}

.cmd-palette-input::placeholder {
    color: #aaa;
}

.cmd-palette-kbd {
    font-size: 0.7rem;
    padding: 2px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #999;
    background: #f5f5f5;
    font-family: monospace;
}

.cmd-palette-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 360px;
    overflow-y: auto;
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
}

.cmd-palette-item:hover,
.cmd-palette-item.active {
    background: color-mix(in srgb, var(--brand-primary, #4CAF50) 10%, white);
}

.cmd-palette-item.active {
    background: color-mix(in srgb, var(--brand-primary, #4CAF50) 14%, white);
}

.cmd-palette-item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-primary, #4CAF50);
    background: color-mix(in srgb, var(--brand-primary, #4CAF50) 8%, white);
    border-radius: 8px;
    flex-shrink: 0;
}

.cmd-palette-item-icon svg {
    width: 18px;
    height: 18px;
}

.cmd-palette-item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cmd-palette-item-text strong {
    font-size: 0.92rem;
    color: #333;
    font-weight: 600;
}

.cmd-palette-item-text span {
    font-size: 0.8rem;
    color: #888;
}

.cmd-palette-footer {
    padding: 8px 16px;
    border-top: 1px solid #e8e8e8;
    font-size: 0.75rem;
    color: #aaa;
    text-align: center;
}

.cmd-palette-footer kbd {
    font-size: 0.7rem;
    padding: 1px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f5f5f5;
    font-family: monospace;
    margin: 0 1px;
}

/* Dark Mode */
body.dark-mode .cmd-palette {
    background: #1e1e1e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

body.dark-mode .cmd-palette-header {
    border-bottom-color: #333;
}

body.dark-mode .cmd-palette-input {
    color: #f0f0f0;
}

body.dark-mode .cmd-palette-input::placeholder {
    color: #666;
}

body.dark-mode .cmd-palette-kbd {
    border-color: #444;
    background: #2d2d2d;
    color: #888;
}

body.dark-mode .cmd-palette-item:hover,
body.dark-mode .cmd-palette-item.active {
    background: color-mix(in srgb, var(--brand-primary, #4CAF50) 12%, #1e1e1e);
}

body.dark-mode .cmd-palette-item-icon {
    background: color-mix(in srgb, var(--brand-primary, #4CAF50) 15%, #1e1e1e);
}

body.dark-mode .cmd-palette-item-text strong {
    color: #f0f0f0;
}

body.dark-mode .cmd-palette-item-text span {
    color: #888;
}

body.dark-mode .cmd-palette-footer {
    border-top-color: #333;
    color: #666;
}

body.dark-mode .cmd-palette-footer kbd {
    border-color: #444;
    background: #2d2d2d;
}

/* Forest Theme */
body.theme-forest .cmd-palette { background: #1a2418; }
body.theme-forest .cmd-palette-header { border-bottom-color: #3d5235; }
body.theme-forest .cmd-palette-input { color: #b8d4a8; }
body.theme-forest .cmd-palette-input::placeholder { color: #5a7a4a; }
body.theme-forest .cmd-palette-kbd { border-color: #3d5235; background: #243020; color: #8aaa78; }
body.theme-forest .cmd-palette-item:hover,
body.theme-forest .cmd-palette-item.active { background: rgba(90, 158, 75, 0.12); }
body.theme-forest .cmd-palette-item-icon { background: rgba(90, 158, 75, 0.15); }
body.theme-forest .cmd-palette-item-text strong { color: #b8d4a8; }
body.theme-forest .cmd-palette-item-text span { color: #8aaa78; }
body.theme-forest .cmd-palette-footer { border-top-color: #3d5235; color: #5a7a4a; }
body.theme-forest .cmd-palette-footer kbd { border-color: #3d5235; background: #243020; }

/* Ocean Theme */
body.theme-ocean .cmd-palette { background: #141e2e; }
body.theme-ocean .cmd-palette-header { border-bottom-color: #2e4460; }
body.theme-ocean .cmd-palette-input { color: #a0c4e8; }
body.theme-ocean .cmd-palette-input::placeholder { color: #4a6a88; }
body.theme-ocean .cmd-palette-kbd { border-color: #2e4460; background: #1c2636; color: #7a9ab8; }
body.theme-ocean .cmd-palette-item:hover,
body.theme-ocean .cmd-palette-item.active { background: rgba(59, 130, 196, 0.12); }
body.theme-ocean .cmd-palette-item-icon { background: rgba(59, 130, 196, 0.15); }
body.theme-ocean .cmd-palette-item-text strong { color: #a0c4e8; }
body.theme-ocean .cmd-palette-item-text span { color: #7a9ab8; }
body.theme-ocean .cmd-palette-footer { border-top-color: #2e4460; color: #4a6a88; }
body.theme-ocean .cmd-palette-footer kbd { border-color: #2e4460; background: #1c2636; }

/* Slate Theme */
body.theme-slate .cmd-palette { background: #f5f0e8; }
body.theme-slate .cmd-palette-header { border-bottom-color: #c8bfb0; }
body.theme-slate .cmd-palette-input { color: #504840; }
body.theme-slate .cmd-palette-input::placeholder { color: #a09888; }
body.theme-slate .cmd-palette-kbd { border-color: #c8bfb0; background: #ebe5da; color: #8b7d6b; }
body.theme-slate .cmd-palette-item:hover,
body.theme-slate .cmd-palette-item.active { background: rgba(139, 125, 107, 0.1); }
body.theme-slate .cmd-palette-item-icon { background: rgba(139, 125, 107, 0.12); }
body.theme-slate .cmd-palette-item-text strong { color: #504840; }
body.theme-slate .cmd-palette-item-text span { color: #8b7d6b; }
body.theme-slate .cmd-palette-footer { border-top-color: #c8bfb0; color: #a09888; }
body.theme-slate .cmd-palette-footer kbd { border-color: #c8bfb0; background: #ebe5da; }

/* Sunset Theme */
body.theme-sunset .cmd-palette { background: #fff5f0; }
body.theme-sunset .cmd-palette-header { border-bottom-color: #e0bfb0; }
body.theme-sunset .cmd-palette-input { color: #6b3f35; }
body.theme-sunset .cmd-palette-input::placeholder { color: #c09888; }
body.theme-sunset .cmd-palette-kbd { border-color: #e0bfb0; background: #faeee8; color: #a06858; }
body.theme-sunset .cmd-palette-item:hover,
body.theme-sunset .cmd-palette-item.active { background: rgba(212, 130, 106, 0.1); }
body.theme-sunset .cmd-palette-item-icon { background: rgba(212, 130, 106, 0.12); }
body.theme-sunset .cmd-palette-item-text strong { color: #6b3f35; }
body.theme-sunset .cmd-palette-item-text span { color: #a06858; }
body.theme-sunset .cmd-palette-footer { border-top-color: #e0bfb0; color: #c09888; }
body.theme-sunset .cmd-palette-footer kbd { border-color: #e0bfb0; background: #faeee8; }

/* Responsive */
@media (max-width: 600px) {
    .cmd-palette-overlay { padding-top: 8vh; }
    .cmd-palette { width: 95%; }
}
