/* ===== Command Palette — ⌘K Quick Actions ===== */

#cmd-palette-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
}
#cmd-palette-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.cmd-palette {
    width: 560px;
    max-width: 90vw;
    max-height: 70vh;
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.98) translateY(-10px);
    transition: transform 0.15s ease;
}
#cmd-palette-overlay.visible .cmd-palette {
    transform: scale(1) translateY(0);
}

/* Header / Search */
.cmd-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #2d2d44;
}
.cmd-search-icon {
    color: #666;
    flex-shrink: 0;
}
.cmd-header input {
    flex: 1;
    background: none;
    border: none;
    color: #e8e8f0;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    padding: 0.25rem 0;
}
.cmd-header input::placeholder {
    color: #555;
}
.cmd-esc {
    background: #2d2d44;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    color: #888;
    flex-shrink: 0;
}

/* Results */
.cmd-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    scroll-behavior: smooth;
}
.cmd-results::-webkit-scrollbar { width: 4px; }
.cmd-results::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

.cmd-section {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
}
.cmd-item:hover,
.cmd-item.selected {
    background: #252636;
}
.cmd-item.selected {
    background: #2d2e4a;
}

.cmd-item-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.cmd-item-text {
    flex: 1;
    min-width: 0;
}
.cmd-item-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #e0e0e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cmd-item-desc {
    font-size: 0.78rem;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmd-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.cmd-item-type {
    font-size: 0.65rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #1e1e32;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}
.cmd-pin-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.15rem;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.cmd-pin-btn:hover { opacity: 1; }
.cmd-pinned .cmd-pin-btn { opacity: 1; }

.cmd-empty {
    text-align: center;
    padding: 2rem;
    color: #555;
    font-size: 0.9rem;
}

/* Footer */
.cmd-footer {
    display: flex;
    gap: 1.5rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid #2d2d44;
    font-size: 0.75rem;
    color: #555;
}
.cmd-footer kbd {
    background: #2d2d44;
    border: 1px solid #3d3d54;
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
    font-size: 0.7rem;
    color: #888;
    font-family: inherit;
    margin-right: 0.25rem;
}

/* ===== Shortcuts Modal ===== */
#shortcuts-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shortcuts-modal {
    background: #1a1a2e;
    border: 1px solid #333;
    border-radius: 14px;
    width: 480px;
    max-width: 90vw;
    padding: 1.5rem;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.shortcuts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.shortcuts-header h2 {
    font-size: 1.1rem;
    margin: 0;
}
.shortcuts-header button {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.25rem;
}
.shortcuts-header button:hover { color: #ddd; }

.shortcut-group {
    margin-bottom: 1rem;
}
.shortcut-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 0.5rem;
}
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0;
    font-size: 0.88rem;
}
.shortcut-row kbd {
    min-width: 80px;
    text-align: center;
    background: #252636;
    border: 1px solid #3d3d54;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    color: #aaa;
    font-family: inherit;
}
.shortcut-row span {
    color: #aaa;
}

/* ===== Light Mode Overrides ===== */
/* Command palette is dark by default; in light mode, use a lighter variant */
[data-theme="light"] .cmd-palette {
    background: #ffffff;
    border-color: #d0d0d0;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
}
[data-theme="light"] .cmd-header {
    border-bottom-color: #e0e0e0;
}
[data-theme="light"] #cmd-input {
    color: #333;
}
[data-theme="light"] #cmd-input::placeholder {
    color: #999;
}
[data-theme="light"] .cmd-search-icon {
    color: #999;
}
[data-theme="light"] .cmd-item {
    color: #333;
}
[data-theme="light"] .cmd-item:hover,
[data-theme="light"] .cmd-item.active {
    background: #f0f4ff;
}
[data-theme="light"] .cmd-item-icon {
    background: #f0f0f0;
}
[data-theme="light"] .cmd-section-label {
    color: #888;
}
[data-theme="light"] .cmd-hint {
    color: #aaa;
}
[data-theme="light"] .cmd-hint kbd {
    background: #eee;
    border-color: #ddd;
    color: #666;
}
[data-theme="light"] .cmd-empty {
    color: #999;
}
