@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.command-palette {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.command-palette.is-active {
    opacity: 1;
    pointer-events: auto;
}

.command-palette-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease-out;
}

.command-palette-container {
    position: relative;
    width: 90%;
    max-width: 680px;
    background: white;
    border-radius: 16px;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 40px 60px -20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    transform: scale(0.95) translateY(-10px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.command-palette.is-active .command-palette-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.command-palette-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 14px;
    background: linear-gradient(to bottom, #ffffff, #fafafa);
}

.command-palette-icon {
    color: #6b7280;
    font-size: 20px;
    animation: fadeIn 0.3s ease-out 0.1s backwards;
}

.command-palette-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 17px;
    color: #1f2937;
    background: transparent;
    font-weight: 400;
    position: relative;
}

.command-palette-input::after {
    content: var(--autocomplete-text, "");
    position: absolute;
    left: 0;
    color: #9ca3af;
    pointer-events: none;
    opacity: 0.5;
}

.command-palette-input::placeholder {
    color: #9ca3af;
}

.command-palette-hint {
    background: linear-gradient(to bottom, #ffffff, #f3f4f6);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #6b7280;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-out 0.2s backwards;
}

.command-palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    min-height: 200px;
}

.command-palette-results::-webkit-scrollbar {
    width: 10px;
}

.command-palette-results::-webkit-scrollbar-track {
    background: transparent;
}

.command-palette-results::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #d1d5db, #9ca3af);
    border-radius: 10px;
    border: 2px solid white;
}

.command-palette-results::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #9ca3af, #6b7280);
}

.command-palette-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #9ca3af;
    text-align: center;
}

.command-palette-empty i {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.4;
    background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.command-palette-empty p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
}

.command-palette-category {
    padding: 12px 16px 6px;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    animation: fadeIn 0.3s ease-out backwards;
}

.command-palette-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 14px;
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out backwards;
}

.command-palette-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.command-palette-item:hover::before {
    left: 100%;
}

.command-palette-item:hover {
    background: linear-gradient(to right, #f9fafb, #f3f4f6);
    transform: translateX(4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.command-palette-item.is-selected {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    transform: translateX(4px) scale(1.02);
    box-shadow: 
        0 4px 6px -1px rgba(59, 130, 246, 0.3),
        0 2px 4px -1px rgba(59, 130, 246, 0.2),
        0 0 0 3px rgba(59, 130, 246, 0.1);
}

.command-palette-item-icon-wrapper {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 8px;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.command-palette-item.is-selected .command-palette-item-icon-wrapper {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.command-palette-item-icon {
    color: #6b7280;
    font-size: 16px;
    transition: all 0.2s;
}

.command-palette-item.is-selected .command-palette-item-icon {
    color: white;
    transform: scale(1.1);
}

.command-palette-item-content {
    flex: 1;
    min-width: 0;
}

.command-palette-item-title {
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.command-palette-item.is-selected .command-palette-item-title {
    color: white;
}

.command-palette-item-title mark {
    background: linear-gradient(to right, #fef3c7, #fde68a);
    color: #92400e;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.command-palette-item.is-selected .command-palette-item-title mark {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.command-palette-item-url {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.command-palette-item.is-selected .command-palette-item-url {
    color: rgba(255, 255, 255, 0.8);
}

.command-palette-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.command-palette-item:hover .command-palette-item-meta,
.command-palette-item.is-selected .command-palette-item-meta {
    opacity: 1;
    transform: translateX(0);
}

.command-palette-item-shortcut {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 12px;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.command-palette-item:not(.is-selected) .command-palette-item-shortcut {
    background: linear-gradient(to bottom, #ffffff, #f3f4f6);
    border-color: #e5e7eb;
    color: #6b7280;
}

.command-palette-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 14px 24px;
    background: linear-gradient(to top, #fafafa, #ffffff);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.command-palette-shortcuts {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: #6b7280;
    justify-content: center;
}

.command-palette-shortcuts kbd {
    background: linear-gradient(to bottom, #ffffff, #f3f4f6);
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 3px 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    margin: 0 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 500;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .command-palette-container {
        background: #1f2937;
        box-shadow: 
            0 0 0 1px rgba(255, 255, 255, 0.1),
            0 10px 15px -3px rgba(0, 0, 0, 0.5),
            0 4px 6px -2px rgba(0, 0, 0, 0.3),
            0 20px 25px -5px rgba(0, 0, 0, 0.4);
    }
    
    .command-palette-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
        background: linear-gradient(to bottom, #1f2937, #111827);
    }
    
    .command-palette-input {
        color: #f3f4f6;
    }
    
    .command-palette-hint {
        background: linear-gradient(to bottom, #374151, #1f2937);
        border-color: #4b5563;
        color: #9ca3af;
    }
    
    .command-palette-item-title {
        color: #f3f4f6;
    }
    
    .command-palette-item:hover {
        background: linear-gradient(to right, #374151, #4b5563);
    }
    
    .command-palette-item-icon-wrapper {
        background: linear-gradient(135deg, #374151, #1f2937);
    }
    
    .command-palette-footer {
        background: linear-gradient(to top, #111827, #1f2937);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
    
    .command-palette-shortcuts kbd {
        background: linear-gradient(to bottom, #374151, #1f2937);
        border-color: #4b5563;
    }
}
