/* =====================================================
   JINNY KIT — PREMIUM SEARCH (Command Palette Style)
   ===================================================== */

/* ---- Backdrop ---- */
#jk-search-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 99990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

#jk-search-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

/* ---- Modal Container ---- */
#jk-search-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -44%) scale(0.94);
    width: min(680px, 94vw);
    z-index: 99991;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.23, 1, 0.32, 1);
}

#jk-search-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ---- The Box ---- */
#jk-search-box {
    background: rgba(10, 10, 28, 0.96);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    box-shadow:
        0 0 0 1px rgba(99, 102, 241, 0.15),
        0 24px 70px rgba(0, 0, 0, 0.65),
        0 0 60px rgba(99, 102, 241, 0.12);
    overflow: hidden;
}

/* ---- Input row ---- */
#jk-search-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

#jk-search-icon-left {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: rgba(99, 102, 241, 0.85);
    display: flex;
    align-items: center;
}

#jk-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    caret-color: #6366f1;
    min-width: 0;
}

#jk-search-input::placeholder {
    color: rgba(148, 163, 184, 0.55);
}

#jk-search-clear {
    flex-shrink: 0;
    display: none;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.07);
    border: none;
    border-radius: 7px;
    color: #94a3b8;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

#jk-search-clear:hover {
    background: rgba(99, 102, 241, 0.2);
    color: #e2e8f0;
}

#jk-search-clear.visible {
    display: flex;
}

#jk-search-kbd {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    align-items: center;
}

#jk-search-kbd kbd {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    color: #94a3b8;
    font-family: 'Inter', sans-serif;
}

/* ---- Category tabs ---- */
#jk-search-cats {
    display: flex;
    gap: 6px;
    padding: 10px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
    scrollbar-width: none;
}

#jk-search-cats::-webkit-scrollbar {
    display: none;
}

.jk-scat {
    flex-shrink: 0;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.jk-scat:hover {
    color: #e2e8f0;
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.25);
}

.jk-scat.active {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.45);
    color: #a5b4fc;
}

/* ---- Results list ---- */
#jk-search-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

#jk-search-results::-webkit-scrollbar {
    width: 5px;
}

#jk-search-results::-webkit-scrollbar-track {
    background: transparent;
}

#jk-search-results::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.35);
    border-radius: 10px;
}

/* ---- Result item ---- */
.jk-result {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    border: 1px solid transparent;
    outline: none;
}

.jk-result:hover,
.jk-result.focused {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

.jk-result.focused {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2) inset;
}

.jk-result__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.jk-result__body {
    flex: 1;
    min-width: 0;
}

.jk-result__name {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.jk-result__name mark {
    background: none;
    color: #a5b4fc;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.4);
}

.jk-result__desc {
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.jk-result__cat {
    flex-shrink: 0;
    padding: 3px 9px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.jk-result__arrow {
    flex-shrink: 0;
    color: rgba(99, 102, 241, 0.5);
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
}

.jk-result:hover .jk-result__arrow,
.jk-result.focused .jk-result__arrow {
    opacity: 1;
    transform: translateX(3px);
}

/* ---- States: empty, no results ---- */
#jk-search-state {
    padding: 36px 20px;
    text-align: center;
    color: #475569;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

#jk-search-state .jk-ss-icon {
    font-size: 2.4rem;
    opacity: 0.5;
}

#jk-search-state .jk-ss-title {
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
}

#jk-search-state .jk-ss-sub {
    font-size: 13px;
    color: #475569;
}

/* ---- Section headers in results ---- */
.jk-result-section {
    padding: 6px 14px 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #475569;
    margin-top: 6px;
}

/* ---- Footer ---- */
#jk-search-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-wrap: wrap;
}

.jk-sfooter-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: #475569;
}

.jk-sfooter-hint kbd {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    color: #64748b;
    font-family: 'Inter', sans-serif;
}

#jk-result-count {
    margin-left: auto;
    font-size: 11px;
    color: #334155;
}

/* ---- Search trigger button in nav ---- */
#jk-search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    white-space: nowrap;
}

#jk-search-trigger:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.3);
    color: #e2e8f0;
}

#jk-search-trigger svg {
    opacity: 0.7;
}

#jk-search-trigger .jk-st-kbd {
    margin-left: 6px;
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-size: 10px;
    color: #64748b;
}

/* Search icon in mobile-compact nav */
#jk-search-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-left: 8px;
}

#jk-search-icon-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #e2e8f0;
    border-color: rgba(99, 102, 241, 0.3);
}

/* ---- Animations ---- */
@keyframes jkSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jk-result {
    animation: jkSlideUp 0.18s ease both;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    #jk-search-modal {
        top: 20px;
        transform: translate(-50%, 0) scale(0.94);
    }

    #jk-search-modal.open {
        transform: translate(-50%, 0) scale(1);
    }

    #jk-search-results {
        max-height: 55vh;
    }

    #jk-search-trigger .jk-st-text,
    #jk-search-trigger .jk-st-kbd {
        display: none;
    }

    #jk-search-trigger {
        padding: 8px 10px;
    }
}