* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
}

.subtitle {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.subtitle a { color: #6366f1; text-decoration: none; }
.subtitle a:hover { text-decoration: underline; }

/* ── Suchformular ── */
.search-form { margin-bottom: 1.5rem; }

.search-row { display: flex; gap: 0.5rem; }

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}
.search-input:focus { border-color: #6366f1; }

.index-select {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.search-btn {
    padding: 0.75rem 1.5rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.search-btn:hover { background: #4f46e5; }

/* ── Meta ── */
.results-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1rem;
}
.results-meta code {
    background: #e2e8f0;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* ── Kachel-Grid ── */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.tile {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    display: flex;
    flex-direction: column;
}
.tile:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
}

/* Produktbild */
.tile-img-wrap {
    position: relative;
    width: 100%;
    height: 90px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tile-img {
    width: 100%;
    height: 90px;
    object-fit: contain;
    display: block;
}
.tile-img-placeholder {
    font-size: 2rem;
    color: #cbd5e1;
}
.badge-sale {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

/* Kachel-Body */
.tile-body {
    padding: 0.5rem 0.6rem 0.4rem;
    flex: 1;
}
.tile-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tile-brand {
    font-size: 0.7rem;
    color: #6366f1;
    margin-top: 2px;
    font-weight: 500;
}
.tile-price {
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: 600;
}
.price-sale { color: #ef4444; }
.price-old  { color: #94a3b8; text-decoration: line-through; font-size: 0.7rem; margin-left: 3px; }

/* Relevanz-Erklärung */
.tile-score {
    border-top: 1px solid #f1f5f9;
    padding: 0.4rem 0.6rem;
    font-size: 0.67rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.score-bar-wrap {
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2px;
}
.score-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.score-label {
    font-weight: 600;
    font-size: 0.68rem;
}
.score-match, .score-pos {
    color: #94a3b8;
    font-size: 0.64rem;
}

/* ── Overlay ── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.overlay.visible { display: flex; }

.overlay-box {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.overlay-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    line-height: 28px;
    text-align: center;
    cursor: pointer;
    color: #64748b;
    transition: background 0.15s;
}
.overlay-close:hover { background: #e2e8f0; }

.ov-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.75rem;
    padding-right: 2rem;
}
.ov-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    float: right;
    margin: 0 0 0.75rem 1rem;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}
.ov-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    margin-bottom: 0.75rem;
    clear: both;
}
.ov-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.85rem;
    align-items: baseline;
}
.ov-key {
    min-width: 130px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.ov-val {
    color: #1e293b;
    word-break: break-word;
}
.ov-link {
    color: #6366f1;
    text-decoration: none;
    font-size: 0.75rem;
}
.ov-link:hover { text-decoration: underline; }

.ov-details {
    margin-top: 0.5rem;
}
.ov-details summary {
    font-size: 0.8rem;
    color: #6366f1;
    cursor: pointer;
    font-weight: 600;
    padding: 0.25rem 0;
}
.ov-rest { margin-top: 0.5rem; }

/* ── Query-Analyse-Box ── */
.query-analysis {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}
.qa-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0369a1;
    margin-bottom: 0.4rem;
}
.qa-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.qa-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
}
.qa-tag--color   { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.qa-tag--size    { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }
.qa-tag--brand   { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.qa-tag--gender  { background: #f0f4ff; color: #3730a3; border: 1px solid #a5b4fc; }
.qa-tag--filter  { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.qa-tag--nofilter{ background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.qa-tag--warn    { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.qa-remove {
    font-size: 0.75rem;
    color: #6366f1;
    text-decoration: none;
    margin-left: 0.25rem;
}
.qa-remove:hover { text-decoration: underline; }
.qa-text {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: #64748b;
}
.qa-text code {
    background: #e0f2fe;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.7rem;
    color: #0369a1;
}

/* ── Attribut-Chips auf Kacheln ── */
.tile-attrs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 3px;
}
.attr-chip {
    font-size: 0.62rem;
    padding: 1px 5px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.attr-chip.attr-match {
    background: #fef9c3;
    color: #854d0e;
    border-color: #fde68a;
    font-weight: 700;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1e293b;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.page-btn:hover {
    background: #f1f5f9;
    border-color: #6366f1;
    color: #6366f1;
}
.page-btn--active {
    background: #6366f1;
    border-color: #6366f1;
    color: white;
    cursor: default;
}
.page-btn--active:hover {
    background: #6366f1;
    color: white;
}
.page-btn--disabled {
    color: #cbd5e1;
    border-color: #f1f5f9;
    background: #f8fafc;
    cursor: default;
}
.page-btn--disabled:hover {
    background: #f8fafc;
    border-color: #f1f5f9;
    color: #cbd5e1;
}
.page-gap {
    color: #94a3b8;
    padding: 0 0.2rem;
}

/* ── Status ── */
.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.no-results { text-align: center; color: #64748b; padding: 2rem; }
.info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 1rem;
    border-radius: 8px;
}
.info code {
    background: #dbeafe;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin: 0 0.2rem;
}
.avail-yes { color: #16a34a; }
.avail-no  { color: #dc2626; }
