/* GLOBAL AUTO-SEARCH dropdown grid (wwwroot/js/search-autocomplete.js) */
.gs-panel {
    position: fixed;
    z-index: 1060;
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .16);
    max-height: 72vh;
    overflow-y: auto;
    font-size: 14px;
    color: #222;
}
.gs-panel[hidden] { display: none; }

.gs-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.gs-count { font-weight: 400; color: #777; font-size: 13px; }

.gs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 12px;
}

.gs-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.gs-item:hover,
.gs-item.active {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .10);
    color: inherit;
}

.gs-img {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    background: #fafafa;
    border-radius: 4px;
    overflow: hidden;
}
.gs-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gs-img.gs-noimg::after {
    content: "No image";
    color: #aaa;
    font-size: 12px;
}

.gs-title {
    font-size: 13px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.gs-title mark { background: #fff3b0; padding: 0; color: inherit; }

.gs-all {
    display: block;
    text-align: center;
    padding: 11px;
    border-top: 1px solid #eee;
    font-weight: 600;
    text-decoration: none;
    position: sticky;
    bottom: 0;
    background: #fff;
}
.gs-all:hover { background: #f6f6f6; }

.gs-status { padding: 16px 14px; color: #555; }
.gs-switch { display: block; margin-top: 8px; font-weight: 600; text-decoration: none; }

.gs-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    vertical-align: -2px;
    border: 2px solid #ccc;
    border-top-color: #555;
    border-radius: 50%;
    animation: gs-spin .7s linear infinite;
}
@keyframes gs-spin { to { transform: rotate(360deg); } }

@media (max-width: 575.98px) {
    .gs-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 8px; }
}

/* ===================== VISUAL SEARCH (wwwroot/js/visual-search.js) ===================== */
.vs-cam-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    background: #fff;
    color: #444;
    border: 1px solid #ced4da;
    border-left: 0;
    border-radius: 0;
}
.vs-cam-btn:hover,
.vs-cam-btn:focus { background: #f2f2f2; color: #000; }

body.vs-open { overflow: hidden; }

.vs-overlay {
    position: fixed;
    inset: 0;
    z-index: 1080;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6vh 12px 12px;
}
.vs-overlay[hidden] { display: none; }

.vs-dialog {
    background: #fff;
    width: 100%;
    max-width: 860px;
    max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #222;
}

.vs-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #eee;
}
.vs-header h2 { font-size: 20px; font-weight: 700; margin: 0; }
.vs-header p { margin: 2px 0 0; color: #666; font-size: 14px; }
.vs-close {
    border: 0;
    background: none;
    font-size: 30px;
    line-height: 1;
    color: #666;
    padding: 0 4px;
}
.vs-close:hover { color: #000; }

.vs-body { padding: 16px 20px 20px; overflow-y: auto; }

.vs-drop {
    border: 2px dashed #c8c8c8;
    border-radius: 10px;
    padding: 34px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.vs-drop:hover,
.vs-drop:focus,
.vs-drop.vs-drag { border-color: #333; background: #fafafa; outline: none; }
.vs-drop[hidden] { display: none; }
.vs-drop span { color: #777; font-size: 13px; max-width: 420px; }
.vs-drop-icon svg { width: 40px; height: 40px; color: #555; }
.vs-drop-btns { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

.vs-summary { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.vs-preview {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}
.vs-summary-text { flex: 1; min-width: 0; }
.vs-detected { font-size: 15px; margin-bottom: 4px; }
.vs-found { color: #555; font-size: 14px; margin-bottom: 8px; }
.vs-low { color: #a66b00; font-size: 13px; }

.vs-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 4px; }
.vs-chips > span { color: #777; font-size: 13px; margin-right: 2px; }
.vs-chip {
    border: 1px solid #ccc;
    background: #f7f7f7;
    border-radius: 16px;
    padding: 3px 12px;
    font-size: 13px;
}
.vs-chip small { color: #888; }
.vs-chip:hover { border-color: #333; background: #fff; }

.vs-grid { padding: 12px 0 0; }
.vs-result .gs-all { position: static; margin-top: 12px; border: 1px solid #eee; border-radius: 6px; }

@media (max-width: 575.98px) {
    .vs-overlay { padding: 0; }
    .vs-dialog { max-height: 100vh; height: 100%; border-radius: 0; }
    .vs-preview { width: 72px; height: 72px; }
}

/* Visual search: AI-picked closest match */
.gs-item.vs-best { position: relative; border: 2px solid #1a8f3c; box-shadow: 0 2px 10px rgba(26, 143, 60, .18); }
.vs-best-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 1;
    background: #1a8f3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
