/* System Search Overlay */

.system-search {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.system-search.visible {
    opacity: 1;
    pointer-events: all;
}

/* Container */

.ss-container {
    width: min(640px, 92vw);
    background: rgba(20, 20, 30, 0.82);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
    transform: translateY(-12px) scale(0.98);
    transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1);
}

.system-search.visible .ss-container {
    transform: translateY(0) scale(1);
}

/* Input row */

.ss-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.ss-input-icon {
    font-size: 18px;
    opacity: 0.55;
    flex-shrink: 0;
    line-height: 1;
}

.ss-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e8e8f0;
    font-size: 16px;
    font-family: inherit;
    caret-color: var(--accent-color, #4a9eff);
}

.ss-input::placeholder {
    color: rgba(200, 200, 220, 0.4);
}

.ss-hint {
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    color: rgba(200, 200, 220, 0.45);
    background: rgba(255, 255, 255, 0.05);
    font-family: inherit;
    flex-shrink: 0;
}

/* Category tabs */

.ss-categories {
    display: flex;
    gap: 2px;
    padding: 8px 14px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ss-cat {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid transparent;
    background: transparent;
    color: rgba(200, 200, 220, 0.55);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.ss-cat:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e8e8f0;
}

.ss-cat.active {
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.45);
    color: #7bbfff;
}

/* Results list */

.ss-results {
    list-style: none;
    margin: 0;
    padding: 6px 0;
    max-height: 360px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.ss-results::-webkit-scrollbar {
    width: 5px;
}

.ss-results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* Individual result */

.ss-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    cursor: pointer;
    transition: background 0.1s;
    border-radius: 0;
}

.ss-result:hover,
.ss-result.selected {
    background: rgba(74, 158, 255, 0.13);
}

.ss-result.selected {
    background: rgba(74, 158, 255, 0.18);
}

.ss-result-icon {
    font-size: 22px;
    width: 32px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.ss-result-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.ss-result-name {
    font-size: 14px;
    color: #e8e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss-result-name mark {
    background: transparent;
    color: #7bbfff;
    font-weight: 600;
}

.ss-result-sub {
    font-size: 11px;
    color: rgba(180, 180, 200, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Type badge */

.ss-result-type {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.ss-type-app {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.ss-type-file {
    background: rgba(255, 193, 7, 0.15);
    color: #ffd54f;
    border: 1px solid rgba(255, 193, 7, 0.25);
}

.ss-type-setting {
    background: rgba(156, 39, 176, 0.2);
    color: #ce93d8;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

/* Empty state */

.ss-empty {
    padding: 28px 18px;
    text-align: center;
    color: rgba(180, 180, 200, 0.4);
    font-size: 14px;
}

.ss-empty.hidden {
    display: none;
}

/* Footer hints */

.ss-footer {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: rgba(180, 180, 200, 0.35);
}

.ss-footer kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 3px;
    font-family: inherit;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(200, 200, 220, 0.5);
    margin: 0 1px;
}

/* Light theme adjustments */

[data-theme="light"] .system-search {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .ss-container {
    background: rgba(245, 247, 252, 0.88);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

[data-theme="light"] .ss-input,
[data-theme="light"] .ss-result-name {
    color: #1a1a2e;
}

[data-theme="light"] .ss-result-name mark {
    color: #1565c0;
}

[data-theme="light"] .ss-input::placeholder {
    color: rgba(40, 40, 60, 0.4);
}

[data-theme="light"] .ss-input-wrap,
[data-theme="light"] .ss-categories,
[data-theme="light"] .ss-footer {
    border-color: rgba(0, 0, 0, 0.07);
}

[data-theme="light"] .ss-result:hover,
[data-theme="light"] .ss-result.selected {
    background: rgba(74, 158, 255, 0.1);
}

[data-theme="light"] .ss-hint,
[data-theme="light"] .ss-footer kbd {
    border-color: rgba(0, 0, 0, 0.15);
    color: rgba(40, 40, 60, 0.45);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .ss-cat {
    color: rgba(40, 40, 60, 0.55);
}

[data-theme="light"] .ss-cat:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1a1a2e;
}

[data-theme="light"] .ss-result-sub,
[data-theme="light"] .ss-empty,
[data-theme="light"] .ss-footer {
    color: rgba(60, 60, 80, 0.45);
}
