/* ═══════════════════════════════════════════════════
   3DRicambi — Model Finder + Results Page
   Uses site palette: #0BB38C primary, #1E293B text
   v3.1.0
   ═══════════════════════════════════════════════════ */

/* ───── Finder container ───── */
.rcb-finder {
    margin: 20px 0;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.rcb-finder__inner {
    padding: 24px 28px;
}

/* ───── Title ───── */
.rcb-finder__title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.3;
}

/* ───── Fields row ───── */
.rcb-finder__fields {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.rcb-finder__field {
    flex: 1;
    min-width: 0;
    position: relative;
}

.rcb-finder__field--model {
    flex: 1.2;
}

/* ───── Select & Input ───── */
.rcb-finder__select,
.rcb-finder__input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 0 16px;
    font-size: 15px;
    font-family: inherit;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    background: #fff;
    color: #0F172A;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.rcb-finder__select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.rcb-finder__select:focus,
.rcb-finder__input:focus {
    border-color: #0BB38C;
    box-shadow: 0 0 0 3px rgba(11, 179, 140, 0.15);
}

.rcb-finder__input::placeholder {
    color: #94A3B8;
}

.rcb-finder__input:disabled {
    background: #F1F5F9;
    color: #CBD5E1;
    border-color: #E2E8F0;
    cursor: not-allowed;
}

.rcb-finder__input:disabled::placeholder {
    color: #CBD5E1;
}

/* ───── Search button ───── */
.rcb-finder__btn {
    flex: 0 0 auto;
    height: 50px;
    padding: 0 36px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #0BB38C;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, opacity 0.2s;
}

.rcb-finder__btn:hover:not(:disabled) {
    background: #078768;
}

.rcb-finder__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ───── Model dropdown (autocomplete) ───── */
.rcb-model-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.rcb-model-dropdown:empty {
    display: none;
}

.rcb-model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    color: #0F172A;
    background: none;
    border: none;
    border-bottom: 1px solid #F1F5F9;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
}

.rcb-model-option:last-child {
    border-bottom: none;
}

.rcb-model-option:hover {
    background: #F1F5F9;
}

.rcb-model-option__name {
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.3px;
}

.rcb-model-option__count {
    font-size: 12px;
    color: #94A3B8;
    white-space: nowrap;
    margin-left: 12px;
}

.rcb-model-loading,
.rcb-model-empty {
    padding: 16px;
    text-align: center;
    font-size: 14px;
    color: #475569;
}

/* ───── Popular models ───── */
.rcb-popular {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #F1F5F9;
}

.rcb-popular__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.rcb-popular__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rcb-popular__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    color: #0BB38C;
    background: #E6F9F4;
    border: 1px solid #A7F3D0;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.rcb-popular__chip:hover {
    background: #D1FAE5;
    border-color: #6EE7B7;
    color: #078768;
}

.rcb-popular__count {
    font-size: 11px;
    font-weight: 400;
    color: #94A3B8;
}

.rcb-popular__loading {
    font-size: 13px;
    color: #94A3B8;
    padding: 4px 0;
}

/* ───── Separator "oppure" ───── */
.rcb-finder__separator {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 18px 0 2px;
    color: #94A3B8;
    font-size: 13px;
    font-weight: 500;
}

.rcb-finder__separator::before,
.rcb-finder__separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #E2E8F0;
}

/* ───── AI Photo Recognition ───── */
.rcb-photo {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #F1F5F9;
}

/* Trigger row: camera button + guide toggle */
.rcb-photo__trigger {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.rcb-photo__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #0BB38C;
    background: #E6F9F4;
    border: 2px solid #A7F3D0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.rcb-photo__btn:hover {
    background: #D1FAE5;
    border-color: #6EE7B7;
    color: #078768;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 179, 140, 0.15);
}

.rcb-photo__btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.rcb-photo__btn svg {
    flex-shrink: 0;
}

