/* ========================================
   JAIN JINVANI - SPOTLIGHT SEARCH
   macOS-inspired instant search
   ======================================== */

/* ===== Overlay Container ===== */
.spotlight-search {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    /* Hidden by default */
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.spotlight-search.active {
    display: flex;
}

/* Backdrop */
.spotlight-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

/* ===== Spotlight Container (Liquid Glass) ===== */
.spotlight-container {
    position: relative;
    width: 600px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;

    /* Apple Liquid Glass Effect */
    background: var(--liquid-glass-bg);
    backdrop-filter: var(--liquid-glass-blur);
    -webkit-backdrop-filter: var(--liquid-glass-blur);

    border: 1px solid transparent;
    box-shadow: var(--liquid-glass-shadow);

    animation: scaleFadeIn var(--duration-normal) var(--ease-apple);
    transform-origin: center center;
    overflow: hidden;
}

/* ===== Search Input ===== */
.spotlight-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.spotlight-icon {
    color: #888;
    flex-shrink: 0;
}

#spotlightInput {
    flex: 1;
    border: none;
    background: none;
    font-size: 18px;
    color: #333;
    outline: none;
    font-weight: 400;
}

#spotlightInput::placeholder {
    color: #999;
}

.spotlight-shortcut {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    font-family: system-ui, -apple-system;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ===== Results List ===== */
.spotlight-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    max-height: 50vh;
}

.spotlight-results::-webkit-scrollbar {
    width: 8px;
}

.spotlight-results::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Empty State */
.spotlight-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #999;
    text-align: center;
}

.spotlight-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.spotlight-empty p {
    font-size: 14px;
    margin: 0;
}

/* Category Header */
.spotlight-category {
    margin: 12px 0;
}

.spotlight-category h4 {
    padding: 8px 20px 4px;
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Result Item */
.spotlight-result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.spotlight-result:hover {
    background: rgba(0, 0, 0, 0.03);
}

.spotlight-result.selected {
    background: rgba(178, 34, 34, 0.08);
}

.spotlight-result.selected .result-icon {
    transform: scale(1.1);
}

/* Result Icon */
.result-icon {
    font-size: 32px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

/* Result Content */
.result-content {
    flex: 1;
    min-width: 0;
    /* Allow text truncation */
}

.result-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-subtitle {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Result Badge */
.result-badge {
    flex-shrink: 0;
    padding: 4px 8px;
    background: rgba(178, 34, 34, 0.1);
    color: var(--kumkum-red);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* ===== Footer Hints ===== */
.spotlight-footer {
    display: flex;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.3);
}

.spotlight-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #666;
}

.spotlight-hint kbd {
    padding: 2px 6px;
    background: white;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ===== Quick Look Panel ===== */
.quicklook-panel {
    position: fixed;
    right: -450px;
    /* Hidden off-screen */
    top: 15vh;
    width: 400px;
    max-width: 90vw;

    height: 70vh;

    background: var(--liquid-glass-bg);
    backdrop-filter: var(--liquid-glass-blur);
    -webkit-backdrop-filter: var(--liquid-glass-blur);

    border-radius: 16px;
    box-shadow: var(--liquid-glass-shadow);
    transition: right var(--duration-normal) var(--ease-apple);

    display: flex;
    flex-direction: column;
}

.quicklook-panel.active {
    right: 50px;
}

.quicklook-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.quicklook-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.quicklook-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.quicklook-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

.quicklook-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

.quicklook-loading {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.quicklook-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.quicklook-open-btn {
    width: 100%;
    padding: 10px;
    background: var(--kumkum-red);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.quicklook-open-btn:hover {
    background: #a02222;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] .spotlight-container {
    background: var(--liquid-glass-bg);
    /* Use variable for consistency */
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #spotlightInput {
    color: #eee;
}

[data-theme="dark"] #spotlightInput::placeholder {
    color: #bbb;
    /* Increased brightness for visibility */
}

[data-theme="dark"] .result-title {
    color: #eee;
}

[data-theme="dark"] .result-subtitle {
    color: #aaa;
    /* Increased brightness */
}

[data-theme="dark"] .quicklook-panel {
    background: rgba(40, 40, 40, 0.95);
}

[data-theme="dark"] .quicklook-header h3,
[data-theme="dark"] .quicklook-content {
    color: #eee;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .spotlight-search {
        padding-top: 10vh;
    }

    .spotlight-container {
        width: 95vw;
        max-height: 80vh;
    }

    .spotlight-footer {
        display: none;
        /* Hide keyboard hints on mobile */
    }

    .quicklook-panel {
        width: 100vw;
        height: 100vh;
        top: 0;
        right: -100vw;
        border-radius: 0;
    }

    .quicklook-panel.active {
        right: 0;
    }
}