/* VAI Search v0.5.0 — verifizierte Direktangebote */

/* --- .tool-card als Flex-Spalte für volle Höhe --- */
.tool-card {
    display: flex;
    flex-direction: column;
}

/* --- .product-search-form: Flex-Spalte, füllt verfügbaren Platz --- */
.product-search-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

/* --- Debug/Transparenz-Styles --- */
.vai-debug-queries {
    margin: 4px 0;
    color: #8899aa;
    font-size: 11px;
    font-style: italic;
}

.vai-api-error {
    margin: 8px 0;
    color: #a32d2d;
    font-size: 12px;
    background: #fff0f0;
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid #a32d2d;
}

/* --- Quota-Anzeige --- */
.vai-quota {
    margin: 8px 0 4px;
    color: #5b6776;
    font-size: 13px;
    font-weight: 600;
    transition: color .2s ease;
    flex-shrink: 0;
}

.vai-quota-low {
    color: #c67a1e;
}

.vai-quota-exhausted {
    color: #a32d2d;
    font-weight: 700;
}

/* --- Bottom-Zeile: Button | Disclaimer, horizontal --- */
.vai-bottom-block {
    margin-top: 8px;
    margin-bottom: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
    order: 5;
}

.vai-btn-wrapper {
    flex-shrink: 0;
}

.vai-disclaimer-wrapper {
    flex: 1 1 auto;
    min-width: 0;
}

.vai-disclaimer-wrapper .vai-disclaimer {
    margin: 0;
    color: #7a8796;
    font-size: 12px;
    line-height: 1.45;
}

/* --- Textarea --- */
.vai-query-input {
    display: block;
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border: 1px solid #dde5ee;
    border-radius: 7px;
    padding: 14px 16px;
    background: #fbfdff;
    color: #17212b;
    font: inherit;
    font-size: 15px;
    line-height: 1.5;
    box-sizing: border-box;
    flex-shrink: 0;
}

.vai-query-input:focus {
    outline: none;
    border-color: #0f8a7b;
    box-shadow: 0 0 0 3px rgba(15,138,123,.08);
}

.vai-query-input::placeholder {
    color: #9aacbe;
}

.vai-query-input:disabled {
    background: #f4f7fa;
    opacity: 0.7;
}

.vai-image-label {
    display: block;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px dashed #b9c8d6;
    border-radius: 7px;
    color: #37475a;
    font-size: 13px;
    cursor: pointer;
}

.vai-image-input {
    display: block;
    margin-top: 6px;
    max-width: 100%;
    font-size: 12px;
}

.vai-image-status {
    color: #0f8a7b;
    font-weight: 700;
}

/* --- Hinweistext --- */
.vai-hint {
    margin: 10px 0 0;
    color: #5b6776;
    font-size: 13px;
    line-height: 1.45;
    flex-shrink: 0;
}

.vai-sort-select {
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px solid #dde5ee;
    border-radius: 7px;
    background: #fff;
    color: #37475a;
    font: inherit;
    font-size: 13px;
}

/* --- Ergebnisbereich --- */
.vai-search-results {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
    margin-top: 12px;
    max-height: 360px;
    order: 4;
}

.vai-results {
    display: grid;
    gap: 8px;
}

/* --- Einzelnes Ergebnis: Card mit Bild-Platzhalter links --- */
.vai-result {
    display: flex;
    gap: 10px;
    border: 1px solid #e5edf3;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(28,44,63,.06);
    align-items: flex-start;
}

/* Bild-Platzhalter */
.vai-img-placeholder {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    background: #f0f4f8;
    border: 1px dashed #cdd6e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aacbe;
    font-size: 11px;
    text-align: center;
}

.vai-result-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 6px;
    background: #f7fafc;
    border: 1px solid #e5edf3;
}

.vai-img-placeholder::before {
    content: "📷";
    font-size: 24px;
    opacity: 0.5;
}

/* Result-Body (rechts vom Bild) */
.vai-result-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vai-result-body h3 {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    color: #17212b;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.vai-meta {
    margin: 0;
    color: #5b6776;
    font-size: 12px;
}

.vai-buyer-protection {
    display: inline-block;
    align-self: flex-start;
    margin: 1px 0;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e9f7f4;
    color: #0d7568;
    font-size: 11px;
    font-weight: 700;
}

.vai-desc {
    margin: 0;
    color: #37475a;
    font-size: 13px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.vai-relevance {
    margin: 0;
    color: #7a8796;
    font-size: 12px;
    font-style: italic;
}

/* Preis: IDR prominent */
.vai-price {
    margin: 2px 0 0;
    color: #0f8a7b;
    font-size: 16px;
    font-weight: 800;
}

.vai-price-unavailable {
    margin: 2px 0 0;
    color: #9aacbe;
    font-size: 14px;
    font-style: italic;
}

.vai-availability {
    margin: 0;
    color: #276749;
    font-size: 12px;
    font-weight: 700;
}

/* --- CTA-Link --- */
.vai-cta-btn {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 11px;
    border-radius: 6px;
    background: #0f8a7b;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s ease;
    align-self: flex-start;
}

.vai-cta-btn:hover {
    background: #0d7568;
}

/* --- Button (flex-shrink:0, bleibt unten) --- */
.vai-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    padding: 13px 22px;
    border: 0;
    border-radius: 7px;
    background: #0f8a7b;
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(15,138,123,.2);
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
    flex-shrink: 0;
    align-self: flex-start;
}

.vai-search-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15,138,123,.28);
}

.vai-search-btn:disabled {
    opacity: .7;
    cursor: not-allowed;
}

/* --- Disclaimer --- */
.vai-disclaimer {
    margin: 0;
    color: #7a8796;
    font-size: 12px;
    line-height: 1.45;
}

/* --- Spinner --- */
.vai-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vai-spin .8s linear infinite;
    vertical-align: middle;
}

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

/* --- Ladezustand --- */
.vai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 0;
    color: #5b6776;
    font-size: 15px;
    min-height: 80px;
}

.vai-loading .vai-spinner {
    width: 28px;
    height: 28px;
    border-color: #dde5ee;
    border-top-color: #0f8a7b;
}

/* --- Fehler / Leer / Hinweis --- */
.vai-error,
.vai-empty,
.vai-notice {
    margin: 12px 0 0;
    padding: 14px;
    border-radius: 7px;
    font-size: 14px;
    line-height: 1.5;
}

.vai-error {
    background: #fff0f0;
    color: #a32d2d;
    border: 1px solid #f5cccc;
}

.vai-empty {
    background: #f7fafc;
    color: #5b6776;
    border: 1px solid #e5edf3;
}

.vai-notice {
    background: #fff8e6;
    color: #7a5c1a;
    border: 1px solid #f5e6b8;
}

/* --- Mobile --- */
@media (max-width: 767px) {
    .vai-query-input {
        min-height: 140px;
        padding: 12px 14px;
    }

    .vai-search-btn {
        width: 100%;
        padding: 14px 20px;
    }

    .vai-result {
        gap: 10px;
        padding: 12px;
    }

    .vai-img-placeholder,
    .vai-result-image {
        width: 64px;
        height: 64px;
    }

    .vai-result-body h3 {
        font-size: 14px;
    }

    .vai-cta-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .vai-bottom-block {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
}
