/* Raycast-inspired Command Menu Styles */

:root {
    --command-menu-gray1: #fcfcfc;
    --command-menu-gray2: #f9f9f9;
    --command-menu-gray5: #e0e0e0;
    --command-menu-gray6: #d9d9d9;
    --command-menu-gray7: #cecece;
    --command-menu-gray8: #bbbbbb;
    --command-menu-gray9: #8d8d8d;
    --command-menu-gray11: #646464;
    --command-menu-gray12: #202020;
    --command-menu-font-sans: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
    --command-menu-cmdk-shadow: 0 16px 70px rgba(0, 0, 0, 0.2);
    --command-menu-page-top: 20vh;
}

.raycast [cmdk-root] {
    max-width: 640px;
    width: 100%;
    background: var(--command-menu-gray1);
    border-radius: 12px;
    padding: 8px 0;
    font-family: var(--command-menu-font-sans);
    box-shadow: var(--command-menu-cmdk-shadow);
    border: 1px solid var(--command-menu-gray6);
    position: relative;
    outline: none;
}

/* Submenu styles */
.raycast-submenu [cmdk-root] {
    display: flex;
    flex-direction: column;
    width: 607px;
    border: 1px solid var(--command-menu-gray6);
    background: var(--command-menu-gray2);
    border-radius: 8px;
}

.raycast-submenu [cmdk-list] {
    padding: 8px;
    overflow: auto;
    overscroll-behavior: contain;
    transition: 100ms ease;
    transition-property: height;
}

.raycast-submenu [cmdk-item] {
    cursor: pointer;
    height: 40px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    color: var(--command-menu-gray12);
    user-select: none;
    will-change: background, color;
    transition: all 150ms ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.raycast-submenu [cmdk-item][aria-selected='true'] {
    background: var(--command-menu-gray5);
    color: var(--command-menu-gray12);
}

.raycast-submenu [cmdk-item][aria-selected='true'] [cmdk-raycast-submenu-shortcuts] kbd {
    background: var(--command-menu-gray7);
}

.raycast-submenu [cmdk-item][aria-disabled='true'] {
    color: var(--command-menu-gray8);
    cursor: not-allowed;
}

.raycast-submenu [cmdk-item] svg {
    width: 16px;
    height: 16px;
}

.raycast-submenu [cmdk-raycast-submenu-shortcuts] {
    display: flex;
    margin-left: auto;
    gap: 2px;
}

.raycast-submenu [cmdk-raycast-submenu-shortcuts] kbd {
    font-family: var(--command-menu-font-sans);
    background: var(--command-menu-gray5);
    color: var(--command-menu-gray11);
    height: 20px;
    width: 20px;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.raycast-submenu [cmdk-raycast-submenu-shortcuts] kbd:first-of-type {
    margin-left: 8px;
}

.raycast-submenu [cmdk-group-heading] {
    text-transform: capitalize;
    font-size: 12px;
    color: var(--command-menu-gray11);
    font-weight: 500;
    margin-bottom: 8px;
    margin-top: 8px;
    margin-left: 4px;
}

.raycast-submenu [cmdk-input] {
    padding: 12px;
    font-family: var(--command-menu-font-sans);
    border: 0;
    border-bottom: 1px solid var(--command-menu-gray6);
    font-size: 13px;
    background: transparent;
    margin-top: auto;
    width: 100%;
    outline: none;
    border-radius: 0;
}

.raycast-submenu {
    animation-duration: 0.2s;
    animation-timing-function: ease;
    animation-fill-mode: forwards;
    transform-origin: var(--radix-popover-content-transform-origin);
}

.raycast-submenu[data-state='open'] {
    animation-name: slideIn;
}

.raycast-submenu[data-state='closed'] {
    animation-name: slideOut;
}

.raycast-submenu [cmdk-empty] {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 64px;
    white-space: pre-wrap;
    font-size: 14px;
    color: var(--command-menu-gray11);
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.96);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .raycast [cmdk-input] {
        font-size: 16px;
    }

    .raycast [cmdk-dialog] {
        --command-menu-page-top: 10vh;
    }

    .raycast [cmdk-dialog] [cmdk] {
        width: 95vw;
        max-width: none;
    }
}

/* Default trigger button styles */
.command-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: unset;
    background: unset;
    color: unset;
    width: 0px;
    height: 0px;
    margin-right: 2px;
}

/* Popover content styles */
.command-menu-popover-content {
    background: var(--command-menu-gray1);
    border-radius: 12px;
    border: 1px solid var(--command-menu-gray6);
    box-shadow: var(--command-menu-cmdk-shadow);
    padding: 0;
    width: 600px;
    max-width: 90vw;
    max-height: 400px;
    z-index: 50;
    animation: command-menu-popover-in 0.15s ease-out;
}

.command-menu-popover-content[data-state="closed"] {
    animation: command-menu-popover-out 0.1s ease-in;
}

.command-menu-popover {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.command-menu-input {
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--command-menu-gray6);
    width: 100%;
    font-family: var(--command-menu-font-sans);
    color: var(--command-menu-gray12);
}

.command-menu-input::placeholder {
    color: var(--command-menu-gray9);
}

.command-menu-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
}

@keyframes command-menu-popover-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes command-menu-popover-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-4px) scale(0.95);
    }
}
