/* Gigapixel Visual Search */

/* Bug-Fix: dg_theme body overflow-x:hidden blockiert position:sticky */
html {
  overflow: visible !important;
  overflow-x: clip !important;
}
body, body.layout-page, body.layout-page--default {
  overflow: visible !important;
  overflow-x: clip !important;
}
:root {
    --gp-blue:#1a73e8; --gp-bg:#f5f5f5; --gp-card:#fff;
    --gp-text:#333; --gp-muted:#888; --gp-border:#e0e0e0;
    --gp-radius:8px;
}

/* ── container ── */
.gp-visualsearch { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--gp-text); padding: 0 8px }
.gp-visualsearch--index {
    width: 90%;
    max-width: none;
    margin: 0 auto;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--gp-card);
    padding: 10px 0;
}

/* ── search bar ── */
.gp-search-form { width: 100%; margin-bottom: 0 }
.gp-search-bar { display: flex; align-items: center; gap: .5rem;
    background: #fff; border: 1.5px solid var(--gp-border); border-radius: 28px;
    padding: .4rem .4rem .4rem 1rem; box-shadow: 0 2px 8px rgba(0,0,0,.07) }
.gp-search-input { flex: 1; border: none; outline: none; font-size: 1rem; background: transparent; min-width: 0 }
.gp-icon-btn { background: none; border: none; cursor: pointer; padding: .35rem;
    color: var(--gp-muted); border-radius: 50%; display: flex; align-items: center }
.gp-icon-btn:hover { background: var(--gp-bg); color: var(--gp-blue) }
.gp-search-submit { background: var(--gp-blue); color: #fff; border: none; border-radius: 22px;
    padding: .45rem 1.2rem; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap }
