/* GRG Typesense — Instant Search Overlay */

.grg-ts-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    padding-top: 80px;
    padding-left: 16px;
    padding-right: 16px;
}

.grg-ts-modal {
    width: 100%;
    max-width: 640px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

/* Search input area */
.grg-ts-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 16px;
    border-bottom: 1px solid #e4e4e7;
}

.grg-ts-input-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: #a1a1aa;
}

.grg-ts-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 16px 0;
    font-size: 16px;
    color: #18181b;
    background: transparent;
}

.grg-ts-input::placeholder {
    color: #a1a1aa;
}

.grg-ts-close-btn {
    flex-shrink: 0;
    padding: 4px;
    color: #a1a1aa;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.grg-ts-close-btn:hover {
    color: #52525b;
    background: #f4f4f5;
}

/* Results area — no flex:1 so modal stays compact when empty */
.grg-ts-results {
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

/* Group header */
.grg-ts-group-header {
    padding: 8px 16px;
    background: #fafafa;
    font-size: 11px;
    font-weight: 600;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f4f4f5;
}

/* Hit item */
.grg-ts-hit {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
    border-bottom: 1px solid #fafafa;
}

.grg-ts-hit:hover,
.grg-ts-hit.is-selected {
    background: #ecfdf5;
}

.grg-ts-hit-thumb {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: #f4f4f5;
}

.grg-ts-hit-thumb-placeholder {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4d4d8;
}

.grg-ts-hit-content {
    flex: 1;
    min-width: 0;
}

.grg-ts-hit-title {
    font-size: 14px;
    font-weight: 500;
    color: #18181b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grg-ts-hit-title mark {
    background: #d1fae5;
    color: #065f46;
    border-radius: 2px;
    padding: 0 1px;
}

.grg-ts-hit-price {
    font-size: 13px;
    font-weight: 600;
    color: #059669;
}

.grg-ts-hit-meta {
    font-size: 12px;
    color: #a1a1aa;
}

/* Loading */
.grg-ts-loading {
    padding: 24px 16px;
    text-align: center;
    color: #71717a;
    font-size: 14px;
}

.grg-ts-loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e4e4e7;
    border-top-color: #059669;
    border-radius: 50%;
    animation: grg-ts-spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes grg-ts-spin {
    to { transform: rotate(360deg); }
}

/* No results */
.grg-ts-no-results {
    padding: 40px 16px;
    text-align: center;
    color: #71717a;
    font-size: 14px;
}

/* Footer */
.grg-ts-footer {
    padding: 12px 16px;
    border-top: 1px solid #e4e4e7;
    text-align: center;
}

.grg-ts-view-all {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: #059669;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}

.grg-ts-view-all:hover {
    background: #ecfdf5;
    color: #047857;
}

/* Keyboard shortcut hint */
.grg-ts-shortcut {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid #d4d4d8;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #71717a;
    background: #fafafa;
    margin-left: 8px;
}
