﻿/* ===== Site Search Widget ===================================== */
.ss {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/*  Trigger button  */
.ss__btn {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 20px;
    padding: 0;
    background: linear-gradient(145deg, rgba(13,37,64,.2), rgba(7,20,34,.14));
    box-shadow: 0 6px 16px rgba(0,0,0,.18), inset 0 1px 0 rgba(255,255,255,.06);
    color: #71f1df;
    cursor: pointer !important;
    pointer-events: auto;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease, top .22s ease, right .22s ease;
}

.ss__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,.22), 0 0 0 1px rgba(113,241,223,.14), 0 0 14px rgba(113,241,223,.08), inset 0 1px 0 rgba(255,255,255,.08);
    background: linear-gradient(145deg, rgba(18,45,78,.26), rgba(9,27,48,.2));
}

.ss__btn:active {
    transform: scale(.92);
    box-shadow: 0 4px 18px rgba(0,0,0,.5), inset 0 2px 8px rgba(0,0,0,.4);
}

/*  Icons  */
.ss__ico {
    display: block;
    transition: opacity .18s ease, transform .22s ease;
}

.ss__x {
    position: absolute;
    font-size: 1.15rem;
    line-height: 1;
    color: #7cf6ff;
    opacity: 0;
    transform: scale(.7) rotate(-20deg);
    transition: opacity .18s ease, transform .22s ease;
    pointer-events: none;
}

.ss--open .ss__btn .ss__ico {
    opacity: 0;
    transform: scale(.7) rotate(15deg);
}

.ss--open .ss__btn .ss__x {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/*  Panel  */
.ss__panel {
    position: relative;
    overflow: hidden;
    width: 62px;
    height: 62px;
    box-sizing: border-box;
    border-radius: 20px;
    border: none;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: width .32s cubic-bezier(.2,.8,.2,1), height .32s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease;
}

.ss--open .ss__btn {
    top: 14px;
    right: 14px;
}

.ss__curve {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity .22s ease;
}

.ss__content {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 16px 16px 14px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}

.ss__input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 60px;
}

.ss--open .ss__panel {
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 250px;
    border-radius: 26px;
    border: 1px solid rgba(113,241,223,.06);
    background: linear-gradient(160deg, rgba(7,20,36,.16), rgba(10,30,52,.12));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 18px 40px rgba(0,0,0,.28), 0 0 0 1px rgba(113,241,223,.05), 0 0 24px rgba(113,241,223,.08);
}

.ss--open .ss__curve {
    opacity: 1;
}

.ss__curve-open {
    fill: rgba(14,42,69,.26);
}

.ss__curve-close {
    fill: rgba(23,61,92,.18);
}

.ss--open.ss--expanded .ss__panel {
    height: min(76vh, 420px);
}

.ss--open .ss__content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/*  Input  */
.ss__input {
    width: 100%;
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 16px;
    border: 1px solid rgba(113,241,223,.2);
    border-radius: 16px;
    outline: none;
    background: rgba(255,255,255,.01);
    color: #eefcff;
    font: 500 .98rem/1 'Inter', sans-serif;
    caret-color: #71f1df;
    transition: border-color .2s ease, box-shadow .2s ease, opacity .22s ease;
    box-sizing: border-box;
}

.ss__input::placeholder { color: rgba(200,230,238,.55); }

.ss__input--switching {
    opacity: .62;
}

.ss__input:focus {
    border-color: rgba(124,246,255,.45);
    box-shadow: 0 0 0 1px rgba(124,246,255,.12), 0 0 22px rgba(124,246,255,.08);
}

/*  Results  */
.ss__results {
    max-height: 0;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    transition: max-height .28s ease, margin-top .28s ease;
}

.ss__results--on {
    max-height: 1000px;
    overflow-y: auto;
    margin-top: 10px;
}

.ss__results--on::-webkit-scrollbar { width: 6px; }
.ss__results--on::-webkit-scrollbar-thumb {
    background: rgba(113,241,223,.25);
    border-radius: 999px;
}

.ss__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 14px;
    cursor: pointer !important;
    pointer-events: auto;
    transition: background .16s ease, transform .16s ease;
    outline: none;
}

.ss__row + .ss__row { border-top: 1px solid rgba(255,255,255,.05); }

.ss__row:hover,
.ss__row:focus { background: rgba(113,241,223,.09); transform: translateX(2px); }

.ss__thumb {
    width: 46px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.06);
    background: linear-gradient(145deg, rgba(18,47,72,.9), rgba(8,20,34,.9));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #71f1df;
    font-size: 1rem;
}

.ss__thumb img { width: 100%; height: 100%; object-fit: cover; }

.ss__info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ss__title {
    display: block;
    font: 600 .93rem/1.3 'Inter', sans-serif;
    color: #eefcff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ss__cat {
    display: block;
    font: 500 .7rem/1.2 'Inter', sans-serif;
    color: rgba(113,241,223,.82);
    text-transform: uppercase;
    letter-spacing: .1em;
}

.ss__empty {
    margin: 0;
    padding: 16px 10px;
    color: rgba(200,230,238,.6);
    font: 400 .9rem/1.4 'Inter', sans-serif;
    text-align: center;
}

/*  Mobile  */
@media (max-width: 600px) {
    .ss { top: 12px; right: 12px; }
    .ss__btn { width: 54px; height: 54px; border-radius: 18px; top: 0; right: 0; }
    .ss__panel { width: 54px; height: 54px; }
    .ss--open .ss__btn { top: 10px; right: 10px; }
    .ss--open .ss__panel { width: calc(100vw - 24px); height: 220px; }
    .ss--open.ss--expanded .ss__panel { height: min(72vh, 500px); }
    .ss__content { padding: 12px; }
    .ss__input-row { padding-right: 54px; }
}

@media (prefers-reduced-motion: reduce) {
    .ss__btn, .ss__panel, .ss__ico, .ss__x, .ss__row, .ss__input { transition: none; }
}