/* ═══ SEARCH MODAL ═══════════════════════════════════
 * Slide-down centered modal triggered by header search icons.
 * ══════════════════════════════════════════════════════ */

body.inkside-theme .ink-search-modal {
    position: fixed;
    inset: 0;
    z-index: var(--ink-z-modal, 9999);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(56px, 10vh, 120px) var(--ink-space-md) var(--ink-space-md);
    visibility: hidden;
    opacity: 0;
    transition: opacity .24s ease, visibility 0s linear .24s;
}

body.inkside-theme .ink-search-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity .24s ease;
}

body.inkside-theme .ink-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 35, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

body.inkside-theme .ink-search-modal__panel {
    position: relative;
    width: 100%;
    max-width: 680px;
    background: var(--ink-bg);
    border-radius: var(--ink-radius-xl, 16px);
    box-shadow: var(--ink-shadow-xl, 0 24px 60px rgba(0,0,0,.18));
    padding: var(--ink-space-lg);
    transform: translateY(-12px) scale(.98);
    opacity: 0;
    transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

body.inkside-theme .ink-search-modal.is-open .ink-search-modal__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ── Header ── */
body.inkside-theme .ink-search-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--ink-space-md);
    gap: var(--ink-space-md);
}

body.inkside-theme .ink-search-modal__title {
    margin: 0;
    font-size: var(--ink-font-size-md);
    font-weight: 700;
    color: var(--ink-text);
    font-family: var(--ink-font);
    line-height: 1.2;
}

body.inkside-theme .ink-search-modal__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--ink-border);
    background: var(--ink-bg);
    color: var(--ink-text-muted);
    border-radius: 999px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

body.inkside-theme .ink-search-modal__close:hover {
    background-color: var(--ink-bg-muted);
    color: var(--ink-text);
    border-color: var(--ink-text-muted);
}

/* ── Form ── */
body.inkside-theme .ink-search-modal__form {
    display: flex;
    align-items: stretch;
    gap: var(--ink-space-sm);
}

body.inkside-theme .ink-search-modal__field {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    padding: 0 10px 0 16px;
    background: var(--ink-bg-muted);
    border: 1px solid var(--ink-border);
    border-radius: var(--ink-radius-md, 10px);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    box-sizing: border-box;
}

body.inkside-theme .ink-search-modal__field:focus-within {
    background: var(--ink-bg);
    border-color: var(--ink-primary);
    box-shadow: 0 0 0 3px var(--ink-primary-ring);
}

body.inkside-theme .ink-search-modal__icon {
    color: var(--ink-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
    pointer-events: none;
}

body.inkside-theme .ink-search-modal__input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    margin: 0;
    font-size: 16px;
    font-family: var(--ink-font);
    color: var(--ink-text);
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

body.inkside-theme .ink-search-modal__input:focus {
    background: transparent;
    border: none;
    box-shadow: none;
}

body.inkside-theme .ink-search-modal__input::placeholder {
    color: var(--ink-text-muted);
    opacity: .8;
}

body.inkside-theme .ink-search-modal__clear {
    width: 26px;
    height: 26px;
    border: none;
    background: var(--ink-bg);
    color: var(--ink-text-muted);
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: background-color .15s ease, color .15s ease;
}

body.inkside-theme .ink-search-modal__clear:hover {
    background: var(--ink-border);
    color: var(--ink-text);
}

body.inkside-theme .ink-search-modal__submit {
    height: 50px;
    flex-shrink: 0;
    padding: 0 var(--ink-space-lg);
}

/* ── Body (scrollable results area) ── */
body.inkside-theme .ink-search-modal__body {
    margin-top: var(--ink-space-md);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    margin-right: calc(-1 * var(--ink-space-sm));
    padding-right: var(--ink-space-sm);
}

body.inkside-theme .ink-search-modal__section {
    animation: inkSearchFadeIn .22s ease both;
}

body.inkside-theme .ink-search-modal__section + .ink-search-modal__section {
    margin-top: var(--ink-space-md);
}

body.inkside-theme .ink-search-modal__section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-text-muted);
    font-family: var(--ink-font);
}

