/* ============================================================
   Smart Search Popup — stylesheet
   Matches the design in the reference screenshots
   ============================================================ */

/* ── Trigger button (header icon) ────────────────────────── */
.ssp-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    line-height: 0;
    transition: opacity 0.2s;
}
.ssp-trigger:hover { opacity: 0.7; }
.ssp-trigger:focus-visible {
    outline: 2px solid #173A64;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Overlay ──────────────────────────────────────────────── */
.ssp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.ssp-overlay.ssp-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Panel ────────────────────────────────────────────────── */
.ssp-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100dvh;
    background: #ffffff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 32px rgba(0, 0, 0, 0.12);
}
.ssp-panel[hidden] { display: flex; } /* keep flex layout while hidden via transform */
.ssp-panel.ssp-panel--open {
    transform: translateX(0);
}

/* ── Panel header ─────────────────────────────────────────── */
.ssp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 16px;
}

.ssp-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ssp-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 22px;
    font-weight: 400;
    color: #25282A;
    background: transparent;
    caret-color: #173A64;
    min-width: 0;
}
.ssp-input::placeholder { color: #adb5bd; }

/* ── Search icon button (shown when input is empty) ────────── */
.ssp-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    transition: opacity 0.2s;
}
.ssp-search-btn:hover { opacity: 0.7; }
.ssp-search-btn:focus-visible {
    outline: 2px solid #173A64;
    outline-offset: 2px;
    border-radius: 50%;
}

/* ── Clear icon button (replaces search icon when typing) ──── */
.ssp-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 0;
    transition: opacity 0.2s, transform 0.2s;
}
.ssp-clear-btn:hover { opacity: 0.75; transform: scale(1.08); }
.ssp-clear-btn:focus-visible {
    outline: 2px solid #173A64;
    outline-offset: 2px;
    border-radius: 50%;
}

/* ── Close / Clear button (right side of header) ──────────── */
.ssp-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 4px 2px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
}
.ssp-close:hover { opacity: 0.6; }
.ssp-close:focus-visible {
    outline: 2px solid #173A64;
    outline-offset: 2px;
    border-radius: 4px;
}

/* "Clear" text label — hidden until input has content */
.ssp-close__label {
    font-size: 15px;
    font-weight: 500;
    color: #173A64;
    line-height: 1;
}

/* X SVG wrapper — always in DOM but hidden until input has content */
.ssp-close__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Default: hide the whole close button — shown only when input has text */
.ssp-close {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0.2s;
}
/* State: input has text → reveal close button */
.ssp-panel--has-query .ssp-close {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* ── Divider ──────────────────────────────────────────────── */
.ssp-divider {
    height: 1px;
    background: #d9dee3;
    margin: 0 20px;
    flex-shrink: 0;
}

/* ── Body / scroll area ───────────────────────────────────── */
.ssp-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 32px;
    -webkit-overflow-scrolling: touch;
}

/* ── Popular requests (default state) ────────────────────── */
.ssp-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #25282A;
    text-transform: none;
    margin: 0 0 14px;
    letter-spacing: 0;
}

.ssp-popular {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ssp-popular li {}
.ssp-popular a {
    display: block;
    font-size: 15px;
    color: #173A64;
    text-decoration: none;
    padding: 6px 0;
    transition: opacity 0.15s;
}
.ssp-popular a:hover { opacity: 0.7; }

/* ── Tabs ─────────────────────────────────────────────────── */
.ssp-tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    border-bottom: 1px solid #d9dee3;
}

.ssp-tab {
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1px;
    padding: 0 0 10px;
    font-size: 15px;
    font-weight: 400;
    color: #adb5bd;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}
.ssp-tab:hover { color: #25282A; }
.ssp-tab.ssp-tab--active {
    color: #25282A;
    font-weight: 600;
    border-bottom-color: #25282A;
}

/* ── Result list ──────────────────────────────────────────── */
.ssp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ssp-list__item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #f5f6f8;
    border-radius: 6px;
    padding: 12px 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.ssp-list__item:hover { background: #eaecf0; }

.ssp-list__thumb {
    width: 68px;
    height: 68px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e2e5ea;
}
.ssp-list__thumb--placeholder {
    width: 68px;
    height: 68px;
    border-radius: 4px;
    background: #e2e5ea;
    flex-shrink: 0;
}

.ssp-list__info {
    flex: 1;
    min-width: 0;
}
.ssp-list__title {
    font-size: 15px;
    font-weight: 500;
    color: #25282A;
    line-height: 1.4;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ssp-list__cta {
    font-size: 13px;
    font-weight: 700;
    color: #173A64;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Spinner ──────────────────────────────────────────────── */
.ssp-spinner {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 32px 0;
}
.ssp-spinner__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #173A64;
    animation: ssp-bounce 1.1s infinite ease-in-out both;
}
.ssp-spinner__dot:nth-child(1) { animation-delay: -0.32s; }
.ssp-spinner__dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ssp-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1);   opacity: 1; }
}

/* ── No results ───────────────────────────────────────────── */
.ssp-no-results {
    text-align: center;
    color: #adb5bd;
    font-size: 15px;
    padding: 32px 0;
    margin: 0;
}

/* ── Accessibility: reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ssp-panel,
    .ssp-overlay { transition: none; }
    .ssp-spinner__dot { animation: none; opacity: 1; }
}

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 480px) {
    .ssp-panel { max-width: 100%; }
    .ssp-input { font-size: 18px; }
}
