/* command-palette.css - Command Palette (⌘K) Styles */

/* Overlay */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.command-palette-overlay.active {
    opacity: 1;
}

/* Modal */
.command-palette-modal {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 640px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.command-palette-overlay.active .command-palette-modal {
    transform: scale(1) translateY(0);
}

/* Header */
.command-palette-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.search-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.command-palette-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: 'Open Sans', sans-serif;
    color: #1F2937;
    background: transparent;
}

.command-palette-input::placeholder {
    color: #9CA3AF;
}

.close-hint {
    font-size: 11px;
    color: #9CA3AF;
    padding: 4px 8px;
    background: #F3F4F6;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
}

/* Results Container */
.command-palette-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 200px;
    max-height: 400px;
}

/* Custom scrollbar */
.command-palette-results::-webkit-scrollbar {
    width: 8px;
}

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

.command-palette-results::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.command-palette-results::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Category Headers */
.command-category {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #9CA3AF;
    text-transform: uppercase;
    padding: 12px 20px 8px;
    margin-top: 8px;
}

.command-category:first-child {
    margin-top: 0;
}

/* Command Item */
.command-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.command-item:hover {
    background: #F9FAFB;
}

.command-item.selected {
    background: linear-gradient(135deg,
        rgba(139, 126, 200, 0.1),
        rgba(127, 176, 105, 0.1)
    );
}

.command-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #8B7EC8, #7FB069);
    border-radius: 0 2px 2px 0;
}

/* Command Icon */
.command-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: linear-gradient(135deg,
        rgba(139, 126, 200, 0.1),
        rgba(127, 176, 105, 0.1)
    );
    border-radius: 8px;
}

.command-item.selected .command-icon {
    background: linear-gradient(135deg,
        rgba(139, 126, 200, 0.2),
        rgba(127, 176, 105, 0.2)
    );
}

/* Command Content */
.command-content {
    flex: 1;
    min-width: 0;
}

.command-title {
    font-size: 14px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 2px;
}

.command-subtitle {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Command Shortcut */
.command-shortcut {
    font-size: 11px;
    color: #9CA3AF;
    font-family: 'SF Mono', 'Monaco', monospace;
    padding: 4px 8px;
    background: #F3F4F6;
    border-radius: 4px;
    flex-shrink: 0;
}

.command-item.selected .command-shortcut {
    background: var(--white);
    color: #6B7280;
}

/* Empty State */
.command-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

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

.empty-text {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    color: #6B7280;
}

/* Footer */
.command-palette-footer {
    border-top: 1px solid #E5E7EB;
    padding: 12px 20px;
    background: #F9FAFB;
}

.footer-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #6B7280;
}

.footer-hint kbd {
    display: inline-block;
    padding: 3px 6px;
    background: var(--white);
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-family: 'SF Mono', 'Monaco', monospace;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.command-item:nth-child(1) { animation-delay: 0.02s; }
.command-item:nth-child(2) { animation-delay: 0.04s; }
.command-item:nth-child(3) { animation-delay: 0.06s; }
.command-item:nth-child(4) { animation-delay: 0.08s; }
.command-item:nth-child(5) { animation-delay: 0.10s; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .command-palette-overlay,
    .command-palette-modal,
    .command-item {
        animation: none;
        transition: none;
    }

    .command-item {
        animation: none;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .command-palette-overlay {
        padding-top: 5vh;
    }

    .command-palette-modal {
        width: 95%;
        max-height: 80vh;
    }

    .command-palette-header {
        padding: 14px 16px;
    }

    .command-palette-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .command-item {
        padding: 12px 16px;
    }

    .command-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .command-title {
        font-size: 14px;
    }

    .command-subtitle {
        font-size: 12px;
    }

    .command-shortcut {
        display: none; /* Hide shortcuts on mobile */
    }

    .footer-hint {
        font-size: 11px;
        gap: 8px;
    }

    .footer-hint kbd {
        padding: 2px 5px;
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .command-palette-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        padding-top: 0;
    }

    .command-palette-overlay {
        padding-top: 0;
    }

    .command-palette-results {
        max-height: none;
    }
}

/* Focus visible for accessibility */
.command-palette-input:focus-visible {
    outline: none;
}

.command-item:focus-visible {
    outline: 2px solid #8B7EC8;
    outline-offset: -2px;
}