body.inkside-theme .ink-search-modal__count {
    margin-left: auto;
    font-weight: 600;
    color: var(--ink-text-muted);
    text-transform: none;
    letter-spacing: 0;
}

body.inkside-theme .ink-search-modal__results {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.inkside-theme .ink-search-modal__results li {
    animation: inkSearchSlideIn .22s ease both;
}
body.inkside-theme .ink-search-modal__results li:nth-child(2) { animation-delay: .04s; }
body.inkside-theme .ink-search-modal__results li:nth-child(3) { animation-delay: .08s; }
body.inkside-theme .ink-search-modal__results li:nth-child(4) { animation-delay: .12s; }

body.inkside-theme .ink-search-modal__result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--ink-radius-md, 10px);
    text-decoration: none;
    color: var(--ink-text);
    background: transparent;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}

body.inkside-theme .ink-search-modal__result:hover {
    background: var(--ink-bg-muted);
    border-color: var(--ink-border);
    transform: translateX(2px);
}

body.inkside-theme .ink-search-modal__result-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ink-bg-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.inkside-theme .ink-search-modal__result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.inkside-theme .ink-search-modal__result-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.inkside-theme .ink-search-modal__result-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

body.inkside-theme .ink-search-modal__result-cat {
    font-size: 12px;
    color: var(--ink-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.inkside-theme .ink-search-modal__result-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-text);
    flex-shrink: 0;
    white-space: nowrap;
}

body.inkside-theme .ink-search-modal__result-price del {
    color: var(--ink-text-muted);
    font-weight: 500;
    margin-right: 4px;
    opacity: .7;
}

body.inkside-theme .ink-search-modal__result-price ins {
    text-decoration: none;
    color: var(--ink-primary, var(--ink-text));
}

/* See all */
body.inkside-theme .ink-search-modal__see-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    padding: 12px;
    border-radius: var(--ink-radius-md, 10px);
    background: var(--ink-bg-muted);
    color: var(--ink-text);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    border: 1px solid var(--ink-border);
    transition: background-color .15s ease, color .15s ease, gap .15s ease;
}

body.inkside-theme .ink-search-modal__see-all:hover {
    background: var(--ink-text);
    color: var(--ink-bg);
    border-color: var(--ink-text);
    gap: 12px;
}

body.inkside-theme .ink-search-modal__see-all:hover svg {
    transform: translateX(2px);
}

body.inkside-theme .ink-search-modal__see-all svg {
    transition: transform .15s ease;
}

/* Empty state */
body.inkside-theme .ink-search-modal__empty {
    margin: 16px 0 0;
    padding: 16px;
    text-align: center;
    color: var(--ink-text-muted);
    font-size: 14px;
    background: var(--ink-bg-muted);
    border-radius: var(--ink-radius-md, 10px);
}

/* Loader */
body.inkside-theme .ink-search-modal__loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
}

body.inkside-theme .ink-search-modal__loader span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-text-muted);
    animation: inkSearchBounce 1.2s infinite ease-in-out both;
}
body.inkside-theme .ink-search-modal__loader span:nth-child(1) { animation-delay: -.32s; }
body.inkside-theme .ink-search-modal__loader span:nth-child(2) { animation-delay: -.16s; }

@keyframes inkSearchBounce {
    0%, 80%, 100% { transform: scale(.6); opacity: .4; }
    40%           { transform: scale(1);  opacity: 1; }
}

@keyframes inkSearchFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes inkSearchSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Lock body scroll when modal is open */
body.inkside-theme.ink-search-modal-open {
    overflow: hidden;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    body.inkside-theme .ink-search-modal {
        padding: 16px;
        align-items: stretch;
    }
    body.inkside-theme .ink-search-modal__panel {
        padding: var(--ink-space-md);
        max-height: calc(100vh - 32px);
    }
    body.inkside-theme .ink-search-modal__form {
        flex-direction: column;
    }
    body.inkside-theme .ink-search-modal__submit {
        width: 100%;
    }
}
