/* Command Palette Styles */
/* assets/ui/command-palette.css */

/* ============================================
   Overlay & Backdrop
   ============================================ */
.command-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.command-palette-overlay.is-open {
    display: flex;
}

.command-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: command-palette-fade-in 150ms ease;
}

/* ============================================
   Modal Container
   ============================================ */
.command-palette-modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 16px;
    border-radius: 1.25rem;
    border: 1px solid rgb(var(--color-surface-2) / 0.4);
    background: linear-gradient(135deg, rgb(var(--color-surface-1) / 0.95), rgb(var(--color-surface-1) / 0.85));
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.5);
    backdrop-filter: blur(14px);
    overflow: hidden;
    animation: command-palette-slide-up 150ms ease;
}

/* ============================================
   Header & Input
   ============================================ */
.command-palette-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid rgb(var(--color-surface-2) / 0.4);
}

.command-palette-search-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: rgb(var(--color-text-secondary) / 0.6);
}

.command-palette-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    font-weight: 400;
    color: rgb(var(--color-text-primary));
    caret-color: rgb(var(--color-primary));
}

.command-palette-input::placeholder {
    color: rgb(var(--color-text-secondary) / 0.5);
}

.command-palette-shortcut {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    color: rgb(var(--color-text-secondary) / 0.7);
    background: rgb(var(--color-surface-2) / 0.5);
    border: 1px solid rgb(var(--color-surface-2) / 0.6);
    border-radius: 6px;
}

/* ============================================
   Results List
   ============================================ */
.command-palette-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}

.command-palette-results:empty::after {
    content: "No results found";
    display: block;
    padding: 24px;
    text-align: center;
    color: rgb(var(--color-text-secondary) / 0.5);
    font-size: 14px;
}

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

.command-palette-group:last-child {
    margin-bottom: 0;
}

.command-palette-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgb(var(--color-text-secondary) / 0.5);
    padding: 8px 12px 6px;
}

/* ============================================
   Result Items
   ============================================ */
.command-palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: rgb(var(--color-text-secondary));
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background 150ms, color 150ms;
    text-align: left;
}

.command-palette-item:hover,
.command-palette-item.is-active {
    background: rgb(var(--color-surface-2) / 0.5);
    color: rgb(var(--color-text-primary));
}

.command-palette-item.is-active {
    background: rgb(var(--color-primary) / 0.15);
}

.command-palette-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: rgb(var(--color-text-secondary) / 0.7);
}

.command-palette-item.is-active .command-palette-item-icon {
    color: rgb(var(--color-primary));
}

.command-palette-item-icon svg {
    width: 100%;
    height: 100%;
}

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

.command-palette-item-label {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.command-palette-item-hint {
    display: block;
    font-size: 12px;
    color: rgb(var(--color-text-secondary) / 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.command-palette-item-badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgb(var(--color-surface-2) / 0.6);
    color: rgb(var(--color-text-secondary) / 0.7);
}

/* ============================================
   Footer
   ============================================ */
.command-palette-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-top: 1px solid rgb(var(--color-surface-2) / 0.4);
    font-size: 12px;
    color: rgb(var(--color-text-secondary) / 0.5);
}

.command-palette-footer kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    color: rgb(var(--color-text-secondary) / 0.6);
    background: rgb(var(--color-surface-2) / 0.4);
    border: 1px solid rgb(var(--color-surface-2) / 0.5);
    border-radius: 4px;
    margin: 0 2px;
}

.command-palette-footer span {
    display: flex;
    align-items: center;
}

/* ============================================
   Scrollbar
   ============================================ */
.command-palette-results::-webkit-scrollbar {
    width: 6px;
}

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

.command-palette-results::-webkit-scrollbar-thumb {
    background: rgb(var(--color-surface-2) / 0.5);
    border-radius: 3px;
}

.command-palette-results::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--color-surface-2) / 0.8);
}

/* ============================================
   Animations
   ============================================ */
@keyframes command-palette-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes command-palette-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

    .command-palette-modal {
        max-width: none;
        margin: 0 12px;
        border-radius: 1rem;
    }

    .command-palette-results {
        max-height: 50vh;
    }

    .command-palette-footer {
        display: none;
    }
}
