/* Command Palette Styles */

.command-palette-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.command-palette-backdrop.show {
    opacity: 1;
}

.command-palette {
    position: fixed;
    top: 10vh;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    background: var(--bs-body-bg);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--bs-border-color);
    overflow: hidden;
}

.command-palette.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.command-palette-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
    background: var(--bs-body-bg);
    position: relative;
    z-index: 1;
}

.command-palette-icon {
    font-size: 20px;
    color: var(--bs-secondary);
}

.command-palette-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    color: var(--bs-body-color);
}

.command-palette-input::placeholder {
    color: var(--bs-secondary);
}

.command-palette-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--bs-secondary);
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.command-palette-body {
    flex: 1;
    min-height: 0;
    max-height: calc(80vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

/* Visible scrollbar styling */
.command-palette-body::-webkit-scrollbar {
    width: 8px;
}

.command-palette-body::-webkit-scrollbar-track {
    background: transparent;
}

.command-palette-body::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
    opacity: 0.5;
}

.command-palette-body::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary);
    opacity: 0.8;
}

.command-palette-results {
    padding: 8px;
}

.command-palette-section {
    margin-bottom: 8px;
}

.command-palette-section-title {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--bs-secondary);
    letter-spacing: 0.5px;
}

.command-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--bs-body-color);
}

.command-palette-item.selected {
    background: var(--bs-primary);
    color: white;
}

.command-palette-item.selected .command-palette-item-type,
.command-palette-item.selected .command-palette-item-separator,
.command-palette-item.selected .command-palette-item-meta span {
    color: rgba(255, 255, 255, 0.8);
}

.command-palette-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--bs-secondary-bg);
    font-size: 18px;
    flex-shrink: 0;
}

.command-palette-item.selected .command-palette-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

.command-palette-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette-item-title mark {
    background: var(--bs-warning);
    color: var(--bs-dark);
    padding: 0 2px;
    border-radius: 2px;
}

.command-palette-item.selected .command-palette-item-title mark {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.command-palette-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--bs-secondary);
}

.command-palette-item-type {
    font-weight: 600;
}

.command-palette-item-separator {
    opacity: 0.5;
}

.command-palette-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--bs-secondary);
}

.command-palette-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.command-palette-empty p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.command-palette-empty small {
    font-size: 13px;
    opacity: 0.7;
}

.command-palette-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-secondary-bg);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.command-palette-footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--bs-secondary);
}

.command-palette-footer kbd {
    min-width: 24px;
}

/* Dark mode adjustments */
[data-bs-theme="dark"] .command-palette {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-bs-theme="dark"] .command-palette-backdrop {
    background: rgba(0, 0, 0, 0.7);
}

/* Scrollbar styling */
.command-palette-body::-webkit-scrollbar {
    width: 8px;
}

.command-palette-body::-webkit-scrollbar-track {
    background: transparent;
}

.command-palette-body::-webkit-scrollbar-thumb {
    background: var(--bs-border-color);
    border-radius: 4px;
}

.command-palette-body::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .command-palette {
        top: 10vh;
        width: 95%;
        max-height: 80vh;
    }
    
    .command-palette-footer {
        display: none;
    }
}

/* Animation for result items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.command-palette-item {
    animation: slideIn 0.15s ease backwards;
}

.command-palette-item:nth-child(1) { animation-delay: 0ms; }
.command-palette-item:nth-child(2) { animation-delay: 30ms; }
.command-palette-item:nth-child(3) { animation-delay: 60ms; }
.command-palette-item:nth-child(4) { animation-delay: 90ms; }
.command-palette-item:nth-child(5) { animation-delay: 120ms; }
