/* ── Search Island Styles ── */
/* Placed in public/ to guarantee loading — bypasses Vite/Astro JS bundling */

.si {
    position: relative;
    width: 100%;
    z-index: 300;
}

.si__bar {
    display: flex;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    transition: border-color 0.15s, background 0.15s;
    height: 42px;
}

.si__bar:focus-within {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

.si__input {
    flex: 1;
    padding: 0 14px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    outline: none;
    min-width: 0;
    height: 100%;
}

.si__input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.si__clear {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 100%;
    background: none;
    border: none;
    color: #fff;
    opacity: 0.6;
    cursor: pointer;
    flex-shrink: 0;
}

.si__clear:hover {
    opacity: 1;
}

.si__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 100%;
    border: none;
    cursor: pointer;
    background: var(--color-accent, #2563eb);
    color: #fff;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.si__btn:hover {
    opacity: 0.9;
}

/* ── Dropdown ── */
.si__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.1);
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 9999;
    color: #374151;
}

/* Result count */
.si__count {
    padding: 14px 20px 10px;
    font-size: 13px;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
    border-radius: 16px 16px 0 0;
}

.si__count strong {
    color: #111827;
}

/* Sections */
.si__section {
    padding: 8px 0;
}

.si__section+.si__section {
    border-top: 1px solid #f3f4f6;
}

.si__section-title {
    padding: 6px 20px 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9ca3af;
    font-weight: 700;
}

/* Categories */
.si__cats {
    display: flex;
    flex-direction: row;
    gap: 16px;
    padding: 8px 20px 12px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.si__cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #374151;
    flex-shrink: 0;
    padding: 4px;
    transition: transform 0.15s;
    cursor: pointer;
}

.si__cat:hover {
    transform: translateY(-2px);
}

.si__cat-img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.si__cat-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.si__cat-name {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    color: #374151;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Products — row: [img] [name+price] [→] */
.si__products {
    list-style: none;
    margin: 0;
    padding: 0;
}

.si__product {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 10px 20px;
    text-decoration: none;
    color: #374151;
    transition: background 0.1s;
    cursor: pointer;
}

.si__product:hover {
    background: #f9fafb;
}

.si__product-img {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    border-radius: 10px;
    overflow: hidden;
    background: #f3f4f6;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
}

.si__product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.si__product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.si__product-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.si__product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-accent, #2563eb);
}

.si__product-arrow {
    flex-shrink: 0;
    color: #d1d5db;
    transition: color 0.15s;
}

.si__product:hover .si__product-arrow {
    color: #6b7280;
}

/* View all */
.si__view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-accent, #2563eb);
    text-decoration: none;
    border-top: 1px solid #f3f4f6;
    background: #fafafa;
    border-radius: 0 0 16px 16px;
    transition: background 0.1s;
}

.si__view-all:hover {
    background: #f3f4f6;
}

/* Empty */
.si__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
}

.si__empty svg {
    color: #d1d5db;
}

.si__empty p {
    font-size: 14px;
    color: #9ca3af;
    margin: 0;
}

.si__empty p strong {
    color: #6b7280;
}

/* Loading */
.si__loading {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.si__skeleton {
    border-radius: 10px;
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: si-shimmer 1.2s ease-in-out infinite;
}

.si__skeleton--cat {
    height: 72px;
}

.si__skeleton--row {
    height: 52px;
}

@keyframes si-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.si__spin {
    animation: si-rotate 0.8s linear infinite;
}

@keyframes si-rotate {
    to {
        transform: rotate(360deg);
    }
}

.si__spin-bg {
    opacity: 0.25;
}

/* Mobile */
@media (max-width: 768px) {
    .si__dropdown {
        position: fixed;
        top: auto;
        left: 8px;
        right: 8px;
        transform: none;
        width: auto;
        max-width: none;
        max-height: 60vh;
        border-radius: 12px;
    }

    .si__cat-img {
        width: 48px;
        height: 48px;
    }

    .si__product-img {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    .si__product {
        padding: 8px 16px;
        gap: 10px;
    }
}

/* Dark mode */
html.sf-dark .si__dropdown {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

html.sf-dark .si__count {
    background: #1a2332;
    color: #94a3b8;
    border-bottom-color: #334155;
}

html.sf-dark .si__count strong {
    color: #f1f5f9;
}

html.sf-dark .si__section+.si__section {
    border-top-color: #334155;
}

html.sf-dark .si__section-title {
    color: #64748b;
}

html.sf-dark .si__cat {
    color: #e2e8f0;
}

html.sf-dark .si__cat-img {
    background: #334155;
    border-color: #475569;
}

html.sf-dark .si__cat-name {
    color: #cbd5e1;
}

html.sf-dark .si__product {
    color: #e2e8f0;
}

html.sf-dark .si__product:hover {
    background: rgba(255, 255, 255, 0.04);
}

html.sf-dark .si__product-img {
    background: #334155;
    border-color: #475569;
}

html.sf-dark .si__product-name {
    color: #f1f5f9;
}

html.sf-dark .si__product-arrow {
    color: #475569;
}

html.sf-dark .si__view-all {
    background: #1a2332;
    border-top-color: #334155;
}

html.sf-dark .si__view-all:hover {
    background: #253346;
}

html.sf-dark .si__empty p {
    color: #64748b;
}

html.sf-dark .si__skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}