.rcb-photo__guide-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #64748B;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s;
}

.rcb-photo__guide-toggle:hover {
    color: #0BB38C;
}

.rcb-photo__guide-toggle svg {
    flex-shrink: 0;
}

/* Guide panel — hidden by default, revealed via JS class toggle */
.rcb-photo__guide {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease, margin 0.25s ease;
    margin-top: 0;
}

.rcb-photo__guide--open {
    max-height: 300px;
    opacity: 1;
    margin-top: 0;
}

.rcb-photo__guide-inner {
    margin-top: 12px;
    padding: 16px 20px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
}

.rcb-photo__guide-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.rcb-photo__guide-list {
    margin: 0 0 10px 20px;
    padding: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.7;
}

.rcb-photo__guide-list li {
    margin-bottom: 2px;
}

.rcb-photo__guide-tips {
    font-size: 12px;
    color: #64748B;
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
}

.rcb-photo__guide-tips strong {
    color: #334155;
}

/* Loading state */
.rcb-photo__loading-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
}

.rcb-photo__preview {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #F1F5F9;
}

.rcb-photo__preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rcb-photo__loading-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

/* Spinner */
.rcb-photo__spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #E2E8F0;
    border-top-color: #0BB38C;
    border-radius: 50%;
    animation: rcbSpin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes rcbSpin {
    to { transform: rotate(360deg); }
}

/* Result states */
.rcb-photo__result-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
}

.rcb-photo__result-inner .rcb-photo__result-icon {
    margin-top: 2px;
}

.rcb-photo__result-icon {
    flex-shrink: 0;
}

.rcb-photo__result-text {
    flex: 1;
}

.rcb-photo__result--success {
    background: #E6F9F4;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.rcb-photo__result--success .rcb-photo__result-icon {
    color: #0BB38C;
}

.rcb-photo__result--warning {
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    color: #9A3412;
}

.rcb-photo__result--warning .rcb-photo__result-icon {
    color: #F59E0B;
}

.rcb-photo__result--error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

.rcb-photo__result--error .rcb-photo__result-icon {
    color: #EF4444;
}

/* Available state — model recognized, part exists, WhatsApp CTA */
.rcb-photo__result--available {
    background: #EFF6FF;
    border: 1px solid #93C5FD;
    color: #1E3A5F;
}

.rcb-photo__result--available .rcb-photo__result-icon {
    color: #3B82F6;
}

/* Unreadable state — couldn't read, retry + WhatsApp */
.rcb-photo__result--unreadable {
    background: #FFF7ED;
    border: 1px solid #FED7AA;
    color: #78350F;
}

.rcb-photo__result--unreadable .rcb-photo__result-icon {
    color: #F59E0B;
}

/* Result subtitle */
.rcb-photo__result-sub {
    display: block;
    font-size: 13px;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

/* Actions container (WhatsApp etc.) */
.rcb-photo__actions {
    margin-top: 12px;
}

/* WhatsApp button */
.rcb-photo__wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: #25D366;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.rcb-photo__wa-btn:hover {
    background: #1EBE59;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
}

.rcb-photo__wa-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.rcb-photo__wa-btn svg {
    flex-shrink: 0;
}

/* Retry button */
.rcb-photo__retry-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: pointer;
    color: inherit;
    transition: background 0.15s;
}

.rcb-photo__retry-btn:hover {
    background: rgba(255, 255, 255, 1);
}

/* Animations */
@keyframes rcbFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes rcbSlideDown {
    from { opacity: 0; max-height: 0; }
    to   { opacity: 1; max-height: 300px; }
}

/* ───── Product page banner ───── */
.rcb-product-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #E6F9F4;
    border: 1px solid #A7F3D0;
    border-radius: 8px;
    color: #065F46;
    font-size: 14px;
    margin-bottom: 20px;
}

.rcb-product-banner svg {
    flex-shrink: 0;
    color: #0BB38C;
}

