.sps-search,
.sps-search * {
    box-sizing: border-box;
}

.sps-search {
    --sps-accent: #007dfa;
    --sps-radius: 18px;
    --sps-height: 52px;
    width: 100%;
    position: relative;
    direction: rtl;
    font-family: inherit;
}

.sps-searchbox {
    width: 100%;
    min-height: var(--sps-height);
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e5e9f1;
    border-radius: var(--sps-radius);
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.07);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sps-searchbox:focus-within {
    border-color: var(--sps-accent);
    box-shadow: 0 12px 30px rgba(17, 24, 39, 0.08), 0 0 0 4px rgba(0, 125, 250, 0.10);
    transform: translateY(-1px);
}

.sps-search-icon {
    width: 22px;
    height: 22px;
    position: absolute;
    right: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.sps-search-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.sps-input {
    width: 100%;
    min-height: calc(var(--sps-height) - 2px);
    border: 0;
    outline: 0;
    background: transparent;
    color: #111827;
    font-size: 14px;
    line-height: 1.7;
    padding: 0 50px 0 46px;
    border-radius: inherit;
    font-family: inherit;
    direction: rtl;
    appearance: none;
}

.sps-input::placeholder {
    color: #9ca3af;
}

.sps-input::-webkit-search-decoration,
.sps-input::-webkit-search-cancel-button,
.sps-input::-webkit-search-results-button,
.sps-input::-webkit-search-results-decoration {
    display: none;
}

.sps-clear {
    width: 30px;
    height: 30px;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    background: #f3f5f8;
    color: #6b7280;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 160ms ease, color 160ms ease;
}

.sps-clear:hover {
    background: var(--sps-accent);
    color: #ffffff;
}

.sps-clear[hidden],
.sps-dropdown[hidden] {
    display: none !important;
}

.sps-dropdown {
    width: 50vw;
    max-height: 430px;
    overflow: auto;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 99999;
    padding: 10px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e5e9f1;
    border-radius: calc(var(--sps-radius) + 2px);
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(10px);
    animation: spsDrop 150ms ease both;
}
@media (max-width: 767px) {
  .sps-dropdown {
    position: fixed;
    width: calc(100vw - 28px);
    max-width: 390px;
    right: auto;
    transform: translateX(-50%);
    top: 30%;
    padding: 12px;
    max-height: 60vh;
    border-radius: 18px;
    margin-left: 4%;  
}
}

@keyframes spsDrop {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sps-result {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.sps-result + .sps-result {
    margin-top: 7px;
}

.sps-result:hover,
.sps-result:focus {
    background: #f8fbff;
    border-color: rgba(0, 125, 250, 0.22);
    transform: translateX(-2px);
    outline: none;
}

.sps-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.sps-result-label {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 9px;
    border: 1px solid var(--sps-accent);
    border-radius: 999px;
    background: rgba(0, 125, 250, 0.06);
    color: var(--sps-accent);
    font-size: 11px;
    font-weight: 700;
}

.sps-result-arrow {
    color: #9ca3af;
    font-size: 13px;
}

.sps-result-title {
    position: relative;
    margin: 0 0 6px;
    padding-right: 12px;
    color: #111827;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.8;
}

.sps-result-title::before {
    content: '';
    width: 5px;
    height: 22px;
    position: absolute;
    right: 0;
    top: 4px;
    border-radius: 999px;
    background: var(--sps-accent);
}

.sps-result-match {
    display: inline-block;
    margin-bottom: 6px;
    padding: 4px 8px;
    border-radius: 9px;
    background: #eef7ff;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.7;
}

.sps-result-excerpt {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.8;
}

.sps-result mark,
.sps-result-match mark,
.sps-result-excerpt mark {
    background: rgba(0, 125, 250, 0.14);
    color: inherit;
    border-radius: 5px;
    padding: 0 3px;
}

.sps-loading {
    padding: 8px 10px 10px;
}

.sps-skeleton {
    height: 8px;
    border-radius: 999px;
    background: linear-gradient(90deg, #eef2f7 0%, #f7f9fc 45%, #eef2f7 100%);
    background-size: 220% 100%;
    animation: spsSkeleton 1.1s ease-in-out infinite;
    margin-bottom: 10px;
}

.sps-skeleton-lg {
    width: 72%;
}

.sps-skeleton-md {
    width: 48%;
    background-image: linear-gradient(90deg, rgba(0, 125, 250, 0.18), rgba(0, 125, 250, 0.08), rgba(0, 125, 250, 0.18));
}

.sps-skeleton-row {
    display: flex;
    gap: 7px;
    margin: 0 0 20px;
}

.sps-skeleton-row span {
    width: 42px;
    height: 8px;
    border: 1px solid var(--sps-accent);
    border-radius: 999px;
    opacity: 0.75;
}

@keyframes spsSkeleton {
    0% {
        background-position: 180% 0;
    }
    100% {
        background-position: -180% 0;
    }
}

.sps-empty {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #6b7280;
    font-size: 13px;
}

.sps-empty-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--sps-accent);
    opacity: 0.65;
}

@media (max-width: 767px) {
    .sps-search {
        max-width: 100% !important;
    }

    .sps-dropdown {
        max-height: 360px;
        padding: 8px;
    }

    .sps-input {
        font-size: 13px;
    }
}
