.rist-widget {
    max-width: 680px;
    margin: 0 auto;
    padding: 28px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15,23,42,0.06);
    font-family: inherit;
    border: 1px solid #eef1f5;
}

.rist-header {
    text-align: center;
    margin-bottom: 20px;
}

.rist-title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.rist-subtitle {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.rist-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 10px;
}

.rist-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #475569;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.rist-tab.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.rist-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 170px;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    cursor: pointer;
    text-align: center;
    padding: 24px;
    transition: border-color 0.2s, background 0.2s;
}

.rist-dropzone:hover,
.rist-dropzone.rist-dragover {
    border-color: #2563eb;
    background: #f5f9ff;
}

.rist-dropzone-icon {
    font-size: 32px;
}

.rist-dropzone-text {
    color: #334155;
    font-size: 15px;
    font-weight: 600;
}

.rist-dropzone-sub {
    color: #94a3b8;
    font-size: 12.5px;
}

.rist-url-row {
    display: flex;
    gap: 10px;
}

.rist-url-field {
    flex: 1;
    padding: 12px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14.5px;
    box-sizing: border-box;
}

.rist-url-field:focus {
    outline: none;
    border-color: #2563eb;
}

.rist-hint {
    margin: 10px 2px 0;
    font-size: 12.5px;
    color: #94a3b8;
}

.rist-btn-primary {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.rist-btn-primary:hover {
    opacity: 0.92;
}

.rist-btn-primary:active {
    transform: scale(0.98);
}

.rist-search-all {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 6px;
}

.rist-status {
    margin-top: 12px;
    font-size: 13.5px;
    color: #64748b;
    min-height: 18px;
    text-align: center;
}

.rist-status.rist-error {
    color: #dc2626;
    font-weight: 600;
}

/* Preview card */
.rist-preview-card {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.rist-preview-top {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
}

.rist-preview-thumb {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.rist-preview-meta {
    flex: 1;
    min-width: 0;
}

.rist-meta-name {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rist-meta-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-size: 12.5px;
    color: #64748b;
}

.rist-meta-grid strong {
    color: #334155;
}

.rist-remove-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
}

.rist-remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Results / engine selection */
.rist-results {
    margin-top: 22px;
}

.rist-results-label {
    font-weight: 700;
    font-size: 14px;
    color: #334155;
    margin-bottom: 10px;
}

.rist-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.rist-engine-item {
    position: relative;
}

.rist-engine-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 8px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13.5px;
    color: #fff;
    text-align: center;
    transition: opacity 0.15s, transform 0.1s;
}

.rist-engine-btn:hover {
    opacity: 0.9;
}

.rist-engine-btn:active {
    transform: scale(0.97);
}

.rist-engine-cb {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    accent-color: #2563eb;
    cursor: pointer;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.rist-select-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 12px;
    cursor: pointer;
    padding: 8px;
}

.rist-select-all-row input {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
}

.rist-google    { background: #4285F4; }
.rist-lens      { background: #6d28d9; }
.rist-bing      { background: #008373; }
.rist-yandex    { background: #FC3F1D; }
.rist-tineye    { background: #3ba43b; }
.rist-pinterest { background: #E60023; }

.rist-trust {
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
    margin: 20px 0 0;
}

/* ==================== MOBILE OPTIMIZATION ==================== */
@media (max-width: 600px) {
    .rist-widget {
        padding: 16px;
        border-radius: 14px;
        max-width: 100%;
    }

    .rist-title {
        font-size: 19px;
    }

    .rist-subtitle {
        font-size: 13px;
    }

    .rist-tab {
        padding: 12px 10px;
        font-size: 13.5px;
        min-height: 44px;
    }

    .rist-dropzone {
        min-height: 140px;
        padding: 18px;
    }

    .rist-dropzone-icon {
        font-size: 28px;
    }

    .rist-dropzone-text {
        font-size: 14px;
    }

    .rist-url-row {
        flex-direction: column;
    }

    .rist-url-field {
        min-height: 46px;
        font-size: 16px; /* prevents iOS zoom-on-focus */
    }

    .rist-btn-primary {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .rist-preview-top {
        flex-wrap: wrap;
    }

    .rist-preview-thumb {
        width: 64px;
        height: 64px;
    }

    .rist-meta-grid {
        flex-direction: column;
        gap: 3px;
    }

    /* Engine buttons: 2 per row on mobile, bigger tap targets */
    .rist-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .rist-engine-btn {
        min-height: 50px;
        font-size: 14px;
    }

    .rist-engine-cb {
        width: 22px;
        height: 22px;
        top: -7px;
        right: -7px;
    }

    /* Sticky search-all button so it's always reachable on mobile */
    .rist-search-all {
        position: sticky;
        bottom: 10px;
        z-index: 5;
        box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    }
}

@media (max-width: 360px) {
    .rist-buttons {
        grid-template-columns: 1fr;
    }
}