/* ───── Card badge (inside content-product.php) ───── */
.rcb-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    margin-bottom: 2px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #065F46;
    background: #D1FAE5;
    border-radius: 4px;
    line-height: 1.4;
}

.rcb-card-badge svg {
    flex-shrink: 0;
    color: #0BB38C;
}

/* ───── Results page: banner ───── */
.rcb-results-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 24px;
    margin: 20px 0;
    background: #E6F9F4;
    border: 1px solid #A7F3D0;
    border-radius: 12px;
    color: #065F46;
}

.rcb-results-banner svg {
    flex-shrink: 0;
    color: #0BB38C;
}

.rcb-results-banner__text strong {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: #065F46;
}

.rcb-results-banner__text span {
    font-size: 13px;
    color: #047857;
}

/* ───── Results page: collapsed finder ───── */
.rcb-results-details {
    margin-bottom: 20px;
}

.rcb-results-details summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #0BB38C;
    padding: 10px 0;
    list-style: none;
}

.rcb-results-details summary::-webkit-details-marker {
    display: none;
}

.rcb-results-details summary::before {
    content: '+ ';
    font-weight: 700;
}

.rcb-results-details[open] summary::before {
    content: '- ';
}

.rcb-results-details summary:hover {
    color: #078768;
    text-decoration: underline;
}

.rcb-results-details .rcb-finder {
    margin-top: 8px;
}

/* ───── Results page: no products ───── */
.rcb-no-results {
    text-align: center;
    padding: 60px 24px;
    color: #475569;
}

.rcb-no-results p {
    font-size: 16px;
    margin-bottom: 16px;
}

.rcb-no-results a {
    display: inline-block;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #0BB38C;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s;
}

.rcb-no-results a:hover {
    background: #078768;
    color: #fff;
}

/* ───── Results page: pagination ───── */
.rcb-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 24px 0 8px;
}

.rcb-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
    font-size: 14px;
    color: #475569;
    background: #fff;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}

.rcb-pagination .page-numbers:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    color: #475569;
}

.rcb-pagination .page-numbers.current {
    color: #fff;
    background: #0BB38C;
    border-color: #0BB38C;
    font-weight: 600;
}

.rcb-pagination .page-numbers.dots {
    border: none;
    background: none;
}

/* ───── Responsive ───── */
@media (max-width: 768px) {
    .rcb-finder__inner {
        padding: 18px 16px;
    }

    .rcb-finder__title {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .rcb-finder__fields {
        flex-direction: column;
        gap: 10px;
    }

    .rcb-finder__field,
    .rcb-finder__field--model {
        flex: none;
        width: 100%;
    }

    .rcb-finder__btn {
        width: 100%;
        height: 50px;
        text-align: center;
    }

    .rcb-product-banner {
        padding: 12px 14px;
        font-size: 13px;
    }

    .rcb-results-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 8px;
    }

    .rcb-results-banner__text strong {
        font-size: 15px;
    }

    .rcb-popular__list {
        gap: 6px;
    }

    .rcb-popular__chip {
        padding: 6px 12px;
        font-size: 12px;
    }

    .rcb-card-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Photo: full-width camera button on mobile */
    .rcb-photo__trigger {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .rcb-photo__btn {
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
        border-radius: 10px;
    }

    .rcb-photo__guide-toggle {
        justify-content: center;
        font-size: 12px;
    }

    .rcb-photo__loading-inner {
        gap: 12px;
    }

    .rcb-photo__preview {
        width: 48px;
        height: 48px;
    }

    .rcb-photo__result-inner {
        padding: 12px 14px;
        font-size: 13px;
        flex-wrap: wrap;
    }

    .rcb-photo__result-sub {
        font-size: 12px;
    }

    .rcb-photo__actions {
        width: 100%;
        margin-top: 10px;
    }

    .rcb-photo__wa-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 15px;
    }
}