.gp-search-submit:hover { background: #1557b0 }

/* ── expanded panel ── */
.gp-expanded-panel { background: #fff; border: 1px solid var(--gp-border); border-radius: var(--gp-radius);
    margin-top: .5rem; padding: 1rem; box-shadow: 0 4px 16px rgba(0,0,0,.08); overflow-x: hidden }

/* ── options accordion (replaces tabs) ── */
.gp-options { border: none; margin-top: .75rem }
.gp-options-summary { font-size: .8rem; font-weight: 600; color: var(--gp-muted);
    text-transform: uppercase; letter-spacing: .04em; cursor: pointer; list-style: none;
    padding: .35rem 0; border-top: 1px solid var(--gp-border); user-select: none }
.gp-options-summary::-webkit-details-marker { display: none }
.gp-options-summary::after { content: ' ▾'; font-size: .7rem }
details.gp-options[open] .gp-options-summary::after { content: ' ▴' }
.gp-options-body { padding-top: .75rem }

/* ── drop zone ── */
.gp-drop-zone { border: 2px dashed var(--gp-border); border-radius: var(--gp-radius);
    padding: 1.25rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s }
.gp-drop-zone:hover, .gp-drop-zone.dragover { border-color: var(--gp-blue); background: #e8f0fe }
.gp-drop-zone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0 }
.gp-drop-label { display: flex; flex-direction: column; gap: .3rem; cursor: pointer;
    font-size: .9rem; color: var(--gp-muted) }
.gp-drop-icon { font-size: 1.6rem }
.gp-drop-hint { font-size: .75rem }
.gp-drop-preview { margin-top: .75rem }
.gp-drop-preview img { max-width: 120px; border-radius: 6px }

/* ── sliders — grid layout: Label | Slider+range-labels | Value ── */
.gp-slider-group {
    display: grid;
    grid-template-columns: 140px 1fr 64px;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    margin-bottom: 1.25rem;
}
.gp-slider-label {
    grid-column: 1; grid-row: 1 / 3;
    font-size: .8rem; font-weight: 600; color: var(--gp-muted);
    text-transform: uppercase; letter-spacing: .04em; cursor: default;
    align-self: center;
}
.gp-slider-row {
    grid-column: 2; grid-row: 1;
    position: relative;
}
.gp-slider-row input[type=range] { width: 100%; display: block; accent-color: var(--gp-blue) }
.gp-slider-minmax {
    grid-column: 2; grid-row: 2;
    display: flex; justify-content: space-between;
    font-size: .68rem; color: var(--gp-muted); margin-top: .1rem;
}
.gp-slider-value {
    grid-column: 3; grid-row: 1 / 3;
    font-size: .78rem; font-weight: 700;
    white-space: nowrap; font-variant-numeric: tabular-nums;
    text-align: right; align-self: center;
}

/* ── score badges ── */
.gp-score-badge { font-size: .72rem; font-weight: 700; padding: .15rem .5rem;
    border-radius: 12px; font-variant-numeric: tabular-nums; transition: background .15s, color .15s }
.gp-score-high   { background: #2e7d32; color: #fff }
.gp-score-medium { background: #f9a825; color: #333 }
.gp-score-low    { background: #ef6c00; color: #fff }
.gp-score-poor   { background: #c62828; color: #fff }

/* ── source-type badges (image vs text) ── */
.gp-badge-image { display: inline-block; padding: .15rem .5rem; border-radius: 12px;
    font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
    background: #e3f2fd; color: #0d47a1; }
.gp-badge-text  { display: inline-block; padding: .15rem .5rem; border-radius: 12px;
    font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums;
    background: #f3e5f5; color: #4a148c; }

/* ── results summary ── */
.gp-results-summary { font-size: .82rem; color: var(--gp-muted); margin: .5rem 0 1rem; padding-bottom: .5rem;
    border-bottom: 1px solid var(--gp-border) }

/* ── meta / error ── */
.gp-vs-meta { margin: .75rem 0 1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap }
.gp-meta-count { font-size: .85rem; color: var(--gp-muted) }
.gp-vs-error { background: #fde; border: 1px solid #f99; border-radius: 6px;
    padding: .75rem 1rem; color: #900; font-size: .9rem; margin: .75rem 0 }

/* ── query preview ── */
.gp-query-preview { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem }
.gp-query-thumb { max-width: 100px; max-height: 100px; object-fit: cover; border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.15) }
.gp-btn-rm-img { position: absolute; top: -6px; right: -6px; background: #555; color: #fff;
    border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 13px; line-height: 18px;
    cursor: pointer; text-align: center; padding: 0; opacity: .8 }
.gp-btn-rm-img:hover { opacity: 1; background: #c62828 }
.gp-query-text-tag { background: #e8f0fe; color: #1a56db; border-radius: 6px;
    padding: .4rem .8rem; font-size: .85rem; font-style: italic }

/* ── result sections ── */
.gp-result-section { margin-bottom: 2rem }
.gp-section-title { font-size: 1rem; font-weight: 700; margin-bottom: .75rem;
    padding-bottom: .4rem; border-bottom: 2px solid var(--gp-border) }
.gp-section-count { font-weight: 400; color: var(--gp-muted); font-size: .85rem }
.gp-result-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem }
@media (max-width: 1200px) { .gp-result-grid { grid-template-columns: repeat(4, 1fr) } }
@media (max-width: 900px)  { .gp-result-grid { grid-template-columns: repeat(3, 1fr) } }
@media (max-width: 600px)  { .gp-result-grid { grid-template-columns: repeat(2, 1fr) } }

/* ── score container (Hybrid: 3 Badges; Single: 1 Badge) ── */
.gp-card-scores { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; align-items: center }
.gp-badge-component {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    background: #f0f0f0;
    color: #555;
}

/* ── result card ── */
.gp-result-card { background: var(--gp-card); border-radius: var(--gp-radius); overflow: visible;
    box-shadow: 0 1px 4px rgba(0,0,0,.10); transition: box-shadow .15s, transform .15s;
    display: flex; flex-direction: column }
.gp-result-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.14); transform: translateY(-2px) }
.gp-card-thumb-link { display: block; flex-shrink: 0 }
.gp-card-thumb { width: 100%; height: 200px; background: #f5f5f5; display: flex;
    align-items: center; justify-content: center; overflow: hidden;
    border-radius: var(--gp-radius) var(--gp-radius) 0 0 }
.gp-card-thumb img { width: 100%; height: 100%; object-fit: contain }
.gp-card-no-thumb { height: 160px; background: #eee; display: flex;
    align-items: center; justify-content: center; font-size: .75rem; color: #aaa;
    border-radius: var(--gp-radius) var(--gp-radius) 0 0 }
.gp-card-body { padding: .65rem; flex: 1; display: flex; flex-direction: column; gap: .25rem }
.gp-card-badges { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .15rem }
.gp-badge-scene { background: #f0f4c3; color: #558b2f; font-size: .7rem;
    padding: .15rem .45rem; border-radius: 10px }
.gp-card-title { font-size: .95rem; font-weight: 700; color: #1a1a1a; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis }
.gp-card-subj { font-size: .82rem; font-weight: 600; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis }
.gp-card-desc { font-size: .74rem; color: #555; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden }
.gp-card-meta { display: flex; gap: 8px; font-size: .74rem; color: #666; margin: 2px 0 4px; flex-wrap: wrap; align-items: center }
.gp-card-photographer { font-style: italic; font-weight: normal; color: #444 }
.gp-card-dimensions { font-variant-numeric: tabular-nums }
.gp-card-format { background: #f0f0f0; padding: 1px 5px; border-radius: 3px; font-size: .68rem; text-transform: uppercase; letter-spacing: .03em }
.gp-card-details { display: inline-block; margin-top: 6px; padding: 5px 12px; border: 1.5px solid #f60; color: #f60; border-radius: 4px; text-decoration: none; font-size: .8rem; font-weight: 600; transition: background .15s, color .15s }
.gp-card-details:hover { background: #f60; color: #fff }
.gp-no-results { color: var(--gp-muted); font-style: italic; padding: 1rem 0 }

/* ── sticky-search via JS-Toggle (sticky-visualsearch.js) ── */
.gp-visualsearch--fixed {
    position: fixed !important;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: min(85%, 820px);
    max-width: none;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 10px 16px;
    border-radius: 12px;
}
.gp-visualsearch-placeholder {
    /* Platzhalter — height via JS gesetzt */
}

/* ── combined badge (single RRF score) ── */
.gp-badge-combined {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.gp-badge-combined.gp-score-high   { background: #c8e6c9; color: #1b5e20; }
.gp-badge-combined.gp-score-medium { background: #fff9c4; color: #5d4037; }
.gp-badge-combined.gp-score-low    { background: #ffe0b2; color: #4e342e; }
.gp-badge-combined.gp-score-poor   { background: #ffcdd2; color: #4a1414; }

/* ── score color-coding auf Legacy-Badges (gp-badge-image/text) ── */
.gp-badge-image.gp-score-high,
.gp-badge-text.gp-score-high   { background: #c8e6c9; color: #1b5e20; }
.gp-badge-image.gp-score-medium,
.gp-badge-text.gp-score-medium { background: #fff9c4; color: #5d4037; }
.gp-badge-image.gp-score-low,
.gp-badge-text.gp-score-low   { background: #ffe0b2; color: #4e342e; }
.gp-badge-image.gp-score-poor,
.gp-badge-text.gp-score-poor  { background: #ffcdd2; color: #4a1414; }

/* ── sort bar ── */
.gp-sort-bar {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: .5rem 0 .75rem;
    flex-wrap: wrap;
}
.gp-sort-label {
    font-size: .78rem;
    color: var(--gp-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-right: .25rem;
}
.gp-sort-btn {
    display: inline-block;
    padding: .3rem .85rem;
    border: 1.5px solid var(--gp-border);
    border-radius: 16px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gp-text);
    text-decoration: none;
    background: #fff;
    transition: border-color .15s, background .15s, color .15s;
    white-space: nowrap;
}
.gp-sort-btn:hover { border-color: var(--gp-blue); color: var(--gp-blue); background: #e8f0fe }
.gp-sort-btn.active { border-color: var(--gp-blue); background: var(--gp-blue); color: #fff }
.gp-sort-reset {
    font-size: .75rem;
    color: var(--gp-muted);
    text-decoration: none;
    padding: .2rem .5rem;
    border-radius: 10px;
    border: 1px solid var(--gp-border);
    background: #fff;
}
.gp-sort-reset:hover { color: #c62828; border-color: #c62828 }

/* ── limited-warning (weak top-score, top-10 mode) ── */
.gp-limited-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #664d03;
    margin: 0 0 12px;
}

/* ── weak-warning ── */
.gp-weak-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #664d03;
    margin: 0 0 12px;
}

/* ── badge tooltips (CSS-only on desktop, JS-tap on mobile) ── */
.gp-badge-combined, .gp-badge-component { position: relative; cursor: help }

.gp-badge-combined[data-tooltip]::before,
.gp-badge-component[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    background: #2c2c2e;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: normal;
    line-height: 1.4;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 100000;
}
.gp-badge-combined[data-tooltip]::after,
.gp-badge-component[data-tooltip]::after {
    content: '';
    position: absolute;
    top: calc(100% + 3px);
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: transparent;
    border-bottom-color: #2c2c2e;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    z-index: 100000;
}

@media (hover: hover) {
    .gp-badge-combined:hover[data-tooltip]::before,
    .gp-badge-combined:hover[data-tooltip]::after,
    .gp-badge-component:hover[data-tooltip]::before,
    .gp-badge-component:hover[data-tooltip]::after { opacity: 1; visibility: visible }
}

.gp-badge-combined.show-tooltip[data-tooltip]::before,
.gp-badge-combined.show-tooltip[data-tooltip]::after,
.gp-badge-component.show-tooltip[data-tooltip]::before,
.gp-badge-component.show-tooltip[data-tooltip]::after { opacity: 1; visibility: visible }

/* ── Similar Images ──────────────────────────────────────────────────────── */
.gp-similar-images {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e5e5ea;
}

.gp-similar-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 16px;
}

.gp-similar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gp-similar-grid .gp-result-card {
    font-size: 0.88em;
}

.gp-similar-grid .gp-card-thumb {
    height: 140px;
}

.gp-similar-grid .gp-card-no-thumb {
    height: 140px;
}

/* ──────────────────────────────────────────────────────────────────────────
   S43: Mobile-Truncation-Fix
   Defensive Regeln gegen Grid-Item-Sprengung auf schmalen Viewports.
   Greift erst, wenn intrinsic-min-width des Inhalts > Spalte wird.
   ────────────────────────────────────────────────────────────────────────── */
.gp-result-card,
.gp-similar-grid .gp-result-card { min-width: 0; }

.gp-card-meta {
    flex-wrap: wrap;
    min-width: 0;
    row-gap: 4px;
}
.gp-card-meta > * { min-width: 0; }

.gp-card-photographer,
.gp-card-subj,
.gp-card-description,
.gp-card-primary-subject { overflow-wrap: anywhere; word-break: break-word; }

.gp-card-thumb img { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 480px) {
    .gp-result-grid,
    .gp-similar-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Druckgröße — sitzt in .gp-slider-group (Spalte 2), Felder brechen um ── */
.gp-size-row { display: flex; gap: 8px; flex-wrap: wrap }
.gp-size-field { display: flex; flex-direction: column; gap: .15rem; flex: 1 1 88px; min-width: 88px }
.gp-size-field > span { font-size: .68rem; color: var(--gp-muted) }
.gp-size-field input {
    width: 100%; box-sizing: border-box;
    font-size: .85rem; padding: .3rem .4rem;
    border: 1px solid var(--gp-border); border-radius: 6px;
}
.gp-size-help { font-size: .68rem; color: var(--gp-muted); margin-top: .25rem }

/* ── Browse-Modus (Druckgröße ohne Suchbegriff) ── */
.gp-browse-heading { font-size: 1.05rem; font-weight: 600; margin: 0 0 .5rem }
.gp-size-truncated {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #664d03;
    margin: 0 0 12px;
}
