/**
 * Command Palette Styles
 * Spotlight/Raycast-style quick access interface
 */

/* Overlay */
.command-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10001;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.command-palette-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.command-palette-modal {
    width: 100%;
    max-width: 640px;
    margin: 0 1rem;
    background: linear-gradient(135deg, rgba(15, 20, 28, 0.98) 0%, rgba(22, 28, 40, 0.98) 100%);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(139, 92, 246, 0.1),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.96) translateY(-10px);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.command-palette-overlay.active .command-palette-modal {
    transform: scale(1) translateY(0);
}

/* Header / Search */
.command-palette-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
}

.command-palette-search {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(14, 22, 36, 0.7);
    border: 1.5px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.command-palette-search:focus-within {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.command-palette-search .search-icon {
    color: rgba(148, 163, 184, 0.7);
    flex-shrink: 0;
}

.command-palette-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #f4f4f5;
    font-size: 1.125rem;
    font-family: inherit;
    font-weight: 500;
    min-width: 0;
}

.command-palette-input::placeholder {
    color: rgba(148, 163, 184, 0.5);
    font-weight: 400;
}

.command-palette-kbd {
    padding: 0.25rem 0.5rem;
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: inherit;
    color: rgba(148, 163, 184, 0.8);
    flex-shrink: 0;
}

/* Results */
.command-palette-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

.command-palette-results::-webkit-scrollbar {
    width: 6px;
}

.command-palette-results::-webkit-scrollbar-track {
    background: transparent;
}

.command-palette-results::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}

.command-palette-results::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

/* Groups */
.command-palette-group {
    margin-bottom: 0.5rem;
}

.command-palette-group:last-child {
    margin-bottom: 0;
}

.command-palette-group-label {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Items */
.command-palette-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: #f4f4f5;
    cursor: pointer;
    transition: all 0.12s ease;
    text-align: left;
    font-family: inherit;
}

.command-palette-item:hover,
.command-palette-item.selected {
    background: rgba(59, 130, 246, 0.12);
}

.command-palette-item.selected {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18) 0%, rgba(139, 92, 246, 0.12) 100%);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.command-palette-item.locked {
    opacity: 0.55;
}

.command-palette-item.locked:hover,
.command-palette-item.locked.selected {
    opacity: 0.7;
}

/* Item Icon */
.item-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 10px;
    color: #3b82f6;
    flex-shrink: 0;
    transition: all 0.12s ease;
}

.command-palette-item:hover .item-icon,
.command-palette-item.selected .item-icon {
    background: rgba(59, 130, 246, 0.18);
    border-color: rgba(59, 130, 246, 0.3);
}

.item-icon svg {
    width: 20px;
    height: 20px;
}

/* Item Content */
.item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.item-label {
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-sublabel {
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Item Shortcut */
.item-shortcut {
    padding: 0.2rem 0.5rem;
    background: rgba(100, 116, 139, 0.12);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 5px;
    font-size: 0.7rem;
    font-family: inherit;
    color: rgba(148, 163, 184, 0.7);
    flex-shrink: 0;
}

/* Item Lock */
.item-lock {
    font-size: 0.85rem;
    margin-left: 0.25rem;
    flex-shrink: 0;
}

/* Footer */
.command-palette-footer {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(59, 130, 246, 0.08);
}

.footer-hint {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.5);
}

.footer-hint kbd {
    padding: 0.15rem 0.4rem;
    background: rgba(100, 116, 139, 0.15);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 4px;
    font-size: 0.65rem;
    font-family: inherit;
}

/* Empty State */
.command-palette-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.command-palette-empty .empty-icon {
    color: rgba(148, 163, 184, 0.3);
    margin-bottom: 1rem;
}

.command-palette-empty .empty-icon svg {
    width: 40px;
    height: 40px;
}

.command-palette-empty .empty-text {
    font-size: 1rem;
    color: rgba(148, 163, 184, 0.7);
    margin: 0 0 0.5rem;
}

.command-palette-empty .empty-hint {
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.4);
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .command-palette-overlay {
        padding: 1rem;
        padding-top: 10vh;
        align-items: flex-start;
    }

    .command-palette-modal {
        max-width: 100%;
        margin: 0;
        border-radius: 16px;
    }

    .command-palette-header {
        padding: 0.75rem;
    }

    .command-palette-search {
        padding: 0.75rem;
    }

    .command-palette-input {
        font-size: 1rem;
    }

    .command-palette-results {
        max-height: 50vh;
    }

    .command-palette-item {
        padding: 0.875rem 0.75rem;
    }

    .item-icon {
        width: 32px;
        height: 32px;
    }

    .item-icon svg {
        width: 18px;
        height: 18px;
    }

    .command-palette-footer {
        display: none;
    }

    .item-shortcut {
        display: none;
    }
}

@media (max-width: 480px) {
    .command-palette-overlay {
        padding-top: 5vh;
    }

    .command-palette-results {
        max-height: 60vh;
    }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .command-palette-overlay {
        transition: opacity 0.01s ease;
    }

    .command-palette-modal {
        transition: none;
        transform: scale(1) translateY(0);
    }

    .command-palette-item {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: more) {
    .command-palette-modal {
        border-width: 2px;
        border-color: rgba(59, 130, 246, 0.5);
    }

    .command-palette-search {
        border-width: 2px;
    }

    .command-palette-item.selected {
        outline: 2px solid #3b82f6;
        outline-offset: -2px;
    }
}

/* Focus Visible */
.command-palette-item:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.command-palette-input:focus-visible {
    outline: none;
}
